File size: 1,048 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
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
@@ -169,7 +169,10 @@ 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
@@ -260,7 +263,8 @@ 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