kaniko/integration
Damien Degois 1bf529e6d9
Add flag to remap registries for any registry mirror (#2935)
* Add flag to remap registries for any registry mirror

The purpose of this PR is to add an option to remap registries, a kind of generalized `--registry-mirror`.
This is helpful for air-gapped environments and/or when local registry mirrors are available (not limited to docker.io).
This allows user to reference any images without having to change their location.
It also permit to separate infra related configuration (the mirrors) from CI/CD pipeline definition by using an environment variable for example (the reason behind the early return if flag provided but empty).
Therefore you can have a pipeline calling kaniko with `--registry-map=$REGISTRY_MAP` and have the `REGISTRY_MAP` populated via the runner's env by another team, and the absence of env wouldn't trigger a failure, it makes the pipeline env independent.

I've also considered the option of environment variables directly but it doesn't seems to be in kaniko's philosophy.

This makes quite some duplicated code :/ One option to keep the mirror flag and behavior would be to use only one codebase and convert `--registry-mirror=VALUE` to `--registry-map=index.docker.io=VALUE` internally. Suggestions welcome!

* Configure logging config sooner to be able to use it in flag parsing

* Replace registry mirrors by maps logic and use env var

* Add env vars to README.md

* Fix test
2024-02-14 15:23:41 -08:00
..
benchmark_fs refactor: Make CLI argument names consistent (#2084) 2022-08-22 09:10:11 -04:00
context Fixes a whitelist issue when untarring files in ADD commands. (#371) 2018-09-28 11:42:07 -07:00
dockerfiles Skip the /kaniko directory when copying root (#2863) 2023-11-28 19:49:35 -08:00
dockerfiles-with-context Fix missing setuid flags on COPY --from=build operation (#2089) 2022-05-22 09:20:18 -04:00
ignore Re-add support for .dockerignore file 2018-12-10 15:20:25 -08:00
ignore_relative Fix #776 2019-10-03 17:53:14 +02:00
testdata Exit Code Propagation (#1655) 2021-06-01 10:43:49 -07:00
.dockerignore Re-add support for .dockerignore file 2018-12-10 15:20:25 -08:00
.gitignore fix: Refactor `LayersMap` to correct old strange code behavior (#2066) 2022-05-17 20:30:58 -04:00
BUILD Update ggcr to pick up estargz and caching option (#1527) 2020-12-21 10:09:21 -08:00
benchmark_test.go fix: Remove references to deprecated io/ioutil pkg (#2867) 2023-11-28 13:02:53 -08:00
cleanup.go Pass bucket and repo as args to tests 2018-07-31 09:53:59 -07:00
cmd.go Bump github.com/docker/docker to latest release (#1866) 2022-01-14 15:58:32 -05:00
config.go refactor: simpler local integration tests (#2110) 2022-06-14 13:38:01 -04:00
images.go fix: Remove references to deprecated io/ioutil pkg (#2867) 2023-11-28 13:02:53 -08:00
integration_test.go Add flag to remap registries for any registry mirror (#2935) 2024-02-14 15:23:41 -08:00
integration_with_context_test.go fix: Remove references to deprecated io/ioutil pkg (#2867) 2023-11-28 13:02:53 -08:00
integration_with_stdin_test.go fix: use debian buster to fix tests using no longer supported stretch which had broken apt-get urls (#2485) 2023-04-27 22:05:37 -04:00
k8s-job.yaml Fix the e2e K8s test (#1842) 2021-12-17 14:43:38 -05:00
k8s_test.go fix: Remove references to deprecated io/ioutil pkg (#2867) 2023-11-28 13:02:53 -08:00
tar.go fix: Remove references to deprecated io/ioutil pkg (#2867) 2023-11-28 13:02:53 -08:00
tar.tar chore: add workflows for pr tests (#1766) 2021-10-18 23:22:44 -07:00