fix(server): Use uncompressed tarball hashes in image config
Docker expects hashes of compressed tarballs in the manifest (as these are used to fetch from the content-addressable layer store), but for some reason it expects hashes in the configuration layer to be of uncompressed tarballs. To achieve this an additional SHA256 hash is calculcated while creating the layer tarballs, but before passing them to the gzip writer. In the current constellation the symlink layer is first compressed and then decompressed again to calculate its hash. This can be refactored in a future change.
This commit is contained in:
parent
0693e371d6
commit
e22ff5d176
4 changed files with 42 additions and 16 deletions
|
|
@ -137,11 +137,14 @@ let
|
|||
symlinkLayerMeta = fromJSON (readFile (runCommand "symlink-layer-meta.json" {
|
||||
buildInputs = with pkgs; [ coreutils jq openssl ];
|
||||
}''
|
||||
layerSha256=$(sha256sum ${symlinkLayer} | cut -d ' ' -f1)
|
||||
gzipHash=$(sha256sum ${symlinkLayer} | cut -d ' ' -f1)
|
||||
tarHash=$(cat ${symlinkLayer} | gzip -d | sha256sum | cut -d ' ' -f1)
|
||||
layerSize=$(stat --printf '%s' ${symlinkLayer})
|
||||
|
||||
jq -n -c --arg sha256 $layerSha256 --arg size $layerSize --arg path ${symlinkLayer} \
|
||||
'{ size: ($size | tonumber), sha256: $sha256, path: $path }' >> $out
|
||||
jq -n -c --arg gzipHash $gzipHash --arg tarHash $tarHash --arg size $layerSize \
|
||||
--arg path ${symlinkLayer} \
|
||||
'{ size: ($size | tonumber), tarHash: $tarHash, gzipHash: $gzipHash, path: $path }' \
|
||||
>> $out
|
||||
''));
|
||||
|
||||
# Final output structure returned to Nixery if the build succeeded
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue