1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 04:02:10 +00:00
Commit graph

85 commits

Author SHA1 Message Date
Robert Hensing 1a70c803cb Format 2024-07-29 00:23:05 +02:00
Robert Hensing 6881d9b181 nixosTests.docker-tools-nix-shell: Extract
These tests should run as part of the `tests.devShellTools` suite,
and they're a significant portion of the general docker tools test
duration.
2024-07-28 23:19:56 +02:00
Robert Hensing c5e5aa7266
Merge pull request #308822 from yorickvP/yorickvp/streamLayeredImage-overridable
dockerTools.streamLayeredImage: add includeNixDB argument, expose conf and streamScript
2024-07-24 16:02:35 +02:00
Yorick van Pelt 8891e98f24
dockerTools: add nixDB tests 2024-05-06 17:48:49 +02:00
Jonas Fierlings f73a079352
dockerTools: Test changing compression of buildLayeredImage 2024-03-02 10:18:53 +01:00
WxNzEMof 4733b52c6b dockerTools.tests.docker-tools: Add non-root streamLayeredImage test 2024-02-26 19:29:04 +00:00
WxNzEMof 2697d34603 streamLayeredImage: Change mode of /nix, /nix/store to 755
The change is insignificant when the owner is root.  However, when it
is not root, this change is needed to allow using Nix (as an
unprivileged user) inside the container.
2024-02-26 18:10:51 +00:00
Robert Hensing d2dfcfcfad
Merge pull request #289584 from athre0z/docker-zstd
dockerTools: configurable compression schema
2024-02-19 18:06:54 +01:00
Robert Hensing 2104e113a0
Merge pull request #281520 from WxNzEMof/docker-tools-chown
dockerTools: Fix chown in fakeRootCommands
2024-02-19 09:01:05 +01:00
Joel Höner 4b603ad9cd dockerTools: configurable compression schema
This commit adds support for swapping out the compression algorithm
used in all major docker-tools commands that generate images. The
default algorithm remains unchanged (gzip).
2024-02-17 18:52:42 +01:00
Robert Hensing dcf985388c
Merge pull request #271976 from r-k-b/fix-dockerTools-includeStorePaths
nixos/dockerTools: fix includeStorePaths when enableFakechroot
2024-02-14 23:38:44 +01:00
WxNzEMof 84b5bcae26 dockerTools: Add chown test
proot's --root-id "allows" chown only in the sense that it makes it
succeed vacuously, i.e. a no-op. This is undesired if the goal is to
actually create a layer with some files owned by different users.

Fortunately, fakeroot does allow persistence of emulated file owners,
and it is possible to combine fakeroot with proot, so replace proot
--root-id with fakeroot to do so.

This was fixed recently in d538fefb62,
so this commit just adds a test.
2024-01-27 08:49:31 +00:00
Robert Hensing 1f9e86f314 nixosTests.docker-tools: Use both code paths in includeStorePath test 2024-01-17 13:50:01 +01:00
Sergei Trofimovich 4bb39bbc65 dockerTools.tests.docker-tools: user runCommand instead of runCommandNoCC alias
Noticed when evaluated tests without aliases enabled.
2023-12-26 22:42:38 +00:00
Robert K. Bell 8353fad13d
nixos/dockerTools: fix includeStorePaths when enableFakechroot
After #268458, when setting `enableFakechroot = true` and
`includeStorePaths = false`, some of the store paths were getting
included into the image anyway, thru `bind-paths`.
This resulted in unexpectedly large images.

Now, the images will not contain any store paths under those
circumstances.
2023-12-07 18:06:01 +11:00
Robert Scott 0834c95bd6 nixosTests.docker-tools: bump diskSize from 2048 -> 3072 2023-09-17 12:18:42 +01:00
Andrew Brooks 298c543e55 dockerTools: Specify 'latest' tag for repeated layer test image 2023-02-06 12:18:23 -06:00
Andrew Brooks c66cabe33e
dockerTools: use more familiar terminology to describe test image
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-02-06 11:15:33 -06:00
Andrew Brooks eb38ad04ef
dockerTools: ensure runAsRoot script not optimized away in test
Co-authored-by: Robert Hensing <roberth@users.noreply.github.com>
2023-02-06 11:05:13 -06:00
Andrew Brooks 6f63865cf4 dockerTools: Add minimal test case for #214434 2023-02-03 17:49:39 -06:00
Robert Hensing cf7b358d69 nixosTests.docker-tools: Fix syntax
This may be unnecessary, but I'm not waiting for the tests again.
2022-12-08 22:29:38 +01:00
Christian Kemper afe2d0bb8b fix docker inspect image reference 2022-12-08 20:29:10 +01:00
Christian Kemper f6ae4479ea dockerTools: allowing architecture to be specified
... for buildImage, buildLayeredImage and streamLayeredImage,
adding docs and tests.
2022-12-08 20:29:09 +01:00
Silvan Mosberger c36f929dee nixos/tests: Add tests for dockerTools.buildNixShellImage 2022-10-07 22:04:24 +02:00
Robert Hensing cbb1f39264 nixosTests.docker-tools: Add image-with-certs 2022-09-21 01:00:04 +01:00
olaf 5a6853b3bf use consistently user alice for examples 2022-08-05 13:13:24 +02:00
Robert Hensing 116832edbf dockerTools: Add example of using NixOS' etc
(cherry picked from commit 9b2af8673b)
2022-05-30 14:26:52 +02:00
zowoq 76636e0099 dockerTools: pkgs.system -> pkgs.stdenv.hostPlatform.system
`pkgs.system` is an alias
2022-04-05 10:19:40 +10:00
Andrew Brooks 57718902e3 nixos/tests/docker-tools: add test for pre-runAsRoot layer unpack order 2021-12-17 19:26:53 -06:00
Robert Hensing 0e9bc9ffd1 dockerTools: Add fakechroot to fakeRootCommands 2021-12-04 13:49:10 +00:00
Robert Hensing 66c19d856b
Merge pull request #148341 from hercules-ci/add-dockerTools-customization-layer-dependencies
dockerTools: Add store dependencies of the customization layer
2021-12-03 00:20:44 +01:00
Robert Hensing d0bcc212de nixosTests.docker-tools: Use unique binary in test case 2021-12-02 22:26:05 +00:00
Robert Hensing 3b9d05e114 dockerTools: Fix and test #118722 path in contents 2021-10-18 12:41:51 +02:00
Robert Hensing 48cfdc8ca5 dockerTools: Add store dependencies of the customization layer 2021-10-06 22:45:04 +02:00
Robert Hensing 286c71a230
Merge pull request #139892 from hercules-ci/dockerTools-test-pullImage
dockerTools: test pullImage
2021-09-29 15:27:49 +02:00
Robert Hensing 16a4da9127 dockerTools: Test pullImage fetcher whenever its implementation changes 2021-09-29 14:41:08 +02:00
Justin Bedo 020e88bf7a
nixos/tests/docker-tools: check explicitly for file in exportImage 2021-09-29 21:40:31 +10:00
Justin Bedo 0319228a45
docker-tools: add example for exportImage functionality and test 2021-09-29 15:35:21 +10:00
talyz b7749c7671
nixos/test-driver: Run commands with error handling
Bash's standard behavior of not propagating non-zero exit codes
through a pipeline is unexpected and almost universally
unwanted. Default to setting `pipefail` for the command being run;
it can still be turned off by prefixing the pipeline with
`set +o pipefail` if needed.

Also, set `errexit` and `nonunset` options to make the first command
of consecutive commands separated by `;` fail, and disallow
dereferencing unset variables respectively.
2021-06-05 18:44:42 +02:00
Robert Hensing 5259d66b74 dockerTools: Allow omitting all store paths
Adds includeStorePaths, allowing the omission of the store paths.
You generally want to leave it on, but tooling may disable this
to insert the store paths more efficiently via other means, such
as bind mounting the host store.
2021-05-26 15:11:42 +02:00
Robert Hensing 8c868f47a8 Revert "nixos/tests/docker-tools*: remove useless formatter"
Annoyed with the interference of the python formatting of
generated code (see #72964), I took matters into my own hands
as maintainer of dockerTools.

Afterwards, I've created a PR, hoping to unstuck the discussion.

@aszlig took notice and thanks to his python ecosystem knowledge,
the testing efforts of @blaggacao and @Ma27, and a sense of
shared suffering and comraderie we were able to change the
situation for the better in #122201.

Now, we have a proper linter that actually helps contributors,
so it's time to turn it back on again.

I'm glad we could make it happen this quickly!

Thanks!

This reverts commit 4035049af3.
2021-05-09 02:57:17 +02:00
Robert Hensing 4035049af3 nixos/tests/docker-tools*: remove useless formatter 2021-05-08 15:03:20 +02:00
Robert Hensing a67c97a5eb nixos/tests/docker-tools*: Add myself as maintainer where missing
I should have done this when I became maintainer for dockerTools,
but it's the PR reviews that matter.
2021-05-08 15:00:19 +02:00
Viktor Kronvall 10019ab879 dockerTools: test that mergeImages preserves owner 2021-04-08 00:22:59 +09:00
Viktor Kronvall bcc3f8eab5 dockerTools: test mergeImages 2021-04-08 00:22:59 +09:00
Robert Hensing 58b21dea78
Merge pull request #116749 from vroad/docker-layered-image-fakeroot
dockerTools.streamLayeredImage: add fakeRootCommands option
2021-04-07 15:02:24 +02:00
vroad 63e7c4186f dockerTools.streamLayeredImage: Add test for fakeRootCommands 2021-04-07 18:11:02 +09:00
Louis Blin b3f68289df dockerTools.streamLayeredImage: resolve duplicate env vars
For images running on Kubernetes, there is no guarantee on how duplicate
environment variables in the image config will be handled. This seems
to be different from Docker, where the last environment variable value
is consistently selected.

The current code for `streamLayeredImage` was exploiting that assumption
to easily propagate environment variables from the base image, leaving
duplicates unchecked. It should rather resolve these duplicates to
ensure consistent behavior on Docker and Kubernetes.
2021-03-25 23:29:54 +00:00
Louis Blin aae8588182 dockerTools.buildLayeredImage: support fromImage
It is now possible to pass a `fromImage` to `buildLayeredImage` and
`streamLayeredImage`, similar to what `buildImage` currently supports.

This will prepend the layers of the given base image to the resulting
image, while ensuring that at most `maxLayers` are used. It will also
ensure that environment variables from the base image are propagated
to the final image.
2021-03-23 14:50:42 +00:00
Louis Blin 419a4fa596 dockerTools.buildLayeredImage: image names with registry/ prefix
When using `buildLayeredImage`, it is not possible to specify an image
name of the form `<registry>/my/image`, although it is a valid name.

This is due to derivations under `buildLayeredImage` using that image
name as their derivation name, but slashes are not permitted in that
context.

A while ago, #13099 fixed that exact same problem in `buildImage` by
using `baseNameOf name` in derivation names instead of `name`. This
change does the same thing for `buildLayeredImage`.
2021-03-10 17:44:24 +00:00