File size: 1,426 Bytes
d61821a | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | diff --git a/functions/concrete/run/env/env.go b/functions/concrete/run/env/env.go
index f237ea7f..a39af81f 100644
--- a/functions/concrete/run/env/env.go
+++ b/functions/concrete/run/env/env.go
@@ -55,6 +55,20 @@ type Env struct {
bundledCACerts string
}
+// ExpandValue expands $VAR / ${VAR} against Env + GitLabEnv overlay.
+// Used for fields the helper subprocess does not expand itself.
+func (e *Env) ExpandValue(s string) string {
+ if s == "" {
+ return s
+ }
+ return os.Expand(s, func(key string) string {
+ if v, ok := e.GitLabEnv[key]; ok {
+ return v
+ }
+ return e.Env[key]
+ })
+}
+
func (e *Env) IsSuccessful() bool {
switch e.status {
case "", Running, Success:
diff --git a/functions/concrete/run/stages/artifact_upload.go b/functions/concrete/run/stages/artifact_upload.go
index 319ff845..515785b6 100644
--- a/functions/concrete/run/stages/artifact_upload.go
+++ b/functions/concrete/run/stages/artifact_upload.go
@@ -97,8 +97,10 @@ func (s ArtifactUpload) Run(ctx context.Context, e *env.Env) error {
args = append(args, "--name", s.ArtifactName)
}
- if s.ExpireIn != "" {
- args = append(args, "--expire-in", s.ExpireIn)
+ // artifacts-uploader doesn't expand $VAR in --expire-in (unlike --name
+ // and --path), so we have to do it here.
+ if expireIn := e.ExpandValue(s.ExpireIn); expireIn != "" {
+ args = append(args, "--expire-in", expireIn)
}
if s.Format != "" {
|