-
Notifications
You must be signed in to change notification settings - Fork 15
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
Docker builds for tags #145
Conversation
Caution Review failedThe pull request is closed. WalkthroughThe pull request modifies the GitHub Actions workflow for building and pushing Docker images. It introduces a new trigger for versioned tags, updates several steps to use specific versions, and renames steps for clarity. A new step captures the Git tag from the workflow context, and the process for pushing Docker images is streamlined to include both versioned and latest tags. Changes
Possibly related PRs
Suggested reviewers
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅ 🚨 Try these New Features:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 3
🧹 Outside diff range and nitpick comments (2)
.github/workflows/main.yaml (2)
36-39
: Consider Docker build optimizationsSeveral improvements could enhance the Docker build process:
- Parameterize the repository name using GitHub environment variables
- Add multi-platform build support
- Implement build caching
Example implementation:
- name: Docker Build run: | TAG=${GIT_TAG:-latest} - docker build -t ghcr.io/bitbomdev/minefield:latest -t ghcr.io/bitbomdev/minefield:${TAG} . + REPO="ghcr.io/${{ github.repository_owner }}/minefield" + docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --cache-from type=gha \ + --cache-to type=gha,mode=max \ + -t ${REPO}:latest \ + -t ${REPO}:${TAG} \ + .🧰 Tools
🪛 actionlint
37-37: shellcheck reported issue in this script: SC2086:info:2:83: Double quote to prevent globbing and word splitting
(shellcheck)
Workflow conflicts detected - action required
The new
main.yaml
workflow needs adjustment as it overlaps with existing workflows:
build.yaml
already handles Docker builds for themain
branch but without publishinggrype.yaml
performs security scanning for Docker images on PRs- The new workflow adds tag-based releases and GHCR publishing
Recommendations:
- Move the Docker publishing logic from
main.yaml
intobuild.yaml
's Docker job for better consolidation- Keep the tag-based triggers and GHCR publishing steps
- Add dependency on the security scan job from
grype.yaml
before publishing🔗 Analysis chain
Line range hint
1-52
: Verify workflow uniqueness and integrationLet's ensure this workflow doesn't conflict with other existing Docker build workflows.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Search for other Docker-related workflows echo "Checking for other Docker workflows..." fd -e yml -e yaml . .github/workflows/ -x grep -l 'docker' {} \; # Search for other tag-triggered workflows echo "Checking for other tag-triggered workflows..." fd -e yml -e yaml . .github/workflows/ -x grep -l "tags:" {} \;Length of output: 465
Script:
#!/bin/bash # Let's examine the content of these workflows to understand potential conflicts echo "=== Content of grype.yaml ===" cat .github/workflows/grype.yaml echo -e "\n=== Content of build.yaml ===" cat .github/workflows/build.yamlLength of output: 3402
🧰 Tools
🪛 actionlint
20-20: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
28-28: the runner of "actions/setup-go@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
34-34: shellcheck reported issue in this script: SC2086:info:1:44: Double quote to prevent globbing and word splitting
(shellcheck)
37-37: shellcheck reported issue in this script: SC2086:info:2:83: Double quote to prevent globbing and word splitting
(shellcheck)
49-49: shellcheck reported issue in this script: SC2086:info:3:41: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 yamllint
[error] 8-8: trailing spaces
(trailing-spaces)
[error] 16-16: trailing spaces
(trailing-spaces)
[error] 22-22: trailing spaces
(trailing-spaces)
[error] 30-30: trailing spaces
(trailing-spaces)
[error] 52-52: no new line character at the end of file
(new-line-at-end-of-file)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/main.yaml
(1 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/main.yaml
20-20: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
28-28: the runner of "actions/setup-go@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
34-34: shellcheck reported issue in this script: SC2086:info:1:44: Double quote to prevent globbing and word splitting
(shellcheck)
37-37: shellcheck reported issue in this script: SC2086:info:2:83: Double quote to prevent globbing and word splitting
(shellcheck)
49-49: shellcheck reported issue in this script: SC2086:info:3:41: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 yamllint
.github/workflows/main.yaml
[error] 8-8: trailing spaces
(trailing-spaces)
[error] 16-16: trailing spaces
(trailing-spaces)
[error] 22-22: trailing spaces
(trailing-spaces)
[error] 30-30: trailing spaces
(trailing-spaces)
[error] 52-52: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (1)
.github/workflows/main.yaml (1)
7-8
: LGTM: Tag trigger configuration is correct
The addition of the tag trigger for versioned releases follows best practices.
🧰 Tools
🪛 yamllint
[error] 8-8: trailing spaces
(trailing-spaces)
There was a problem hiding this comment.
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
📒 Files selected for processing (1)
.github/workflows/main.yaml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.3)
.github/workflows/main.yaml
20-20: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
28-28: the runner of "actions/setup-go@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
37-37: shellcheck reported issue in this script: SC2086:info:2:83: Double quote to prevent globbing and word splitting
(shellcheck)
49-49: shellcheck reported issue in this script: SC2086:info:3:41: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 yamllint (1.29.0-1)
.github/workflows/main.yaml
[error] 8-8: trailing spaces
(trailing-spaces)
[error] 16-16: trailing spaces
(trailing-spaces)
[error] 22-22: trailing spaces
(trailing-spaces)
[error] 30-30: trailing spaces
(trailing-spaces)
[error] 52-52: no new line character at the end of file
(new-line-at-end-of-file)
🔇 Additional comments (2)
.github/workflows/main.yaml (2)
7-8
: LGTM: Tag trigger for versioned releases
The addition of the tag trigger is well-implemented and follows the standard pattern for versioned releases.
🧰 Tools
🪛 yamllint (1.29.0-1)
[error] 8-8: trailing spaces
(trailing-spaces)
32-34
: LGTM: Secure tag extraction implementation
The Git tag extraction is well-implemented with proper conditions and secure shell practices.
There was a problem hiding this 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 and nitpick comments (1)
.github/workflows/main.yaml (1)
24-25
: Consider implementing Docker layer cachingTo improve build times, consider implementing Docker layer caching. This can be achieved by:
- Using buildx cache from GitHub Actions cache
- Implementing multi-stage builds with proper layer ordering
Example implementation:
- uses: actions/cache@v3 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ github.sha }} restore-keys: | ${{ runner.os }}-buildx- - uses: docker/build-push-action@v5 with: context: . push: false cache-from: type=local,src=/tmp/.buildx-cache cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
.github/workflows/main.yaml
(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.3)
.github/workflows/main.yaml
20-20: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
28-28: the runner of "actions/setup-go@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
37-37: shellcheck reported issue in this script: SC2086:info:2:83: Double quote to prevent globbing and word splitting
(shellcheck)
🪛 yamllint (1.29.0-1)
.github/workflows/main.yaml
[error] 8-8: trailing spaces
(trailing-spaces)
[error] 16-16: trailing spaces
(trailing-spaces)
[error] 22-22: trailing spaces
(trailing-spaces)
[error] 30-30: trailing spaces
(trailing-spaces)
🔇 Additional comments (6)
.github/workflows/main.yaml (6)
7-8
: LGTM: Tag-based trigger is properly configured
The addition of the v*
tag trigger is a good practice for automated releases.
🧰 Tools
🪛 yamllint (1.29.0-1)
[error] 8-8: trailing spaces
(trailing-spaces)
16-16
: LGTM: Appropriate permissions set
The packages: write
permission is correctly configured for pushing to GHCR.
🧰 Tools
🪛 yamllint (1.29.0-1)
[error] 16-16: trailing spaces
(trailing-spaces)
20-30
: Existing comments address the version updates needed
Previous review comments already cover the necessary updates for action versions and Go version.
🧰 Tools
🪛 actionlint (1.7.3)
20-20: the runner of "actions/checkout@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
28-28: the runner of "actions/setup-go@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🪛 yamllint (1.29.0-1)
[error] 22-22: trailing spaces
(trailing-spaces)
[error] 30-30: trailing spaces
(trailing-spaces)
32-34
: LGTM: Git tag extraction is properly implemented
The tag extraction is correctly implemented with proper quoting and conditional checking.
36-39
: Existing comments address the Docker build improvements
Previous review comments already cover the necessary improvements for the Docker build step.
🧰 Tools
🪛 actionlint (1.7.3)
37-37: shellcheck reported issue in this script: SC2086:info:2:83: Double quote to prevent globbing and word splitting
(shellcheck)
42-57
: Existing comments address the Docker login and push improvements
Previous review comments already cover the necessary improvements for the Docker login and push steps.
Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
Signed-off-by: naveensrinivasan <172697+naveensrinivasan@users.noreply.github.com>
1bcd40a
to
bb22151
Compare
Summary by CodeRabbit
New Features
Improvements
Chores