-
Notifications
You must be signed in to change notification settings - Fork 0
🐛 fix(ci): resolve GoReleaser docker build failure and migrate deprecated configs #2
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
Conversation
- add Dockerfile.goreleaser that copies pre-built binary directly - update .goreleaser.yml to use dedicated Dockerfile for releases - original Dockerfile preserved for local development builds Fixes docker build failure caused by missing go.sum in build context
- create Dockerfile.goreleaser using TARGETPLATFORM for multi-arch support - use Azure CLI base image with non-root user setup - resolve docker build context missing go.sum error Signed-off-by: l2D <20911264+l2D@users.noreply.github.com>
- rename snapshot.name_template to version_template - change archives.format to formats list - change archives.format_overrides.format to formats list - migrate dockers + docker_manifests to dockers_v2 Signed-off-by: l2D <20911264+l2D@users.noreply.github.com>
- adds goreleaser to the mise config to ensure consistent tool versions across environments
- trigger on PRs touching release-related files - add workflow_dispatch with dry_run input - use --snapshot --skip=publish for non-tag builds Signed-off-by: l2D <20911264+l2D@users.noreply.github.com>
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
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: 1
🤖 Fix all issues with AI agents
In @.github/workflows/release.yml:
- Around line 58-76: The workflow currently skips both GoReleaser steps when
manually dispatched with dry_run: false; update the "Run GoReleaser (Release)"
step's if to also allow manual dispatch by adding a branch like
(github.event_name == 'workflow_dispatch' && inputs.dry_run == 'false') so
actual releases run on manual dispatch, and keep the "Run GoReleaser (Dry Run)"
step conditional on (github.event_name == 'pull_request' || (github.event_name
== 'workflow_dispatch' && inputs.dry_run == 'true')); reference the step names
"Run GoReleaser (Release)" and "Run GoReleaser (Dry Run)" and the input
inputs.dry_run when making these conditional changes.
🧹 Nitpick comments (1)
Dockerfile.goreleaser (1)
4-7: Consider removing static labels that are dynamically set by GoReleaser.The Dockerfile defines static OCI labels (
title,source) that are also dynamically set in.goreleaser.ymlwith template values. The dynamic labels from GoReleaser will take precedence, making these static definitions redundant.You could either:
- Remove the overlapping static labels here and rely on GoReleaser's dynamic labels
- Keep only labels not set by GoReleaser (e.g.,
description,licenses)Keep only non-overlapping static labels
# Dockerfile for GoReleaser - uses pre-built binary FROM mcr.microsoft.com/azure-cli:2.82.0 -LABEL org.opencontainers.image.title="azswitch" LABEL org.opencontainers.image.description="TUI for switching Azure tenants and subscriptions" -LABEL org.opencontainers.image.source="https://github.com/l2D/azswitch" LABEL org.opencontainers.image.licenses="MIT"
| - name: Run GoReleaser (Release) | ||
| if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: '~> v2' | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Run GoReleaser (Dry Run) | ||
| if: github.event_name == 'pull_request' || (github.event_name == 'workflow_dispatch' && inputs.dry_run) | ||
| uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| distribution: goreleaser | ||
| version: '~> v2' | ||
| args: release --snapshot --skip=publish --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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.
Workflow gap when dry_run is false on manual dispatch.
When workflow_dispatch is triggered with dry_run: false, neither step will execute:
- "Release" requires
github.event_name == 'push'with a tag ref (line 59) - "Dry Run" requires
inputs.dry_runto be true forworkflow_dispatch(line 69)
If the intent is to allow manual releases without tags, consider adjusting the conditions. If manual dispatch should only support dry-run mode, consider removing the dry_run input entirely or documenting this limitation.
Option: Make dry_run always true for workflow_dispatch
If manual dispatch should always be dry-run only:
workflow_dispatch:
inputs:
dry_run:
description: 'Run in dry-run mode (no publish)'
required: false
default: true
type: boolean
Consider removing the input if manual releases aren't intended, or document that actual releases require pushing a tag.
🤖 Prompt for AI Agents
In @.github/workflows/release.yml around lines 58 - 76, The workflow currently
skips both GoReleaser steps when manually dispatched with dry_run: false; update
the "Run GoReleaser (Release)" step's if to also allow manual dispatch by adding
a branch like (github.event_name == 'workflow_dispatch' && inputs.dry_run ==
'false') so actual releases run on manual dispatch, and keep the "Run GoReleaser
(Dry Run)" step conditional on (github.event_name == 'pull_request' ||
(github.event_name == 'workflow_dispatch' && inputs.dry_run == 'true'));
reference the step names "Run GoReleaser (Release)" and "Run GoReleaser (Dry
Run)" and the input inputs.dry_run when making these conditional changes.
Problem
The release workflow failed when pushing tag
v0.1.0due to GoReleaser docker build context missinggo.sumfile. Additionally, several deprecation warnings were present in the configuration.Error:
docker build failed: "/go.sum": not foundChanges
Docker Build Fix
Dockerfile.goreleaserthat copies pre-built binary usingTARGETPLATFORMfor multi-arch supportDockerfilepreserved for local development buildsGoReleaser Deprecation Fixes
snapshot.name_template->version_templatearchives.format->formats: [...]archives.format_overrides.format->formats: [...]dockers+docker_manifests->dockers_v2CI Improvements
workflow_dispatchwith dry-run option for manual testing--snapshot --skip=publishfor non-tag buildsTesting
goreleaser checkpasses with no warningsSummary by CodeRabbit
Release Notes
New Features
Improvements
✏️ Tip: You can customize this high-level summary in your review settings.