mirror of
https://github.com/agent-substrate/substrate.git
synced 2026-11-12 10:35:06 +08:00
ate-setup: take the prebuilt version from the tag without its digest (#1400)
With --image-repo the image tag becomes the substrate version, which names the atelet DaemonSet and the node label. A tag written with its digest, v1@sha256:..., is a valid image reference but not a valid label value, so the install failed at the atelet step unless VERSION was also set. The version is now the tag alone; the digest still pins the image. Followup for #1391 - [ ] Tests pass - [ ] Appropriate changes to documentation are included in the PR
This commit is contained in:
@@ -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`.
|
||||
|
||||
@@ -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{},
|
||||
|
||||
Reference in New Issue
Block a user