Skip to content

feat(deploy-artifacts): upload SHA alias .info for Go modules#218

Draft
byted wants to merge 1 commit into
mainfrom
INFRA-go-sha-alias
Draft

feat(deploy-artifacts): upload SHA alias .info for Go modules#218
byted wants to merge 1 commit into
mainfrom
INFRA-go-sha-alias

Conversation

@byted

@byted byted commented Apr 25, 2026

Copy link
Copy Markdown
Contributor

Why

go get <module>@<full-sha> against a JFrog-only GOPROXY currently fails: the proxy has no live VCS access, so a SHA-named .info query has nothing to resolve against. Today we only upload the canonical pseudo-version .info, so consumers must already know the pseudo-version — defeating the point of pasting a SHA.

This change makes the deploy stage upload an additional <module>/@v/<sha>.info whenever the workflow VERSION input is a full 40-char Git SHA. The alias reuses the canonical tmpfile, so its content is byte-identical to the pseudo-version .info. Once Go reads the alias, it switches to the canonical pseudo-version filenames for .mod / .zip and the rest of the flow is unchanged.

Only the 40-char form is aliased. Matching proxy.golang.org's "any abbreviated SHA" behavior would require pre-uploading every prefix length (7..40) per commit, which is wasteful — and 40 is the form CI typically passes (github.sha, etc.). Abbreviated SHAs and pseudo-versions are intentionally rejected by is_git_sha.

When the workflow VERSION input is a full 40-char Git SHA, upload an
additional `<module>/@v/<sha>.info` alongside the canonical .info,
reusing the same tmpfile so the alias content is byte-identical to
the canonical pseudo-version metadata.

This lets `go get <module>@<full-sha>` resolve through a JFrog-only
GOPROXY without live VCS access. Abbreviated SHAs (e.g. 7- or 12-char)
are intentionally not aliased -- pre-uploading every prefix length is
wasteful, and 40-char is the form CI typically passes.
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.

1 participant