diff options
author | github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> | 2021-12-18 12:01:13 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-18 12:01:13 +0000 |
commit | 647c8d800f2e6067e2ef821634e556a53cbc2dd8 (patch) | |
tree | d13881db45afb463de4dd74255812bf546978620 /pkgs/build-support | |
parent | c690fb1ecd117d84ec9ae319588bdddc473c8088 (diff) | |
parent | 0b738b87dbff870720bebac1e25e645941ba1fd9 (diff) |
Merge master into staging-next
Diffstat (limited to 'pkgs/build-support')
-rw-r--r-- | pkgs/build-support/docker/default.nix | 2 | ||||
-rw-r--r-- | pkgs/build-support/docker/examples.nix | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/pkgs/build-support/docker/default.nix b/pkgs/build-support/docker/default.nix index 9a20df57777c..1b6c340f7f0c 100644 --- a/pkgs/build-support/docker/default.nix +++ b/pkgs/build-support/docker/default.nix @@ -240,7 +240,7 @@ rec { # Unpack all of the parent layers into the image. lowerdir="" extractionID=0 - for layerTar in $(tac layer-list); do + for layerTar in $(cat layer-list); do echo "Unpacking layer $layerTar" extractionID=$((extractionID + 1)) diff --git a/pkgs/build-support/docker/examples.nix b/pkgs/build-support/docker/examples.nix index f2d4f809ae4e..941ee048666d 100644 --- a/pkgs/build-support/docker/examples.nix +++ b/pkgs/build-support/docker/examples.nix @@ -405,6 +405,29 @@ rec { created = "now"; }; + # 23. Ensure that layers are unpacked in the correct order before the + # runAsRoot script is executed. + layersUnpackOrder = + let + layerOnTopOf = parent: layerName: + pkgs.dockerTools.buildImage { + name = "layers-unpack-order-${layerName}"; + tag = "latest"; + fromImage = parent; + contents = [ pkgs.coreutils ]; + runAsRoot = '' + #!${pkgs.runtimeShell} + echo -n "${layerName}" >> /layer-order + ''; + }; + # When executing the runAsRoot script when building layer C, if layer B is + # not unpacked on top of layer A, the contents of /layer-order will not be + # "ABC". + layerA = layerOnTopOf null "a"; + layerB = layerOnTopOf layerA "b"; + layerC = layerOnTopOf layerB "c"; + in layerC; + # buildImage without explicit tag bashNoTag = pkgs.dockerTools.buildImage { name = "bash-no-tag"; |