sg: fix live command after ci build version update (#48116)

This commit is contained in:
leo 2023-02-23 14:50:47 +00:00 committed by GitHub
parent 544f0f1986
commit 707950e3d5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -72,13 +72,22 @@ func printDeployedVersion(e environment, commits int) error {
))
return nil
}
// format: id_date_releasetag-sha
elems := strings.Split(bodyStr, "_")
if len(elems) != 3 {
return errors.Errorf("unknown format of /__version response: %q", body)
}
buildDate := elems[1]
buildSha := elems[2]
// attempt to split the release tag from the commit Sha if there
var buildSha string
versionTag := strings.Split(elems[2], "-")
if len(versionTag) != 2 {
buildSha = elems[2]
} else {
buildSha = versionTag[1]
}
pending = std.Out.Pending(output.Line("", output.StylePending, "Running 'git fetch' to update list of commits..."))
_, err = run.GitCmd("fetch", "-q")