Skip to content

Conversation

@l2D
Copy link
Owner

@l2D l2D commented Jan 28, 2026

Problem

The release workflow failed when pushing tag v0.1.0 due to GoReleaser docker build context missing go.sum file. Additionally, several deprecation warnings were present in the configuration.

Error: docker build failed: "/go.sum": not found

Changes

Docker Build Fix

  • Add Dockerfile.goreleaser that copies pre-built binary using TARGETPLATFORM for multi-arch support
  • Original Dockerfile preserved for local development builds

GoReleaser Deprecation Fixes

  • snapshot.name_template -> version_template
  • archives.format -> formats: [...]
  • archives.format_overrides.format -> formats: [...]
  • dockers + docker_manifests -> dockers_v2

CI Improvements

  • Add dry-run mode on PRs touching release-related files
  • Add workflow_dispatch with dry-run option for manual testing
  • Use --snapshot --skip=publish for non-tag builds

Testing

  • goreleaser check passes with no warnings
  • PR triggers dry-run workflow

Summary by CodeRabbit

Release Notes

  • New Features

    • Multi-platform Docker image builds for amd64 and arm64 architectures.
    • Enhanced container image with Azure CLI integration.
  • Improvements

    • Strengthened container security with non-root user execution.
    • Added comprehensive metadata labels to container images for improved compatibility and traceability.

✏️ Tip: You can customize this high-level summary in your review settings.

l2D added 5 commits January 29, 2026 00:33
- 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>
@l2D l2D self-assigned this Jan 28, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 28, 2026

Important

Review skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

  • ✅ Full review completed - (🔄 Check again to review again)
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/goreleaser-dockerfile-build-context

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@l2D l2D merged commit d0421b5 into main Jan 28, 2026
10 checks passed
@l2D l2D deleted the fix/goreleaser-dockerfile-build-context branch January 28, 2026 17:46
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: 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.yml with template values. The dynamic labels from GoReleaser will take precedence, making these static definitions redundant.

You could either:

  1. Remove the overlapping static labels here and rely on GoReleaser's dynamic labels
  2. 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"

Comment on lines +58 to +76
- 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 }}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

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_run to be true for workflow_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.

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