| diff --git a/functions/concrete/builder/builder.go b/functions/concrete/builder/builder.go | |
| index b480902a..9a844b10 100644 | |
| --- a/functions/concrete/builder/builder.go | |
| +++ b/functions/concrete/builder/builder.go | |
| func (b *builder) buildCacheExtract() ([]stages.CacheExtract, error) { | |
| continue | |
| } | |
| - switch cache.Policy { | |
| + // Expand $VAR before classifying — without this, cache.policy: $MY_POLICY | |
| + // would fall into the default arm and the cache stage would be skipped. | |
| + policy := spec.CachePolicy(b.variables.ExpandValue(string(cache.Policy))) | |
| + switch policy { | |
| case spec.CachePolicyUndefined, spec.CachePolicyPullPush, spec.CachePolicyPull: | |
| default: | |
| continue | |
| func (b *builder) buildCacheArchive() ([]stages.CacheArchive, error) { | |
| continue | |
| } | |
| - switch cache.Policy { | |
| + policy := spec.CachePolicy(b.variables.ExpandValue(string(cache.Policy))) | |
| + switch policy { | |
| case spec.CachePolicyUndefined, spec.CachePolicyPullPush, spec.CachePolicyPush: | |
| default: | |
| continue | |