Skip to content

Conversation

kvaps
Copy link
Member

@kvaps kvaps commented Apr 3, 2025

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

Summary by CodeRabbit

  • New Features

    • Introduced automated workflows for pull request validation and release preparation to streamline continuous integration.
  • Refactor

    • Transitioned testing and installation processes to a container-based execution, enhancing overall efficiency and reliability.
  • Chores

    • Updated container images and tool versions.
    • Increased virtual machine resource allocations for testing.
    • Removed legacy build and deployment configurations to simplify operations.

@kvaps kvaps requested a review from lllamnyp as a code owner April 3, 2025 08:49
Copy link
Contributor

coderabbitai bot commented Apr 3, 2025

Caution

Review failed

The pull request is closed.

Walkthrough

This pull request transitions several components from a Kubernetes-based model to a Docker-centric workflow. The changes update multiple Makefiles and Dockerfiles, remove Helm chart and Kubernetes builder configurations, and adjust VM resource settings. Additionally, two new GitHub Actions workflows have been introduced—one for handling pull requests and another for preparing releases based on tag pushes. The modifications redefine target executions and dependency checks to align with the Docker approach.

Changes

File(s) Change Summary
packages/core/testing/Makefile Transitioned from Kubernetes to Docker: added SANDBOX_NAME and ROOT_DIR variables; updated test, test-applications, delete, exec targets; added apply target for Docker container setup.
Makefile Added new build-deps target with required tool checks; modified build target to depend on build-deps; commented out file existence and test-applications commands in test target.
packages/core/.../images/e2e-sandbox/Dockerfile Updated TALOSCTL_VERSION from 1.8.4 to 1.9.5 and included installation of additional packages (make, git).
packages/core/testing/values.yaml Updated the Docker image reference for the e2e service from a specific version tag to latest with a new SHA256 digest.
hack/e2e.sh Increased QEMU VM resource allocation: raised CPUs from 4 to 8 and memory from 8192 MB to 16384 MB.
packages/core/builder/* Removed builder-related files (Chart.yaml, Makefile, config.toml, templates/sandbox.yaml, values.yaml), eliminating Helm chart and Kubernetes builder configurations.
packages/core/installer/Makefile Modified image targets by removing run-builder dependencies and switching image generation commands from Kubernetes jobs to a Docker-based imager.
packages/core/testing/templates/sandbox.yaml Removed Kubernetes namespace and deployment definitions for the testing sandbox environment.
.github/workflows/pull-requests.yaml Introduced a new workflow triggered by pull request events (with the label ok-to-test) to automatically checkout the code, log in to the container registry, and perform build and test actions.
.github/workflows/tags.yaml Added a workflow triggered by pushes to tags matching v*.*.* that automates release preparation steps, including branch creation, draft pull request creation, asset uploads, and tag deletion.

Sequence Diagram(s)

sequenceDiagram
    participant PR as "Pull Request"
    participant GH as "GitHub Actions"
    participant CR as "Container Registry"
    participant Build as "Make Build"
    participant Test as "Make Test"

    PR->>GH: PR event (labeled "ok-to-test")
    GH->>GH: Checkout code
    GH->>CR: Login with secret credentials
    GH->>Build: Execute `make build`
    Build-->>GH: Return build results
    GH->>Test: Execute `make test`
    Test-->>GH: Return test results
Loading
sequenceDiagram
    participant Tag as "Tag Push"
    participant GH as "GitHub Actions"
    participant Repo as "Repository"
    participant Release as "Release System"

    Tag->>GH: Tag push (v*.*.*)
    GH->>GH: Check if release exists
    alt No release exists
        GH->>Repo: Checkout code
        GH->>Repo: Run `make build`
        GH->>Release: Create draft release & upload assets
        GH->>Repo: Delete pushed tag
    else Release exists
        GH->>GH: Skip release actions
    end
Loading

Possibly related PRs

Suggested reviewers

  • lllamnyp

Poem

Hey there, I'm a rabbit on the run,
Hopping through code as changes are spun,
Docker now leads where Kubernetes did stray,
CI workflows guide our build and play,
With carrots of code and hops so light—cheers to change day!


📜 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 67cf650 and eb0a03a.

📒 Files selected for processing (14)
  • .github/workflows/pull-requests.yaml (1 hunks)
  • .github/workflows/tags.yaml (1 hunks)
  • Makefile (2 hunks)
  • hack/e2e.sh (1 hunks)
  • packages/core/builder/Chart.yaml (0 hunks)
  • packages/core/builder/Makefile (0 hunks)
  • packages/core/builder/config.toml (0 hunks)
  • packages/core/builder/templates/sandbox.yaml (0 hunks)
  • packages/core/builder/values.yaml (0 hunks)
  • packages/core/installer/Makefile (3 hunks)
  • packages/core/testing/Makefile (3 hunks)
  • packages/core/testing/images/e2e-sandbox/Dockerfile (1 hunks)
  • packages/core/testing/templates/sandbox.yaml (0 hunks)
  • packages/core/testing/values.yaml (1 hunks)

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.
    • 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@kvaps kvaps requested a review from Copilot April 3, 2025 08:49
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds a new GitHub CI workflow to run end-to-end tests in a Docker container when pull requests are labeled appropriately.

  • Added a workflow file to trigger testing on pull request events.
  • Configured a job that checks out the code and runs tests using a Docker container.

@kvaps kvaps force-pushed the e2e-runner branch 2 times, most recently from 802ffb7 to 3329102 Compare April 3, 2025 08:59

on:
pull_request:
types: [labeled, opened, synchronize, reopened]
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you use both opened and synchronize, CI will trigger twice when you open a new PR. If you open it with a label, that's one extra trigger.

Suggested change
types: [labeled, opened, synchronize, reopened]
types: [synchronize, reopened]

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
Copy link
Collaborator

Choose a reason for hiding this comment

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

depth of 1 is the default, no need to specify it

name: Run Makefile in e2e container
runs-on: [self-hosted]

if: contains(github.event.pull_request.labels.*.name, 'ok-to-test')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh, I see. You want to run CI when PR has a label. Then you'll want to trigger it when it's labeled, too. It's a complicated thing in GitHub CI. :)

@kvaps kvaps force-pushed the e2e-runner branch 5 times, most recently from 448f49e to 6472b8e Compare April 3, 2025 09:50
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

🧹 Nitpick comments (1)
packages/core/testing/Makefile (1)

61-63: Review Docker-Based Sandbox Initialization

The wait-for-sandbox target now launches the sandbox container with Docker using a pinned image digest and mounts the repository workspace via "${PWD}/../../..:/workspace". Please verify that:

  • The volume mount correctly maps the desired workspace inside the container.
  • The use of the fixed image reference (with digest) is intentional and up-to-date.
  • Any commands later relying on the container’s environment (like the helm template in the test target) are properly supported.
    Consider extracting the mount path or image reference into variables for easier maintenance if these values are subject to change.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0171cc2 and 6472b8e.

📒 Files selected for processing (5)
  • .github/workflows/e2e-test.yml (1 hunks)
  • Makefile (1 hunks)
  • packages/core/testing/Makefile (2 hunks)
  • packages/core/testing/images/e2e-sandbox/Dockerfile (1 hunks)
  • packages/core/testing/values.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/core/testing/images/e2e-sandbox/Dockerfile
  • packages/core/testing/values.yaml
  • Makefile
  • .github/workflows/e2e-test.yml
🧰 Additional context used
🪛 GitHub Actions: E2E Test in Docker
packages/core/testing/Makefile

[error] 38-38: Command failed with exit code 127. The script 'hack/e2e.sh' was not found.


[error] 43-43: Make command failed with exit code 2.

🪛 GitHub Actions: Pre-Commit Checks
packages/core/testing/Makefile

[error] 17-17: make: *** [Makefile:17: gen-versions-map] Error 1.

@kvaps kvaps force-pushed the e2e-runner branch 6 times, most recently from 3d87f58 to a0377ad Compare April 3, 2025 10:27
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

🔭 Outside diff range comments (1)
packages/core/testing/Makefile (1)

1-66: 💡 Verification agent

❓ Verification inconclusive

Pipeline Failure – Check for Obsolete Target Reference
The pipeline failure log indicates an error:

[error] 17-17: make: *** [Makefile:17: gen-versions-map] Error 1

Even though the gen-versions-map target is not visible in the current modifications, please verify whether this target is defined or referenced via an included file (e.g., ../../../scripts/common-envs.mk) or if it has been removed intentionally. Ensuring CI targets are in sync with the Makefile will help avoid unexpected build failures.


Action: Resolve Missing gen-versions-map Target in CI Pipeline

It appears the CI pipeline is failing due to a missing gen-versions-map target. A search across the repository—both in the current Makefile and in the included file (../../../scripts/common-envs.mk)—did not reveal any definition for this target. Please verify whether this target’s removal was intentional. If it was removed, update the CI configuration to eliminate any reference to it; otherwise, reinstate or properly define the target in the Makefile (or its included files) so that CI and file targets are in sync.

  • Verify the status of the gen-versions-map target in ../../../scripts/common-envs.mk or elsewhere in the repo.
  • If intentional, remove the CI’s reference to this target.
  • If not, add the missing definition back.
🧰 Tools
🪛 GitHub Actions: Pre-Commit Checks

[error] 17-17: make: *** [Makefile:17: gen-versions-map] Error 1

🧹 Nitpick comments (1)
packages/core/testing/Makefile (1)

6-7: New Variable ROOT_DIR – Verify Calculation and Environment Portability
The new variable ROOT_DIR is computed as:

ROOT_DIR = $(dir $(abspath $(firstword $(MAKEFILE_LIST))/../../..))

Please verify that this correctly resolves to the repository root in all intended contexts (local development as well as in CI environments), and that the directory structure does not change unexpectedly.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6472b8e and a0377ad.

📒 Files selected for processing (5)
  • .github/workflows/e2e-test.yml (1 hunks)
  • Makefile (1 hunks)
  • packages/core/testing/Makefile (3 hunks)
  • packages/core/testing/images/e2e-sandbox/Dockerfile (1 hunks)
  • packages/core/testing/values.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • Makefile
  • packages/core/testing/images/e2e-sandbox/Dockerfile
  • .github/workflows/e2e-test.yml
  • packages/core/testing/values.yaml
🧰 Additional context used
🪛 GitHub Actions: Pre-Commit Checks
packages/core/testing/Makefile

[error] 17-17: make: *** [Makefile:17: gen-versions-map] Error 1

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Run Makefile in e2e container
🔇 Additional comments (2)
packages/core/testing/Makefile (2)

64-65: Sandbox Container Setup – Validate Repository Copy Operation
In the wait-for-sandbox target, the container is launched using:

docker run -d --rm --name cozy-e2e-sandbox --privileged ghcr.io/cozystack/cozystack/e2e-sandbox:latest@sha256:f41b1e0f76e7820ce87cd3dfa1b680490d0c898105690c79537943f26ab28040 sleep infinity
docker cp "${ROOT_DIR}" cozy-e2e-sandbox:/workspace

Please confirm that copying the repository root to /workspace inside the container results in the expected directory structure for test execution. This ensures that subsequent commands, such as those executed in the test target, run in the correct context.


39-40:

✅ Verification successful

E2E Test Target – Confirm Script Invocation Path
The test target now executes:

docker exec cozy-e2e-sandbox sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(helm template -n cozy-system installer ./packages/core/installer) && hack/e2e.sh'

Ensure that the hack/e2e.sh script exists at the expected location within /workspace inside the container. If the file path is different (e.g., ./hack/e2e.sh), consider updating the command to use the correct absolute or relative path. Verifying this will prevent runtime errors like exit code 127 in the CI pipeline.


🏁 Script executed:

#!/bin/bash
# Verify that the hack/e2e.sh file exists at the repository root,
# which would correspond to /workspace/hack/e2e.sh inside the container.
find . -type f -path "./hack/e2e.sh"

Length of output: 50


E2E Test Path is Correct – Verified
I confirmed that the hack/e2e.sh script exists in the repository root (which maps to /workspace/hack/e2e.sh inside the container), so the current command in the test target is correctly configured. No changes are needed.

@kvaps kvaps force-pushed the e2e-runner branch 7 times, most recently from 9d53a53 to 0960e03 Compare April 3, 2025 11:25
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

🧹 Nitpick comments (2)
hack/e2e.sh (1)

87-93: Increased VM Resources Allocation: Verify Host Capacity
The QEMU command now allocates 8 virtual CPUs and 16384 MB of memory (up from 4 vCPUs and 8192 MB). This change should help improve performance during tests, but please ensure that the host running these VMs has sufficient resources; otherwise, it may lead to resource exhaustion.

packages/core/testing/Makefile (1)

64-67: Sandbox “apply” Target – Hardcoded Image Digest & Repository Copy
The apply target starts the sandbox container with a hardcoded image digest:

ghcr.io/cozystack/cozystack/e2e-sandbox:latest@sha256:f41b1e0f76e7820ce87cd3dfa1b680490d0c898105690c79537943f26ab28040

Hardcoding the digest can limit flexibility; consider parameterizing this value if future updates are expected. Additionally, the repository is copied into the sandbox via docker cp "${ROOT_DIR}" "${SANDBOX_NAME}":/workspace—please verify that this step reliably syncs your source files for the e2e tests.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between a0377ad and 67cf650.

📒 Files selected for processing (13)
  • .github/workflows/e2e-test.yml (1 hunks)
  • Makefile (2 hunks)
  • hack/e2e.sh (1 hunks)
  • packages/core/builder/Chart.yaml (0 hunks)
  • packages/core/builder/Makefile (0 hunks)
  • packages/core/builder/config.toml (0 hunks)
  • packages/core/builder/templates/sandbox.yaml (0 hunks)
  • packages/core/builder/values.yaml (0 hunks)
  • packages/core/installer/Makefile (3 hunks)
  • packages/core/testing/Makefile (3 hunks)
  • packages/core/testing/images/e2e-sandbox/Dockerfile (1 hunks)
  • packages/core/testing/templates/sandbox.yaml (0 hunks)
  • packages/core/testing/values.yaml (1 hunks)
💤 Files with no reviewable changes (6)
  • packages/core/builder/config.toml
  • packages/core/builder/Makefile
  • packages/core/builder/values.yaml
  • packages/core/testing/templates/sandbox.yaml
  • packages/core/builder/Chart.yaml
  • packages/core/builder/templates/sandbox.yaml
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/core/testing/images/e2e-sandbox/Dockerfile
  • packages/core/testing/values.yaml
  • Makefile
🧰 Additional context used
🪛 GitHub Actions: Pre-Commit Checks
packages/core/testing/Makefile

[error] 17-17: make: *** [Makefile:17: gen-versions-map] Error 1.

packages/core/installer/Makefile

[error] 17-17: make: *** [Makefile:17: gen-versions-map] Error 1.

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Build and run e2e tests
🔇 Additional comments (9)
.github/workflows/e2e-test.yml (3)

3-6: Review Workflow Trigger Events
The workflow is set to trigger on labeled, opened, synchronize, reopened events. Note that previous feedback (see NickVolynkin’s comment) suggested that using both opened and synchronize can lead to duplicate runs when a PR is opened with a label. Please double-check that these trigger events match your intended CI behavior and consider consolidating triggers if needed.


15-16: Conditional Execution for Label Check
The condition using

if: contains(github.event.pull_request.labels.*.name, 'ok-to-test')

ensures that the e2e tests only run when the PR has the ok-to-test label. This is a good safeguard; just confirm that this matches your testing policy.


18-37: Job Steps and Build/Test Commands
The checkout, login, build (make build), and test (make test) steps are straightforward and clear. They properly chain the Docker-based build and test operations. Ensure that the underlying Make targets and Docker image configurations are kept in sync with these CI steps.

packages/core/installer/Makefile (4)

25-40: Streamlined Image Build for “image-cozystack”
The updated image-cozystack target now uses Docker Buildx to build and push the image, and then updates values.yaml with the new image digest using yq. This refactoring simplifies the process by removing former dependencies. Ensure that the version of yq in use is compatible with the syntax employed and that the image digest extraction meets your requirements.


41-44: Image-Talos Target Adjustments
The image-talos target now checks for the tarball and, if missing, calls the talos-installer target before copying the image via skopeo. This logic is concise; please verify that the absence of a dependency on run-builder does not affect expected outcomes.


45-60: Refined “image-matchbox” Target
The image-matchbox target builds the image with Docker Buildx and writes the generated tag to a file. This approach appears correct; however, as these targets are a critical part of the deployment pipeline, please confirm that the new Docker-based commands fully replace the previous Kubernetes job-based method.


20-22: Pipeline Failure – Missing Target Verification
The pre-commit checks report an error referencing:

make: *** [Makefile:17: gen-versions-map] Error 1.

Although the current diff does not show a gen-versions-map target, please verify that any references to this target have been removed or updated consistently across the build scripts (and that hack/gen-profiles.sh does not rely on it).

packages/core/testing/Makefile (2)

5-7: New Sandbox Variables Definition
The introduction of SANDBOX_NAME and ROOT_DIR improves clarity for sandbox container operations and repository path management within Docker. Confirm that these variables correctly reflect the intended directory structure and container naming conventions across environments.


40-42:

✅ Verification successful

Updated Test Target: Validate Script Path and Environment
The test target now runs:

docker exec "${SANDBOX_NAME}" sh -c 'cd /workspace && export COZYSTACK_INSTALLER_YAML=$$(helm template -n cozy-system installer ./packages/core/installer) && hack/e2e.sh'

Ensure that, once the repository is copied into /workspace, the hack/e2e.sh script is indeed located at /workspace/hack/e2e.sh. If the file path differs (for example, needing a ./hack/e2e.sh), adjust accordingly to prevent a “script not found” error (which has been an issue previously).


Below is a shell script to verify that the hack/e2e.sh file is located at the expected repository root (so that when the repository is copied into /workspace it will be available as /workspace/hack/e2e.sh). Please run this to confirm its location:


Critical: Validate the hack/e2e.sh Script Path
Please confirm that when the repository is copied into /workspace, the hack/e2e.sh script is available at /workspace/hack/e2e.sh. If the file actually resides in a different directory (for example, if it should be invoked as ./hack/e2e.sh), update the test target accordingly to prevent a “script not found” error.


🏁 Script executed:

#!/bin/bash
# Check if hack/e2e.sh exists at the repository root.
if [ -f hack/e2e.sh ]; then
  echo "Found hack/e2e.sh at repository root (it should be at /workspace/hack/e2e.sh after repo copy)."
else
  echo "hack/e2e.sh NOT found at repository root. Listing potential matches:"
  fd hack/e2e.sh
fi

Length of output: 345


Validated Test Target: File Path Confirmed
We verified that the hack/e2e.sh script is present at the repository root and will be available at /workspace/hack/e2e.sh once copied into the sandbox. The current test target command correctly references the script location.

@kvaps kvaps force-pushed the e2e-runner branch 5 times, most recently from edfa18c to ef509a9 Compare April 3, 2025 12:32
Signed-off-by: Andrei Kvapil <kvapss@gmail.com>
@kvaps kvaps merged commit 6980dc5 into main Apr 3, 2025
3 of 7 checks passed
@kvaps kvaps deleted the e2e-runner branch April 3, 2025 13:02
@kvaps kvaps mentioned this pull request Apr 3, 2025
This was referenced Jun 26, 2025
This was referenced Aug 11, 2025
This was referenced Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants