Skip to content

Commit 6fd7ee4

Browse files
committed
internal/ci/goreleaser: adjust after evalv3 fix for #3908
CI at master does a couple of extra steps, such as validating that a dry-run of the release process works. However, the recent merge of https://cuelang.org/cl/1214564 broke our `cue cmd release` as ran by CI, with GITHUB_REF set by GitHub: $ GITHUB_REF=foo cue cmd release command.release.info.text: invalid string argument: invalid interpolation: unresolved disjunction "foo" | "refs/no_ref_kind/not_a_release" (type string): ./goreleaser_tool.cue:75:2 ./goreleaser_tool.cue:22:23 ./goreleaser_tool.cue:76:3 ./goreleaser_tool.cue:76:9 tool/cli:4:3 It turns out that the reason was our goreleaser_tool.cue was buggy: let _githubRef = env.GITHUB_REF | "refs/no_ref_kind/not_a_release" When the GITHUB_REF env var is set to e.g. "foo", this should result in the ambiguous value `"foo" | "refs/no_ref_kind/not_a_release"`, and hence an error, just like CUE at master with evalv3 reports. However, evalv2 happily resolves that to `"foo"`. We can fix our CUE by selecting env.GITHUB_REF as the default, ensuring that it has priority when it is set in the environment. Also add a regression test to ensure that the ambiguous scenario stays as an error on evalv3 and future evaluator versions. We also show that it succeeds on evalv2, which is broken behavior. While here, fix a goreleaser deprecation warning which begain in v2.6: https://goreleaser.com/deprecations/#archivesformat_overridesformat Signed-off-by: Daniel Martí <[email protected]> Change-Id: I8a96b697820a607209e914eb48ee4f0e56b3a586 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1214619 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Matthew Sackman <[email protected]>
1 parent db98b5f commit 6fd7ee4

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

cmd/cue/cmd/testdata/script/cmd_env.txtar

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@ env TESTNUM=10
22
env MYTEXT=World
33
exec cue cmd env
44
cmp stdout cmd_env.out
5+
6+
env CUE_EXPERIMENT=evalv3=0
7+
exec cue cmd issue3908
8+
stdout '^World$'
9+
10+
env CUE_EXPERIMENT=evalv3=1
11+
! exec cue cmd issue3908
12+
stderr 'issue3908.print.text: .*non-concrete value string'
13+
514
-- cmd_env.out --
615
Hello World!
716
-- task_tool.cue --
@@ -21,3 +30,12 @@ command: env: {
2130
text: "Hello \(env.MYTEXT)!"
2231
}
2332
}
33+
34+
// Should fail when the MYTEXT env var is set, but evalv2 did not fail.
35+
command: issue3908: {
36+
env: os.Environ
37+
_mytext: env.MYTEXT | "fallback"
38+
print: cli.Print & {
39+
text: _mytext
40+
}
41+
}

internal/ci/goreleaser/goreleaser.cue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ config: {
5353
"doc/ref/spec.md",
5454
]
5555
format_overrides: [{
56-
goos: "windows"
57-
format: "zip"
56+
goos: "windows"
57+
formats: ["zip"]
5858
}]
5959
}]
6060
release: {

internal/ci/goreleaser/goreleaser_tool.cue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ command: release: {
1818

1919
let _env = env
2020

21-
let _githubRef = env.GITHUB_REF | "refs/no_ref_kind/not_a_release" // filled when running in CI
21+
let _githubRef = *env.GITHUB_REF | "refs/no_ref_kind/not_a_release" // filled when running in CI
2222
let _githubRefName = path.Base(_githubRef)
2323

2424
tempDir: file.MkdirTemp & {

0 commit comments

Comments
 (0)