Commit Graph

32 Commits

Author SHA1 Message Date
Manish Giri 7bfc73c3ad
fix: Remove references to deprecated io/ioutil pkg (#2867)
* Update benchmark_test

* Updae tar.go

* Update further refs

* Commit next set of replacements

* Reverting changes in vendor folder

* Update integreation_with_context_test.go

* Update k8s_test.go

* Update remaining usages

* Replace conflicting usage of fs local variable
2023-11-28 13:02:53 -08:00
Lio李歐 e5395c7a21
feat: support https URLs for digest-file (#2811)
This feature allows one to specify an https URL for any of the
digest-file options, resulting in an HTTP PUT to the provided
URL. This could for example be a (pre-signed) URL to S3 or GCS.

Currently the final digest is only written to the local filesystem,
which disappears and is not accessible when Kaniko is run in a
managed container service like AWS ECS.

By supporting https a single implementation supports all storage
services, without the need for special code for S3, GCS, etc..
2023-11-10 11:05:36 -08:00
JeromeJu 6ee84f128d
Change condition for the behavior when --no-push=true without --destinations (#2676)
This commit changes the condition check for the behavior when no-push is
set to true while destinations are needed. Prior this change, users would
have to set destinations even when noPush option is set to true. More
specifically, a workaround for tar files to be generated when --no-push is
true and destinations is empty is provided where a dummy destination would be
set.
2023-08-17 09:53:59 -07:00
Julian cefe99b92a
Added skip-push-permission flag (#2657)
Added skip-push-permission flag to conditionally disable push permission check on build start to accommodate for slow network policies
2023-08-15 11:23:16 -07:00
Joël Pepper 14ea7c4071
Fix Integration tests (#2425)
* fix(ci): Bump golangci-lint to 1.51.1

* chore(lint): fix gofmt and goimport issues

* chore(lint): fix linter issues

- Adapted error comparison according to linter recommendation
- Disabled noctx linting for http request where canceling makes no sense
- Disabled nilerror linting where nil error is returned on purpose
- Disabled makezero linter where slice is explicitly deepcopied

* chore(ci): Update go version in tests workflows

* fix(ci): Allow boilerplate years from 2000-2099

Previously the regex only allowed the copyright notice to contain the
years 2018,2019,2020,2021, or 2022. This commit widens to regex to
20\d\d allowing any year in the range [2000-2099]

* feat(ci): Replace minikube with k3s for intregration tests

The existing setup for minikube is very complicated, replicating most of
the setup steps for a full kubernetes cluster in an only partially
supported minikube configuration (driver=none). Furthermore the existing
setup has been broken for sometime, likely, at least in part due to the
changes to CNI and CRI in recent kubernetes versions.

Since what we actually need is only a running Kubernetes cluster on the
node and access to a registry on localhost:5000, we can switch the
extremely complicated minikube setup for a lightweight cluster using
k3s. Minikube came with a default addon for running a registry on every
node, but the same is not the case for k3s, instead we make use of the
package helm controller and its HelmChart CR to deploy twuni/docker-registry.helm
and expose it on localhost using the integrated LoadBalancer controller.

* fix(test-684): pin base container version

The dockerfile for the regression test connected to issue 684 used a
rolling tag as base image, making it flaky and fail since it was
introduced.

This commit pins the base image to the digest of bionic-20200219, which,
based on the date of the commit that introduced to the dockerfile would
be the most newest ubuntu build and likely what the "rolling" tag
resolved to back then. Since this also an image from the pre-oci days of
ubuntu, this circumvents a bug in container-diff as well
(https://github.com/GoogleContainerTools/container-diff/issues/389)
2023-03-21 12:30:54 -04:00
Natalie Arellano 4d077e2a40
Provide `--cache-repo` as OCI image layout path (#2250)
* Adds the ability to provide `--cache-repo` as an OCI image layout path

- Adds cache.LayoutCache to implement cache.LayerCache interface
- When opts.CacheRepo has "oci:" prefix, instantiates a LayoutCache

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Add integration test for layout cache

Signed-off-by: Natalie Arellano <narellano@vmware.com>

* Updates from PR review

Signed-off-by: Natalie Arellano <narellano@vmware.com>

Signed-off-by: Natalie Arellano <narellano@vmware.com>
2022-09-28 10:19:02 -04:00
Eng Zer Jun 0adbbee21d
test: use `T.TempDir` to create temporary test directory (#1918)
The directory created by `T.TempDir` is automatically removed when the
test and all its subtests complete.

Reference: https://pkg.go.dev/testing#T.TempDir
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-02-07 13:27:34 -05:00
Tejal Desai cf4822c31c
Run docker_credentials_gcr in warmer (#1780)
* run docker_credentials_gcr in warmer

* fix tests

* fix dockerfiles

* fix boilerplate

* mend

* fix

* another lint
2021-10-19 12:25:42 -07:00
Vivek Kumar 6028f1c5ec
fix: create parent directories before writing digest files (#1612) 2021-04-13 14:41:54 -07:00
Or Geva b3e036aab2
Add --image-name-tag-with-digest flag (#1541) 2021-01-19 13:28:05 -08:00
Tejal Desai 357286fa4b
add tests (#1426) 2020-09-30 16:46:22 -07:00
Akram Ben Aissi ab768b5d26
Allow DOCKER_CONFIG to be a filename (#1409)
* Allow DOCKER_CONFIG to be a filename

* UnitTest: DockerConfLocation must return a file if it is existent and passed using env, or default if the file is incorrect
2020-09-30 16:45:34 -07:00
Jon Johnson c42881410c Add pkg.dev to automagic config file population
Kaniko currently does config file setup for GCR such that pushing to GCR
automagically works. This change does the same for pkg.dev:
https://cloud.google.com/artifact-registry

This also tightens up the hostname check to ensure we don't send
credentials to a registry that happens to contain "gcr.io".
2020-06-23 11:23:07 -07:00
Ben Einaudi 2f6090dcd7 Remove use of DefaultTransport
Using DefaultTransport and manipulating its tls configuration may lead to unexpected behaviour
2020-05-20 11:43:13 +02:00
Tejal Desai da5c420ee9 use a mock 2020-05-19 15:05:46 -07:00
Mitchell Friedman 6978fab45c Add retries to image push.
This uses the default provided retry transport by
go-containerregistry as this originally had no retries
built in.

This is useful to avoid intermittent failures of image
registries when returning a retryable status code.
2020-05-08 14:18:43 +01:00
David Dooling 8bfd370ef9
Provide full path to Docker config file
Add tests.  The tests assume a POSIX file system, but it seems many
other tests assume Linux, so perhaps this is not a problem, or at
least does not add a new problem.

Fixes #1235
2020-05-06 10:02:47 -05:00
David Dooling 0871dfd6ab
Use DOCKER_CONFIG for docker config location
If the DOCKER_CONFIG environment variable is set, use it when
determining if the Docker config file exists.  Fall back to kaniko
default if it the DOCKER_CONFIG environment variable is not set.

Fixes #1228
2020-05-04 16:46:50 -05:00
Sam Stoelinga 1fb1eddd8c Test: Remove DockerConf after CheckPushPermission 2020-03-23 10:51:09 -07:00
Sam Stoelinga c2393df7c3 Cleanup push_test CheckPushPermission unit tests 2020-03-22 17:11:08 -07:00
Sam Stoelinga c56f16b163 Create constant for Docker conf location 2020-03-21 16:45:04 -07:00
Sam Stoelinga 8518b37ca1 Add unit tests for CheckPushPermissions 2020-03-21 16:15:34 -07:00
Ben Einaudi b73c2c10c8 Allow user to provide registry certificate
Fixes #1100
Fixes #1101
2020-03-08 18:17:50 +01:00
Will Ripley c8f089fdbb Fixed formatting errors with push.go and push_test.go 2019-10-29 13:09:27 -05:00
Will Ripley a0651436b5 Changed image name to be full image name minus tag. Also added test for new ImageNameDigestFile flag 2019-10-29 12:55:50 -05:00
Tejal Desai b57160198e fix bad merge 2019-10-04 11:20:41 -07:00
Tejal Desai f206e3f425
Merge branch 'master' into output 2019-10-04 08:43:02 -07:00
chhsia0 ea1a92712c Avoid comparing uncompressed and compressed images in the unit test. 2019-09-03 23:17:57 -07:00
chhsia0 11f3b791cd Renamed to `--oci-layout-path` and added a unit test. 2019-08-24 01:28:58 -07:00
Tejal Desai 6daffd8dd7 add multiple user agents to kaniko if upstream_client_type value is set 2019-08-23 11:29:05 -07:00
Jason Hall a916b72169
Add license header 2019-03-07 10:33:23 -05:00
Jason Hall 295dd49487 Write data about pushed images if env var is set 2019-03-06 14:37:56 -05:00