Repository navigation
Conversation
Signed-off-by: Bhaktavatsal Reddy <bhamaram@in.ibm.com>
Reviewer's GuideConfigurationAdd a GitHub Actions workflow that builds multi-architecture Docker images and pushes them to Quay.io with a tag derived from the branch name.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
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
|
@mbvreddy Please update the base branch of this PR to |
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: