Merge pull request #14711 from puffnfresh/bug/docker-nondeterminism
dockerTools: make tars deterministic
This commit is contained in:
commit
230bf0eab4
@ -151,7 +151,7 @@ EOF
|
|||||||
|
|
||||||
postMount = ''
|
postMount = ''
|
||||||
echo Packing raw image
|
echo Packing raw image
|
||||||
tar -C mnt -cf $out .
|
tar -C mnt --mtime=0 -cf $out .
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ EOF
|
|||||||
|
|
||||||
echo Packing layer
|
echo Packing layer
|
||||||
mkdir $out
|
mkdir $out
|
||||||
tar -C layer -cf $out/layer.tar .
|
tar -C layer --mtime=0 -cf $out/layer.tar .
|
||||||
ts=$(${tarsum} < $out/layer.tar)
|
ts=$(${tarsum} < $out/layer.tar)
|
||||||
cat ${baseJson} | jshon -s "$ts" -i checksum > $out/json
|
cat ${baseJson} | jshon -s "$ts" -i checksum > $out/json
|
||||||
echo -n "1.0" > $out/VERSION
|
echo -n "1.0" > $out/VERSION
|
||||||
@ -216,7 +216,7 @@ EOF
|
|||||||
|
|
||||||
echo Packing layer
|
echo Packing layer
|
||||||
mkdir $out
|
mkdir $out
|
||||||
tar -C layer -cf $out/layer.tar .
|
tar -C layer --mtime=0 -cf $out/layer.tar .
|
||||||
ts=$(${tarsum} < $out/layer.tar)
|
ts=$(${tarsum} < $out/layer.tar)
|
||||||
cat ${baseJson} | jshon -s "$ts" -i checksum > $out/json
|
cat ${baseJson} | jshon -s "$ts" -i checksum > $out/json
|
||||||
echo -n "1.0" > $out/VERSION
|
echo -n "1.0" > $out/VERSION
|
||||||
@ -297,7 +297,7 @@ EOF
|
|||||||
tar -tf temp/layer.tar >> baseFiles
|
tar -tf temp/layer.tar >> baseFiles
|
||||||
sed 's/^\.//' -i baseFiles
|
sed 's/^\.//' -i baseFiles
|
||||||
comm <(sort -n baseFiles|uniq) <(sort -n layerFiles|uniq|grep -v ${layer}) -1 -3 > newFiles
|
comm <(sort -n baseFiles|uniq) <(sort -n layerFiles|uniq|grep -v ${layer}) -1 -3 > newFiles
|
||||||
tar -rpf temp/layer.tar --no-recursion --files-from newFiles 2>/dev/null || true
|
tar -rpf temp/layer.tar --mtime=0 --no-recursion --files-from newFiles 2>/dev/null || true
|
||||||
|
|
||||||
echo Adding meta
|
echo Adding meta
|
||||||
|
|
||||||
@ -320,7 +320,7 @@ EOF
|
|||||||
chmod -R a-w image
|
chmod -R a-w image
|
||||||
|
|
||||||
echo Cooking the image
|
echo Cooking the image
|
||||||
tar -C image -c . | pigz > $out
|
tar -C image --mtime=0 -c . | pigz -nT > $out
|
||||||
'';
|
'';
|
||||||
|
|
||||||
in
|
in
|
||||||
|
Loading…
Reference in New Issue
Block a user