Skip to content

fix: small fixes #18127

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

Merged
merged 1 commit into from
Feb 25, 2025
Merged

fix: small fixes #18127

merged 1 commit into from
Feb 25, 2025

Conversation

lodmfjord
Copy link
Member

@lodmfjord lodmfjord commented Feb 25, 2025

...

Attach a link to issue if relevant

What

Specify what you're trying to achieve

Why

Specify why you need to achieve this

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • New Features

    • Introduced conditional build execution so that deployment jobs run only when relevant conditions are met.
    • Added safeguards that ensure deployments fail if test results are unsatisfactory, enhancing release reliability.
  • Refactor

    • Streamlined branch handling for deployments to better support multiple primary branches and improve overall pipeline efficiency.
    • Expanded compilation scope to ensure all necessary resources are included.

@lodmfjord lodmfjord requested a review from a team as a code owner February 25, 2025 16:16
Copy link
Contributor

coderabbitai bot commented Feb 25, 2025

Walkthrough

This pull request updates several CI workflows and scripts. In GitHub Action workflows, it adds a new output variable MQ_SHOULD_RUN_BUILD to the install workflow and uses it to conditionally run jobs in the merge-queue workflow. Additionally, a new step checks test outcomes in the post-docker-build job. The CI scripts have been modified by introducing a MAIN_BRANCHES constant, adding a new shouldRun() function in the tag generation script, and updating deployment type checks to reference the constant. Finally, the TypeScript configuration is updated to include the new JavaScript module.

Changes

File(s) Change Summary
.github/workflows/install.yml, .github/workflows/merge-queue.yml Introduced a new output variable MQ_SHOULD_RUN_BUILD (in install) and applied conditional execution in docker-build and post-docker-build jobs based on MQ_SHOULD_RUN_BUILD and DOCKER_CHUNKS; added a "Check tests success" step in post-docker-build.
scripts/ci/docker/const.mjs, scripts/ci/docker/generate-tag.mjs, scripts/ci/docker/get-data.mjs Added a MAIN_BRANCHES constant; introduced the shouldRun() function in generate-tag to decide build execution; updated deployment type determination to reference MAIN_BRANCHES.
scripts/tsconfig.json Extended the "include" property to explicitly cover ci/docker/const.mjs.

Sequence Diagram(s)

sequenceDiagram
  participant Prepare as Prepare Step
  participant DockerBuild as Docker-Build Job
  participant PostDockerBuild as Post-Docker-Build Job
  participant Tests as Test Runner

  Prepare->>DockerBuild: Provide MQ_SHOULD_RUN_BUILD & DOCKER_CHUNKS
  alt Conditions met (MQ_SHOULD_RUN_BUILD true and DOCKER_CHUNKS not empty)
    DockerBuild->>PostDockerBuild: Proceed with execution
    PostDockerBuild->>Tests: Check tests outcome
    alt Tests succeed
      Tests-->>PostDockerBuild: Success
    else Tests fail
      Tests-->>PostDockerBuild: Failure (exit 1)
    end
  else
    Note over DockerBuild,PostDockerBuild: Jobs skipped
  end
Loading
sequenceDiagram
  participant CI as CI Trigger
  participant GenerateTag as generate-tag.mjs
  participant Core as Core API
  participant BranchList as MAIN_BRANCHES

  CI->>GenerateTag: Trigger event with targetBranch
  GenerateTag->>BranchList: Verify if targetBranch is in MAIN_BRANCHES
  alt Conditions met (event is merge_group and branch included)
    GenerateTag->>Core: SetOutput SHOULD_RUN_BUILD true
  else
    GenerateTag->>Core: SetOutput SHOULD_RUN_BUILD false
  end
Loading

Possibly related PRs

Suggested labels

automerge, deploy-feature

Suggested reviewers

  • jonnigs
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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.

@lodmfjord lodmfjord enabled auto-merge February 25, 2025 16:16
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: 0

🧹 Nitpick comments (4)
scripts/ci/docker/generate-tag.mjs (2)

36-39: Remove commented-out code

The function contains commented-out code that's no longer needed, which can cause confusion.

 function getTagname() {
-    if (eventName === 'pull_request' && context.payload.pull_request?.number) {
-        throw new Error(`Unsupported event: ${eventName}`)
-        // return `pr-${context.payload.pull_request.number}-${randomTag}`;
+    if (eventName === 'pull_request' && context.payload.pull_request?.number) {
+        throw new Error(`Unsupported event: ${eventName}`)
     }

And similar change for getArtifactname() function.

Also applies to: 56-59


76-91: LGTM: Updated getTypeOfDeployment with MAIN_BRANCHES

Using the MAIN_BRANCHES constant improves maintainability. Consider removing the commented-out debug message.

    // UNKNOWN BRANCH
-    // console.error(`Unknown branch: ${targetBranch} - not sure how to tag this deployment`);
    throw new Error(`Unsupported branch: ${targetBranch}`)
.github/workflows/merge-queue.yml (2)

57-57: Conditional Execution for Docker Build Job:
The if condition on line 57 correctly checks that the build should run by verifying that MQ_SHOULD_RUN_BUILD equals 'true' and that DOCKER_CHUNKS is not an empty array. Please ensure that these outputs are consistently formatted as strings so that the comparisons work as intended.


187-187: Conditional Execution in Post-Docker-Build Job:
The if condition on line 187 mirrors the one used in the docker-build job to decide whether to run post-docker-build. Ensure that duplicating this condition is intentional. If multiple jobs depend on the same check, consider centralizing the logic to ease future maintenance.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 34dd3cd and 3a87b2d.

📒 Files selected for processing (6)
  • .github/workflows/install.yml (2 hunks)
  • .github/workflows/merge-queue.yml (2 hunks)
  • scripts/ci/docker/const.mjs (1 hunks)
  • scripts/ci/docker/generate-tag.mjs (3 hunks)
  • scripts/ci/docker/get-data.mjs (2 hunks)
  • scripts/tsconfig.json (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • scripts/ci/docker/const.mjs
🧰 Additional context used
📓 Path-based instructions (2)
`scripts/**/*`: "Confirm that the code adheres to the follow...

scripts/**/*: "Confirm that the code adheres to the following:

  • Script efficiency, readability, and maintainability.
  • Usage of environmental variables and configuration files for flexibility.
  • Integration with NX workspace utilities and commands."
  • scripts/tsconfig.json
  • scripts/ci/docker/get-data.mjs
  • scripts/ci/docker/generate-tag.mjs
`.github/**/*`: "Confirm that the code adheres to the follow...

.github/**/*: "Confirm that the code adheres to the following:

  • GitHub Actions workflows use 'arc-runners' as the valid runner for self-hosted ARC runners.
  • CI pipelines are efficient, using appropriate caching strategies and minimal resource consumption.
  • Reusable workflows and composite actions are properly structured for reusability.
  • Dependency management workflows meet security requirements.
  • Note: 'runs-on: arc-runners' is valid for our self-hosted runner configuration, despite standard linting warnings."
  • .github/workflows/install.yml
  • .github/workflows/merge-queue.yml
🪛 actionlint (1.7.4)
.github/workflows/merge-queue.yml

191-191: label "arc-runners" is unknown. available labels are "windows-latest", "windows-latest-8-cores", "windows-2022", "windows-2019", "ubuntu-latest", "ubuntu-latest-4-cores", "ubuntu-latest-8-cores", "ubuntu-latest-16-cores", "ubuntu-24.04", "ubuntu-22.04", "ubuntu-20.04", "macos-latest", "macos-latest-xl", "macos-latest-xlarge", "macos-latest-large", "macos-15-xlarge", "macos-15-large", "macos-15", "macos-14-xl", "macos-14-xlarge", "macos-14-large", "macos-14", "macos-13-xl", "macos-13-xlarge", "macos-13-large", "macos-13", "macos-12-xl", "macos-12-xlarge", "macos-12-large", "macos-12", "self-hosted", "x64", "arm", "arm64", "linux", "macos", "windows". if it is a custom label for self-hosted runner, set list of labels in actionlint.yaml config file

(runner-label)

🔇 Additional comments (11)
scripts/tsconfig.json (1)

4-4: LGTM: Include MJS module for TypeScript awareness

Including the JavaScript module in the TypeScript configuration ensures TypeScript is aware of this file and can properly validate imports.

.github/workflows/install.yml (2)

22-23: LGTM: Added new workflow output variable

The addition of the MQ_SHOULD_RUN_BUILD output variable follows the existing pattern and will enable conditional execution of jobs in dependent workflows.


79-79: LGTM: Properly forwarding output from step to job output

Correctly mapping the step output to the job output, maintaining consistency with the other output variables.

scripts/ci/docker/get-data.mjs (2)

7-7: LGTM: Import MAIN_BRANCHES constant

Importing the shared constant improves code maintainability and follows good modular practices.


101-101: LGTM: Replace hardcoded branch names with constant

Using the MAIN_BRANCHES constant instead of hardcoded branch names improves maintainability and reduces the risk of inconsistencies.

scripts/ci/docker/generate-tag.mjs (3)

4-4: LGTM: Import MAIN_BRANCHES constant

Using the shared constant improves code maintainability.


17-17: LGTM: Adding SHOULD_RUN_BUILD to outputs

Setting the output from the new shouldRun() function enables conditional execution in workflows.


26-33: LGTM: New shouldRun function

The function clearly determines when builds should execute, specifically for merge group events targeting main branches.

.github/workflows/merge-queue.yml (3)

70-70: Node Image Version Assignment Consistency:
On line 70, the job sets NODE_IMAGE_VERSION from needs.pre-checks.outputs.NODE_IMAGE_VERSION. Verify that the pre-checks job reliably provides this output and that this is indeed the intended value for subsequent Docker build steps.


186-186: Post-Docker-Build Dependency Update:
Adding - tests as a dependency (line 186) ensures that the post-docker-build job waits for tests to complete. Confirm that this dependency ordering aligns with your intended CI flow and that the tests job consistently sets its result output.


193-194: Test Success Validation in Post-Docker-Build Job:
The step on lines 193–194 leverages a shell check to fail the job if tests did not pass. This is a sound approach for propagating test failures. It might be beneficial to include an explicit error message or logging for easier debugging when the condition fails.

Copy link

nx-cloud bot commented Feb 25, 2025

View your CI Pipeline Execution ↗ for commit 3a87b2d.

Command Status Duration Result
nx run-many --target=build --projects=judicial-... ✅ Succeeded 8m 2s View ↗
nx run-many --target=build --projects=web --par... ✅ Succeeded 8m 59s View ↗
nx run-many --target=build --projects=api --par... ✅ Succeeded 7m 19s View ↗
nx run-many --target=build --projects=skilavott... ✅ Succeeded 5m 46s View ↗
nx run-many --target=build --projects=air-disco... ✅ Succeeded 5m 40s View ↗
nx run-many --target=build --projects=applicati... ✅ Succeeded 5m 13s View ↗
nx run-many --target=build --projects=consultat... ✅ Succeeded 5m 22s View ↗
nx run-many --target=build --projects=contentfu... ✅ Succeeded 4m 48s View ↗
Additional runs (52) ✅ Succeeded ... View ↗

☁️ Nx Cloud last updated this comment at 2025-02-25 16:48:46 UTC

@lodmfjord lodmfjord added this pull request to the merge queue Feb 25, 2025
Merged via the queue into mq-docker-pre-main with commit 85f1dc4 Feb 25, 2025
88 checks passed
@lodmfjord lodmfjord deleted the mq-docker-fix-status branch February 25, 2025 17:40
github-merge-queue bot pushed a commit that referenced this pull request Feb 28, 2025
* ci: docker deployment test (#18084)

* chore: test

* fix: test

* fix: test

* chore: test 2

* fix: better generate tag script

* chore: test build

* fix: test 2

* fix: add prepare

* fix: oops

* fix: wtf

* fix: faster

* fix: forgot

* fix: ok

* fix: ok

* fix: wtf

* fix: ok

* fix: ok

* fix: i hope

* fix: debug

* fix: ok

* fix: debug

* fix: wtf

* fix: ok

* fix: oops

* fix: texst 2

* fix: debug

* fix: oops

* fix: export variable

* fix: docker chunks

* fix: chunks

* fix: oops

* fix: oh god

* fix: oops

* fix: add git branch

* fix: add sha

* feat: write build data

* fix: upload artifact

* fix: typo

* fix: ok

* fix: test

* fix: ok

* fix: use cloudposse for matrix output

* feat: upload artifact

* fix: write data

* fix: permission

* fix: test

* fix: upload

* fix: ok

* fix: ok

* fix: deploy

* fix: oops

* fix: okok

* fix: ok

* fix: ok

* fix: ok

* fix: ok

* fix: ok

* fix: fix

* fix: 2

* fix: ok hehe

* fix: ok  changes

* fix: ok

* fix: ok

* fix: test

* fix: ok

* fix: ok

* fix: ok

* fix: hoho

* Feature/update helm values (#18100)

* feat(ci): Commit helm charts to helm-values repository

* feat(ci): Changing the steps order of the implementation

* feat(ci): Implementing logic

* feat(ci): Change implementation to use composite action

---------

Co-authored-by: Ingvar Sigurðsson <[email protected]>

* fix: fix fix

* fix: ok

* fix: ok

* fix: sorry

* fix: ok

* fix: update manifest with bs

* fix: changed files

* fix: copy

* fix: create directory if it does not exist

* fix: test

* fix: sha

* fix: target

* fix: ok

* fix: ok

* fix: ok

* fix: ok

* fix: test

* fix: sha

---------

Co-authored-by: Ingvar Sigurðsson <[email protected]>

* fix: cleanup

* fix: apply on mq (#18113)

fiX: ok

* feat: fix tag (#18118)

fix: debug msg

* fix: small fixes (#18127)

* fix: remove test branch

* fix: move yarn install

* feat: get ready for release  (#18136)

* fix: ok

* fix: ignore

* fix: ok

* fix: get sha

* fix: ok

* fix: ok

* fix: ok

* fix: error

* fix: skip run

* fix: ok

* fix: merge

* fix: nothing should happen (#18149)

* chore: addding ssh key (#18145)

* addding ssh key

* fix: passing the key

* fix: missed a spot

* fix: test

* fix: remove

* fix: ok

* fix: set secret

* fix: test

* fix: ok

* fix: ok

* fix: install 2

* fix: remove

---------

Co-authored-by: lommi <[email protected]>

* fix: update path using helm values

* fix: mq-docker

* chore: test prod and staging (#18160)

* fix: mq-docker-main

* fix: ugly hack remove this before going to main

* fix: mq docker pre main

* fix: mq workflow (#18162)

* fix: format

* fix: ok

---------

Co-authored-by: Ingvar Sigurðsson <[email protected]>
Co-authored-by: Róberta Andersen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant