Skip to content

ci: build and push docker image with branch tag - #169

Open
mbvreddy wants to merge 1 commit into
kruize:mvp_demofrom
mbvreddy:379-daily-build
Open

mbvreddy wants to merge 1 commit into
kruize:mvp_demofrom
mbvreddy:379-daily-build

Conversation

@mbvreddy

@mbvreddy mbvreddy commented Nov 10, 2026 •

Copy link
Copy Markdown

This change is to build and push operator dev image from mvp_demo and other feature branches to quay.io/kruizehub

Summary by Sourcery

CI:

  • Add a GitHub Actions workflow to build and publish multi-platform operator images to Quay.io for every branch push, using branch-based tags and build caching.

Signed-off-by: Bhaktavatsal Reddy <bhamaram@in.ibm.com>
@sourcery-ai

sourcery-ai Bot commented Nov 10, 2026 •

Copy link
Copy Markdown

Reviewer's Guide

Configuration

Add a GitHub Actions workflow that builds multi-architecture Docker images and pushes them to Quay.io with a tag derived from the branch name.

  • .github/workflows/docker-build-push.yaml L1-57

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 5 issues

Prompt for AI Agents
Please address the comments from this code review:

## Individual Comments

### Comment 1
<location path=".github/workflows/docker-build-push.yaml" line_range="6" />
<code_context>
+on:
+  push:
+    branches:
+      - '**'
+
+concurrency:
</code_context>
<issue_to_address>
**Branch contributors can steal Quay credentials**

When a user with permission to push to the repository pushes a branch containing a modified workflow, gitHub runs the pushed branch’s workflow with repository secrets available, and the Quay password is passed to the login step; a contributor who can push a branch can modify the workflow to transmit that credential and use it to publish images.

Keep Quay credentials out of workflows running branch-controlled code, or restrict credentialed publishing to protected, trusted refs and require approval before running it.

Also at `.github/workflows/docker-build-push.yaml:36`.
</issue_to_address>

### Comment 2
<location path=".github/workflows/docker-build-push.yaml" line_range="44" />
<code_context>
+        with:
+          images: quay.io/kruizehub/kruize-operator
+          tags: |
+            type=ref,event=branch
+
+      - name: Build and push Docker image
</code_context>
<issue_to_address>
**Branch images overwrite each other**

When two distinct branch names normalize to the same Docker tag and both workflows push, `docker/metadata-action` maps refs such as `feature/foo` and `feature-foo` to the same tag, and their workflows can both push it; the later push replaces the image consumers expect for the other branch.

Generate branch tags that remain unique after normalization.
</issue_to_address>

### Comment 3
<location path=".github/workflows/docker-build-push.yaml" line_range="51" />
<code_context>
+        with:
+          context: .
+          file: Dockerfile
+          platforms: linux/amd64,linux/arm64
+          push: true
+          provenance: false
</code_context>
<issue_to_address>
**Some clusters cannot start the operator**

When a branch image is deployed to an s390x or ppc64le cluster, the `platforms` setting publishes only amd64 and arm64 images, so the manifest has no matching variant and the operator cannot start on those nodes.

Build and publish image variants for s390x and ppc64le as well.

Also at `.github/workflows/docker-build-push.yaml:52`.
</issue_to_address>

### Comment 4
<location path=".github/workflows/docker-build-push.yaml" line_range="4-6" />
<code_context>
+name: Build and Push Docker Image
+
+on:
+  push:
+    branches:
+      - '**'
+
+concurrency:
</code_context>
<issue_to_address>
**Existing branches skip image builds**

When a feature branch has not yet incorporated this workflow file, gitHub only runs a push workflow when the workflow file is present on the pushed branch, so feature branches that have not incorporated this file produce no branch-tagged image.

Ensure the workflow is present on each branch that should publish images, or trigger a workflow on a branch where it is present to build the other branches.
</issue_to_address>

### Comment 5
<location path=".github/workflows/docker-build-push.yaml" line_range="9" />
<code_context>
+      - '**'
+
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
</code_context>
<issue_to_address>
**Case-distinct branch builds cancel each other**

When two case-distinct branch refs have builds in progress at the same time, gitHub treats concurrency group names as case-insensitive, so the two branches share a group and `cancel-in-progress: true` cancels one branch’s build when the other starts. The canceled branch can be left without its image tag.

Use a case-sensitive encoding or hash of the full ref in the concurrency group so distinct refs do not share a group.
</issue_to_address>

Sourcery assessment

Needs a human reviewer. 5 findings to address first, and a faulty build could publish an incorrect image under a branch tag in Quay, and reverting the workflow would not remove that tag or images already pulled. The tag can be corrected by publishing a good build, and this workflow does not deploy the image automatically.

Blocking findings: .github/workflows/docker-build-push.yaml:6, .github/workflows/docker-build-push.yaml:44, .github/workflows/docker-build-push.yaml:51, .github/workflows/docker-build-push.yaml:6, .github/workflows/docker-build-push.yaml:9


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@shreyabiradar07

Copy link
Copy Markdown
Contributor

@mbvreddy Please update the base branch of this PR to mvp_demo

@mbvreddy
mbvreddy changed the base branch from main to mvp_demo November 11, 2026 07:56

@shreyabiradar07 shreyabiradar07 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.

LGTM

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.

2 participants