Skip to content

[ci] separate build and testing jobs - #1005

Merged
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
ci-build-test
May 29, 2025
Merged

[ci] separate build and testing jobs#1005
Andrei Kvapil (kvaps) merged 1 commit into
mainfrom
ci-build-test

Conversation

@kvaps

@kvaps Andrei Kvapil (kvaps) commented May 29, 2025

Copy link
Copy Markdown
Member

Signed-off-by: Andrei Kvapil kvapss@gmail.com

Summary by CodeRabbit

  • Chores
    • Improved pull request workflow by separating build and test phases, enhancing reliability and maintainability of automated checks.
    • Updated testing process to use a pre-generated installer artifact, streamlining test execution and environment setup.
    • Enhanced release workflow to generate manifests before running tests, ensuring up-to-date configurations during verification.

@coderabbitai

coderabbitai Bot commented May 29, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

The workflow for pull requests was refactored to separate the build and test phases into distinct jobs, introducing artifact upload and download steps to decouple them. Corresponding changes in the Makefile now set the installer YAML environment variable from a pre-generated file rather than generating it inline. The release workflow was updated to run make manifests before tests.

Changes

File(s) Summary of Changes
.github/workflows/pull-requests.yaml Split single e2e job into build (build & upload artifact) and test (download artifact & run tests), with conditional execution.
packages/core/testing/Makefile Modified test-cluster target to set COZYSTACK_INSTALLER_YAML from a pre-generated file instead of inline helm template.
.github/workflows/pull-requests-release.yaml Added make manifests before make test in the "Run tests" step of the verify job.

Sequence Diagram(s)

sequenceDiagram
    participant PR as Pull Request Event
    participant Build as build Job
    participant Artifact as Artifact Store
    participant Test as test Job

    PR->>Build: Trigger build job
    Build->>Artifact: Upload cozystack-installer.yaml
    Build-->>Test: Notify completion
    Test->>Artifact: Download cozystack-installer.yaml
    Test->>Test: Run tests using installer artifact
Loading

Possibly related PRs

Suggested labels

backport

Suggested reviewers

  • lllamnyp
  • klinch0

Poem

In the warren of workflows, a split took place,
Build and test now run a separate race.
The installer YAML hops from job to job,
While Makefile bunnies tidy up the blob.
Artifacts delivered, the tests commence—
A rabbit’s delight in CI’s defense! 🐇


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c16a2fe and c69135e.

📒 Files selected for processing (3)
  • .github/workflows/pull-requests-release.yaml (1 hunks)
  • .github/workflows/pull-requests.yaml (2 hunks)
  • packages/core/testing/Makefile (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/pull-requests-release.yaml
  • packages/core/testing/Makefile
  • .github/workflows/pull-requests.yaml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ 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.
    • Explain this complex logic.
    • 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 explain this code block.
    • @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 explain its main purpose.
    • @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.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

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.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this 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.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 4

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a9c3a4c and c6f6e43.

📒 Files selected for processing (2)
  • .github/workflows/pull-requests.yaml (1 hunks)
  • packages/core/testing/Makefile (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.7)
.github/workflows/pull-requests.yaml

46-46: job "test" needs job "build" which does not exist in this workflow

(job-needs)

🔇 Additional comments (1)
.github/workflows/pull-requests.yaml (1)

63-68: Artifact download step aligns with upload path.

The download uses name: cozystack-installer into _out/assets/, matching the upload configuration. This is correct.

Comment thread packages/core/testing/Makefile Outdated
Comment on lines +35 to +37
../../../_out/cozystack-installer.yaml:
mkdir -p ../../../_out
helm template -n cozy-system installer ../installer > ../../../_out/cozystack-installer.yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Align installer artifact path with workflow upload directory.

The workflow uploads cozystack-installer.yaml into _out/assets/, but this rule generates it in _out/. This mismatch will cause test-cluster to regenerate the YAML instead of consuming the uploaded artifact.

Proposed fix:

-../../../_out/cozystack-installer.yaml:
-	mkdir -p ../../../_out
-	helm template -n cozy-system installer ../installer > ../../../_out/cozystack-installer.yaml
+../../../_out/assets/cozystack-installer.yaml:
+	mkdir -p ../../../_out/assets
+	helm template -n cozy-system installer ../installer > ../../../_out/assets/cozystack-installer.yaml
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
../../../_out/cozystack-installer.yaml:
mkdir -p ../../../_out
helm template -n cozy-system installer ../installer > ../../../_out/cozystack-installer.yaml
../../../_out/assets/cozystack-installer.yaml:
mkdir -p ../../../_out/assets
helm template -n cozy-system installer ../installer > ../../../_out/assets/cozystack-installer.yaml
🤖 Prompt for AI Agents
In packages/core/testing/Makefile around lines 35 to 37, the rule generates the
cozystack-installer.yaml file in the _out/ directory, but the workflow expects
it in _out/assets/. Modify the mkdir command to create the _out/assets directory
and update the output path of the helm template command to
../../../_out/assets/cozystack-installer.yaml to align with the workflow upload
directory.

Comment thread packages/core/testing/Makefile Outdated
Comment on lines 39 to 38
test-cluster: ../../../_out/cozystack-installer.yaml ## Run the end-to-end for creating a cluster
docker exec "${SANDBOX_NAME}" sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(cat ../../../_out/cozystack-installer.yaml) && hack/cozytest.sh hack/e2e-cluster.bats'

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Update test-cluster to reference the new artifact location.

The prerequisite and cat path must point to _out/assets/cozystack-installer.yaml to match the upload/download layout.

Proposed change:

-test-cluster: ../../../_out/cozystack-installer.yaml ## Run the end-to-end for creating a cluster
-	docker exec "${SANDBOX_NAME}" sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(cat ../../../_out/cozystack-installer.yaml) && hack/cozytest.sh hack/e2e-cluster.bats'
+test-cluster: ../../../_out/assets/cozystack-installer.yaml ## Run the end-to-end for creating a cluster
+	docker exec "${SANDBOX_NAME}" sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(cat ../../../_out/assets/cozystack-installer.yaml) && hack/cozytest.sh hack/e2e-cluster.bats'
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
test-cluster: ../../../_out/cozystack-installer.yaml ## Run the end-to-end for creating a cluster
docker exec "${SANDBOX_NAME}" sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(cat ../../../_out/cozystack-installer.yaml) && hack/cozytest.sh hack/e2e-cluster.bats'
test-cluster: ../../../_out/assets/cozystack-installer.yaml ## Run the end-to-end for creating a cluster
docker exec "${SANDBOX_NAME}" sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(cat ../../../_out/assets/cozystack-installer.yaml) && hack/cozytest.sh hack/e2e-cluster.bats'
🤖 Prompt for AI Agents
In packages/core/testing/Makefile at lines 39 to 41, update the test-cluster
target to reference the new artifact location by changing the path from
../../../_out/cozystack-installer.yaml to
../../../_out/assets/cozystack-installer.yaml in both the prerequisite and the
cat command inside the docker exec line.

Comment thread .github/workflows/pull-requests.yaml
Comment on lines +40 to +45
- name: Upload installer artifact
uses: actions/upload-artifact@v4
with:
name: cozystack-installer
path: _out/assets/cozystack-installer.yaml

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Verification agent

🧩 Analysis chain

Verify that the build step produces the installer at _out/assets.

This upload step assumes make build outputs _out/assets/cozystack-installer.yaml. Please confirm the root Makefile’s build target writes the artifact there, otherwise the upload will fail.


🏁 Script executed:

#!/bin/bash
# Confirm that the build target generates the installer in _out/assets/
rg -n "cozystack-installer.yaml" -n Makefile

Length of output: 162


I want to confirm this command is indeed part of the build target in the root Makefile. Let’s grab a few lines of context around it:


🏁 Script executed:

#!/bin/bash
rg -n -B3 -A3 "cozystack-installer.yaml" Makefile

Length of output: 269


Let’s confirm that the build target depends on the manifests step (which generates the installer):


🏁 Script executed:

#!/bin/bash
# Show the build target and its prerequisites
rg -n -C3 "^build:" Makefile

Length of output: 324


Ensure the installer is generated before uploading

The build target in the root Makefile (line 10) only depends on build-deps and builds container images; it never invokes the manifests rule that renders _out/assets/cozystack-installer.yaml (defined on line 41). As written, the upload step will fail because the installer file isn’t produced.

Please address this by either:

  • Adding manifests as a prerequisite of the build target (e.g. build: build-deps manifests), or
  • Inserting an explicit make manifests (or make -C packages/core/installer/ assets) step in your GitHub workflow before the upload.
🤖 Prompt for AI Agents
In .github/workflows/pull-requests.yaml around lines 40 to 45, the upload step
assumes the installer artifact is generated by the build step, but the root
Makefile's build target does not run the manifests rule that creates this
artifact. Fix this by either adding manifests as a prerequisite to the build
target in the Makefile or by adding an explicit step in the GitHub workflow to
run make manifests (or make -C packages/core/installer/ assets) before the
upload step to ensure the installer file exists.

@kvaps
Andrei Kvapil (kvaps) force-pushed the ci-build-test branch 4 times, most recently from 8917e87 to c16a2fe Compare May 29, 2025 15:22

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
.github/workflows/pull-requests-release.yaml (1)

38-39: Separate manifest generation and test execution steps.

Combining make manifests && make test into a single step can make it harder to pinpoint failures. Splitting into two named steps improves CI logs and debugging.

Consider this adjustment:

--- a/.github/workflows/pull-requests-release.yaml
+++ b/.github/workflows/pull-requests-release.yaml
@@ -37,4 +37,9 @@
       - name: Login to GitHub Container Registry
         uses: docker/login-action@v3
@@
-      - name: Run tests
-        run: make manifests && make test
+      - name: Generate Manifests
+        run: make manifests
+
+      - name: Run Tests
+        run: make test
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c6f6e43 and c16a2fe.

📒 Files selected for processing (3)
  • .github/workflows/pull-requests-release.yaml (1 hunks)
  • .github/workflows/pull-requests.yaml (2 hunks)
  • packages/core/testing/Makefile (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/pull-requests.yaml

Comment thread packages/core/testing/Makefile Outdated
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
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