Browse code

[19.03] vendor: moby/buildkit v0.6.4-20-g4cb720ef

full diff: https://github.com/moby/buildkit/compare/dc6afa0f755f6cbb7e85f0df4ff4b87ec280cb32...4cb720ef6483b43020c9037726de47353ac8ad9b

- contenthash: ignore system and security xattrs in calculation
- fixes moby/buildkit#1330 COPY cache not re-used depending on SELinux environment
- fixes https://github.com/moby/moby/issues/39003#issuecomment-574615437
- contenthash: allow security.capability in cache checksum
- inline cache: fix handling of duplicate blobs
- fixes moby/buildkit#1388 cache-from working unreliably

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2020/07/17 04:53:51
Showing 3 changed files
... ...
@@ -26,7 +26,7 @@ github.com/imdario/mergo                            7c29201646fa3de8506f70121347
26 26
 golang.org/x/sync                                   e225da77a7e68af35c70ccbf71af2b83e6acac3c
27 27
 
28 28
 # buildkit
29
-github.com/moby/buildkit                            dc6afa0f755f6cbb7e85f0df4ff4b87ec280cb32 # v0.6.4-15-gdc6afa0f
29
+github.com/moby/buildkit                            4cb720ef6483b43020c9037726de47353ac8ad9b # v0.6.4-20-g4cb720ef
30 30
 github.com/tonistiigi/fsutil                        6c909ab392c173a4264ae1bfcbc0450b9aac0c7d
31 31
 github.com/grpc-ecosystem/grpc-opentracing          8e809c8a86450a29b90dcc9efbf062d0fe6d9746
32 32
 github.com/opentracing/opentracing-go               1361b9cd60be79c4c3a7fa9841b3c132e40066a7
... ...
@@ -5,6 +5,7 @@ import (
5 5
 	"io"
6 6
 	"sort"
7 7
 	"strconv"
8
+	"strings"
8 9
 )
9 10
 
10 11
 // WriteV1TarsumHeaders writes a tar header to a writer in V1 tarsum format.
... ...
@@ -38,7 +39,9 @@ func v1TarHeaderSelect(h *tar.Header) (orderedHeaders [][2]string) {
38 38
 	// Get extended attributes.
39 39
 	xAttrKeys := make([]string, len(h.Xattrs))
40 40
 	for k := range h.Xattrs {
41
-		xAttrKeys = append(xAttrKeys, k)
41
+		if k == "security.capability" || !strings.HasPrefix(k, "security.") && !strings.HasPrefix(k, "system.") {
42
+			xAttrKeys = append(xAttrKeys, k)
43
+		}
42 44
 	}
43 45
 	sort.Strings(xAttrKeys)
44 46
 
... ...
@@ -72,7 +72,7 @@ func (ce *exporter) ExportForLayers(layers []digest.Digest) ([]byte, error) {
72 72
 		return nil, nil
73 73
 	}
74 74
 
75
-	cache := map[digest.Digest]int{}
75
+	cache := map[int]int{}
76 76
 
77 77
 	// reorder layers based on the order in the image
78 78
 	for i, r := range cfg.Records {
... ...
@@ -93,14 +93,14 @@ func (ce *exporter) ExportForLayers(layers []digest.Digest) ([]byte, error) {
93 93
 	return dt, nil
94 94
 }
95 95
 
96
-func getSortedLayerIndex(idx int, layers []v1.CacheLayer, cache map[digest.Digest]int) int {
96
+func getSortedLayerIndex(idx int, layers []v1.CacheLayer, cache map[int]int) int {
97 97
 	if idx == -1 {
98 98
 		return -1
99 99
 	}
100 100
 	l := layers[idx]
101
-	if i, ok := cache[l.Blob]; ok {
101
+	if i, ok := cache[idx]; ok {
102 102
 		return i
103 103
 	}
104
-	cache[l.Blob] = getSortedLayerIndex(l.ParentIndex, layers, cache) + 1
105
-	return cache[l.Blob]
104
+	cache[idx] = getSortedLayerIndex(l.ParentIndex, layers, cache) + 1
105
+	return cache[idx]
106 106
 }