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

add action to build and push images #124

Conversation

rccrdpccl
Copy link
Contributor

@rccrdpccl rccrdpccl commented Apr 3, 2025

Add an action to just push image on push on tag matching or selected branches.
For now we only push on master, once we'll introduce branches we can apply some rules to sanitize its naming.

Summary by CodeRabbit

  • New Features

    • Introduced an automated workflow for container image releases that dynamically assigns version tags for stable and development updates.
  • Chores

    • Streamlined the overall release process by removing redundant image publishing steps, ensuring a more efficient and focused release operation.

Copy link

coderabbitai bot commented Apr 3, 2025

Walkthrough

This pull request introduces a new GitHub Actions workflow (publish_images.yaml) to automate container image releases. The workflow triggers on pushes to semantic version tags and the master branch. It checks out the repository, determines the image tag, logs into Quay.io, and builds and pushes both bootstrap and control plane images. Additionally, the existing release.yaml workflow has been simplified by removing steps related to logging into Quay.io and building/pushing Docker images.

Changes

File(s) Change Summary
.github/workflows/publish_images.yaml Added a new workflow that automates container image releases. It checks out code, determines image tags, logs into Quay.io, builds, and pushes both bootstrap and control plane images.
.github/workflows/release.yaml Removed steps for logging into Quay.io and building/pushing Docker images, streamlining the release process while retaining the checkout, version tagging, and GitHub release creation steps.

Sequence Diagram(s)

sequenceDiagram
    participant Repo as "Repository"
    participant GH as "GitHub Actions"
    participant Quay as "Quay.io"
    
    Repo->>GH: Push event (tag or master branch)
    GH->>GH: Checkout code
    GH->>GH: Determine image tag
    GH->>Quay: Login using stored credentials
    GH->>Quay: Build & push bootstrap image
    GH->>Quay: Build & push control plane image
Loading

Possibly related PRs

  • add security scan #114: The changes in the main PR, which introduce a new workflow for publishing images, are related to the retrieved PR that modifies the existing release workflow by removing steps for building and publishing images, as both PRs involve Docker image handling in GitHub Actions workflows.

Suggested reviewers

  • adriengentil
  • openshift-edge-bot

Poem

I'm a bouncy rabbit, leaping with delight,
New workflows hop in, making our code shine bright.
Tags and builds now dance in a seamless flow,
Image pushes and releases, all in one go.
Hoppy coding adventures—guess who's smiling tonight!
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 58ba967 and d24428b.

📒 Files selected for processing (2)
  • .github/workflows/publish_images.yaml (1 hunks)
  • .github/workflows/release.yaml (0 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/release.yaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/publish_images.yaml

🪧 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.

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.

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 3, 2025
@rccrdpccl rccrdpccl requested review from carbonin and CrystalChun and removed request for eranco74 and openshift-edge-bot April 3, 2025 13:57
@openshift-ci openshift-ci bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Apr 3, 2025
Copy link

@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: 2

🧹 Nitpick comments (2)
.github/workflows/publish_images.yaml (2)

3-10: Review Trigger Configuration.
The workflow is set to trigger on pushes to semantic version tags and the master branch. This aligns with the PR objectives. In future, if additional branches are added, ensure that branch names are sanitized as planned.


48-54: Typo in Control Plane Step Name.
There is a minor typo in the step name. Changing "controplane" to "controlplane" will maintain consistency with the environment variable controlplane_image_name.

-      - name: Build and publish controplane image to Quay
+      - name: Build and publish controlplane image to Quay
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7985f56 and 58ba967.

📒 Files selected for processing (2)
  • .github/workflows/publish_images.yaml (1 hunks)
  • .github/workflows/release.yaml (0 hunks)
💤 Files with no reviewable changes (1)
  • .github/workflows/release.yaml
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Security scan
🔇 Additional comments (3)
.github/workflows/publish_images.yaml (3)

1-2: Workflow Naming is Clear.
The workflow name "Release" correctly reflects its purpose of releasing container images.


35-40: Approval of Quay.io Login Step.
The login step using docker/login-action@v3 and the use of GitHub secrets is correctly implemented.


41-47: Approval of Bootstrap Image Build and Push.
The step for building and pushing the bootstrap image is configured properly with the correct context, tag, and build arguments.

Comment on lines 25 to 28
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
elif [[ $GITHUB_REF == refs/headsmaster* ]]; then
TAG=latest
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue

Fix Master Branch Reference Pattern.
The shell condition in line 27 uses refs/headsmaster*, which is incorrect. It should be updated to refs/heads/master* to properly match the master branch.

-          elif [[ $GITHUB_REF == refs/headsmaster* ]]; then
-            TAG=latest
+          elif [[ $GITHUB_REF == refs/heads/master* ]]; then
+            TAG=latest
📝 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
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
elif [[ $GITHUB_REF == refs/headsmaster* ]]; then
TAG=latest
if [[ $GITHUB_REF == refs/tags/* ]]; then
TAG="${GITHUB_REF#refs/tags/}"
elif [[ $GITHUB_REF == refs/heads/master* ]]; then
TAG=latest

Signed-off-by: Riccardo Piccoli <rpiccoli@redhat.com>
@rccrdpccl rccrdpccl force-pushed the add-build-and-push-images-github-action branch from 58ba967 to d24428b Compare April 3, 2025 16:29
@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Apr 4, 2025
Copy link

openshift-ci bot commented Apr 4, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: carbonin, rccrdpccl

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-bot openshift-merge-bot bot merged commit 32f1040 into openshift-assisted:master Apr 4, 2025
8 checks passed
@rccrdpccl rccrdpccl deleted the add-build-and-push-images-github-action branch April 9, 2025 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants