Merge pull request #88856 from zowoq/prefetch-docker

dockerTools: fix skopeo commands
This commit is contained in:
adisbladis 2020-05-25 09:52:09 +02:00 committed by GitHub
commit d8b6e82126
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,7 +12,6 @@ finalImageTag=
hashType=$NIX_HASH_ALGO hashType=$NIX_HASH_ALGO
hashFormat=$hashFormat hashFormat=$hashFormat
format=nix format=nix
skopeoCmd="skopeo --insecure-policy --tmpdir=$TMPDIR"
usage(){ usage(){
echo >&2 "syntax: nix-prefetch-docker [options] [IMAGE_NAME [IMAGE_TAG|IMAGE_DIGEST]] echo >&2 "syntax: nix-prefetch-docker [options] [IMAGE_NAME [IMAGE_TAG|IMAGE_DIGEST]]
@ -39,7 +38,7 @@ get_image_digest(){
imageTag="latest" imageTag="latest"
fi fi
"$skopeoCmd" inspect "docker://$imageName:$imageTag" | jq '.Digest' -r skopeo --insecure-policy --tmpdir=$TMPDIR inspect "docker://$imageName:$imageTag" | jq '.Digest' -r
} }
get_name() { get_name() {
@ -128,9 +127,9 @@ trap "rm -rf \"$tmpPath\"" EXIT
tmpFile="$tmpPath/$(get_name $finalImageName $finalImageTag)" tmpFile="$tmpPath/$(get_name $finalImageName $finalImageTag)"
if test -z "$QUIET"; then if test -z "$QUIET"; then
"$skopeoCmd" --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag" skopeo --insecure-policy --tmpdir=$TMPDIR --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag"
else else
"$skopeoCmd" --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag" > /dev/null skopeo --insecure-policy --tmpdir=$TMPDIR --override-os ${os} --override-arch ${arch} copy "$sourceUrl" "docker-archive://$tmpFile:$finalImageName:$finalImageTag" > /dev/null
fi fi
# Compute the hash. # Compute the hash.