Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: ensure publishing of npm schema happens regardless of if app deploy is skipped #1289

Merged
merged 2 commits into from
Oct 14, 2024

Conversation

arealmaas
Copy link
Collaborator

@arealmaas arealmaas commented Oct 14, 2024

Description

Ensures that the npm package is published when:

  • The deployment of apps has been skipped
  • The deployment of apps has been run successfully

Related Issue(s)

  • #{issue number}

Verification

  • Your code builds clean without any errors or warnings
  • Manual testing done (required)
  • Relevant automated test added (if you find this hard, leave it and we'll help out)

Documentation

  • Documentation is updated (either in docs-directory, Altinnpedia or a separate linked PR in altinn-studio-docs., if applicable)

Summary by CodeRabbit

  • New Features

    • Enhanced CI/CD workflow to ensure critical jobs execute under broader conditions, improving reliability.
  • Bug Fixes

    • Adjusted job conditions to allow execution regardless of previous job outcomes, ensuring important tasks are not skipped.

@arealmaas arealmaas requested review from a team as code owners October 14, 2024 07:58
Copy link
Contributor

coderabbitai bot commented Oct 14, 2024

📝 Walkthrough

Walkthrough

The pull request modifies the CI/CD workflow configurations in two YAML files, .github/workflows/ci-cd-main.yml and .github/workflows/ci-cd-staging.yml. The changes primarily involve updating the conditions for executing specific jobs, allowing them to run under broader circumstances. The publish-schema-npm, run-e2e-tests, and send-slack-message-on-failure jobs now utilize always(), !failure(), and !cancelled() functions, ensuring they can execute regardless of the success or failure of preceding jobs, while maintaining conditional execution based on event types and outputs.

Changes

File Change Summary
.github/workflows/ci-cd-main.yml - Updated if condition for publish-schema-npm job to include always(), allowing execution unless failed or cancelled.
- Updated if condition for run-e2e-tests job similarly to allow execution under broader conditions.
.github/workflows/ci-cd-staging.yml - Updated if conditions for publish-schema-npm, run-e2e-tests, and send-slack-message-on-failure jobs to use always(), !failure(), and !cancelled(), ensuring they run regardless of previous job outcomes.

Possibly related PRs

Suggested reviewers

  • elsand
  • knuhau

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

sonarcloud bot commented Oct 14, 2024

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
.github/workflows/ci-cd-staging.yml (1)

Line range hint 104-104: Approved with suggestion: Consider deployment status for E2E tests

The change ensures E2E tests run more consistently, which is good for catching issues. However, consider adding a check for successful deployment before running tests to avoid potentially misleading results.

if: ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasBackendChanges == 'true') && needs.deploy-apps-staging.result == 'success' }}

This would ensure tests only run if the deployment was successful.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between fd2ce77 and 41e038d.

📒 Files selected for processing (2)
  • .github/workflows/ci-cd-main.yml (1 hunks)
  • .github/workflows/ci-cd-staging.yml (1 hunks)
🧰 Additional context used
🔇 Additional comments (4)
.github/workflows/ci-cd-staging.yml (3)

93-93: Approved: Enhanced robustness for npm schema publishing

This change ensures that the publish-schema-npm job runs even if previous jobs fail or are cancelled, while still maintaining the original logic. This aligns perfectly with the PR objective of ensuring npm package publishing happens independently of app deployment status.


Line range hint 119-119: Approved: Improved error reporting

This change enhances the workflow's error reporting by ensuring that a Slack notification is sent whenever any job in the workflow fails, regardless of the trigger or specific changes. This will help maintain better visibility into CI/CD issues.


Line range hint 93-119: Summary: Changes align well with PR objectives

The modifications to the job conditions in this workflow file successfully address the PR's main objective of ensuring npm package publishing occurs independently of app deployment status. Additionally, these changes improve the overall robustness and error reporting of the CI/CD process.

Key improvements:

  1. npm schema publishing is now more resilient to failures in other jobs.
  2. E2E tests have increased chances of running, potentially catching more issues.
  3. Error reporting via Slack has been enhanced to cover all potential failure scenarios.

These changes contribute to a more reliable and informative CI/CD process.

.github/workflows/ci-cd-main.yml (1)

129-129: Approval: Enhanced npm package publishing reliability

This change improves the workflow by ensuring that the publish-schema-npm job runs more consistently. The new condition ${{ always() && !failure() && !cancelled() && (github.event_name == 'workflow_dispatch' || needs.check-for-changes.outputs.hasSchemaChanges == 'true') }} achieves the following:

  1. It allows the job to run even if previous jobs (like deploy-apps-test) fail, thanks to the always() condition.
  2. It still prevents execution if any previous job has failed (!failure()), maintaining overall workflow integrity.
  3. It respects manual cancellations (!cancelled()).
  4. It preserves the original triggers: manual dispatch or detected schema changes.

This change aligns perfectly with the PR objective of ensuring npm package publication independently of application deployment status, enhancing the reliability of the npm package availability.

.github/workflows/ci-cd-main.yml Show resolved Hide resolved
@arealmaas arealmaas changed the title ci: ensure publishing of npm schema happens regardless of app deploy ci: ensure publishing of npm schema happens regardless of if app deploy is skipped Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants