Skip to content
This repository was archived by the owner on Mar 21, 2026. It is now read-only.

fix: add v prefix to version in container build download URL#323

Merged
zhubert merged 2 commits intomainfrom
fix/container-build-version-prefix
Mar 11, 2026
Merged

fix: add v prefix to version in container build download URL#323
zhubert merged 2 commits intomainfrom
fix/container-build-version-prefix

Conversation

@zhubert
Copy link
Copy Markdown
Owner

@zhubert zhubert commented Mar 11, 2026

Summary

  • GoReleaser sets main.version without the v prefix (e.g. 1.2.0), but GitHub release tags include it (v1.2.0)
  • Container image builds failed at Step 9 with tar: invalid magic because curl -sf downloaded a 404 page instead of the tarball
  • pluralDownloadBlock() now ensures the version has a v prefix before constructing the download URL

Test plan

  • TestPluralDownloadBlock/version_without_v_prefix_gets_v_added — new test case
  • All existing container package tests pass
  • Verify container session creation works with a release build

🤖 Generated with Claude Code

GoReleaser sets main.version without the "v" prefix (e.g. "1.2.0"),
but GitHub release tags include it (e.g. "v1.2.0"). This caused
container image builds to fail with "tar: invalid magic" because
curl was silently downloading a 404 page instead of the tarball.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 11, 2026 15:57
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes container image builds for release versions by ensuring the GitHub release tag used in the download URL includes the expected v prefix (aligning GoReleaser main.version values like 1.2.0 with GitHub tags like v1.2.0).

Changes:

  • Normalize release download tags in pluralDownloadBlock() by adding a v prefix when missing.
  • Add a unit test covering version strings without the v prefix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/container/build.go Prefixes release version with v before constructing the GitHub release download URL.
internal/container/build_test.go Adds a test case verifying that 1.2.0 becomes /download/v1.2.0/ in the generated block.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +239 to +243
tag := version
if !strings.HasPrefix(tag, "v") {
tag = "v" + tag
}
fmt.Fprintf(&b, "RUN curl -sfL \"https://github.com/zhubert/plural/releases/download/%s/plural_Linux_%s.tar.gz\" | tar -xz -C /tmp plural && \\\n", tag, arch)
Copy link

Copilot AI Mar 11, 2026

Choose a reason for hiding this comment

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

The curl ... | tar ... pipeline can produce misleading errors and may not clearly surface HTTP failures (e.g., 404s) because the pipeline status is driven by tar. Consider downloading to a file first (or otherwise ensuring the curl exit status is checked explicitly) so build failures point to the real download error.

Copilot uses AI. Check for mistakes.
Download to a temp file first so curl failures (e.g. 404) surface
clearly instead of producing misleading tar errors like "invalid magic".

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@zhubert zhubert merged commit e8d4721 into main Mar 11, 2026
1 check passed
@zhubert zhubert deleted the fix/container-build-version-prefix branch March 11, 2026 16:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants