| |
| |
| |
| |
| @@ -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: |
| |
| |
| |
| |
| @@ -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 != "" { |
|
|