Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion cmd/ate-setup/internal/steps/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ func (e *Env) SubstrateVersion() (version, suffix string, err error) {
if e.Cfg.Images.IsPrebuilt() {
raw = os.Getenv("VERSION")
if raw == "" {
raw = e.Cfg.Images.Tag
// The tag may carry its digest (v1@sha256:...); the version
// is the tag alone.
raw, _, _ = strings.Cut(e.Cfg.Images.Tag, "@")
}
} else {
// ko.BuildVersion consults VERSION itself before `git describe`.
Expand Down
5 changes: 5 additions & 0 deletions cmd/ate-setup/internal/steps/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ func TestSubstrateVersionPrebuilt(t *testing.T) {
source: images.Source{Repo: "example.com/substrate", Tag: "v0.0.0-503-4b3423c0"},
want: "v0.0.0-503-4b3423c0",
wantSuffix: "v0-0-0-503-4b3423c0",
}, {
name: "a tag carrying its digest is the version without it",
source: images.Source{Repo: "example.com/substrate", Tag: "v0.0.0@sha256:0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"},
want: "v0.0.0",
wantSuffix: "v0-0-0",
}, {
name: "built from source falls back to git",
source: images.Source{},
Expand Down
Loading