Commit Graph

80 Commits

Author SHA1 Message Date
chhsia0 730b8b77c8 Added `--layout-path` flag to save image in OCI layout.
Fixed #296.

The output manifests may have `application/vnd.docker.distribution.manifest.v2+json`
as their media types instead of `application/vnd.oci.image.manifest.v1+json`.
2019-08-24 01:04:18 -07:00
Tejal Desai 96947b8ca4 fix lint 2019-08-23 13:13:14 -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
Tejal Desai 19fb253e9c
Merge pull request #680 from tbarrella/go-containerregistry-upgrade
Update go-containerregistry
2019-07-23 14:35:19 -07:00
Andreas Bergmeier 7cc899b09e Add SkipVerify support to CheckPushPermissions. (#663)
Extract makeTransport, which allows using the current mechanism used for
pushing.

Fixes #628.
2019-06-14 12:34:55 -07:00
Taylor Barrella 5c0603a967 Update go-containerregistry
Resolves #607

* Deleted a duplicate Gopkg.lock block for github.com/otiai10/copy to
  prevent `dep ensure` from deleting it from vendor/

* Searched for breaking changes. Only found ones for
  remote.Delete/List/Write/WriteIndex. Searched for those and fixed

* Noticed that NewInsecureRegistry was deprecated and replaced it
2019-05-25 15:56:20 -07:00
Andreas Bergmeier 0a3a280e8f Correct CheckPushPermission comment. 2019-05-20 09:36:25 +02:00
Gijs 3686b65426 Process feedback of priyawadhwa regarding naming/nilcheck.
Changes the argument flag from `--digestfile` to `--digest-file`.
Skips an unneeded nil check.
2019-05-11 15:14:25 +02:00
Gijs a6e3ddfc79 Add `--digestfile` flag to output built digest to file.
This flag, when set, takes a file in the container and writes the image digest to it. This can be used to extract the exact digest of the built image by surrounding tooling without having to parse the logs from Kaniko, for example by pointing the file to a mounted volume or to a file used durint exit status, such as with Kubernetes' [Termination message policy](https://kubernetes.io/docs/tasks/debug-application-cluster/determine-reason-pod-failure/)]

When the flag is not set, the digest is not written to file and the executor behaves as before. The digest is also written to file in case of a tarball or a `--no-push`.

Closes #654
2019-05-02 14:57:44 +02:00
Jason Hall 3fa411ceb9 Check push permissions before building images (#622)
* Check push permissions before building images

* Fix doc comment

* improve error messages
2019-03-19 12:39:59 -05:00
Jason Hall 295dd49487 Write data about pushed images if env var is set 2019-03-06 14:37:56 -05:00
Anurag Goel 82fe355f14 Fix issues with layer caching, noPush and tarPath (#549)
* Set TarPath to empty when pushing a layer

* Fix issues with layer caching, noPush and tarPath.

- Layer caching should work even when tarPath is specified, so this
commit changes the value of tarPath to empty when caching layers.

- When an image is built with just the tarPath and noPush
is true, we should still create the tarBall (which wasn't happening
before this commit).

* Set no-push to false for cache layers

* Remove extra log

* go-imports fix
2019-02-06 10:16:09 -06:00
Daisuke Taniwaki f8f59ea4c6 Add insecure-registry and tls-skip-verify-registry flags (#537) 2019-01-29 13:29:47 -06:00
dlorenc 996bec885f
Refactor our credential fetching to only get k8s credentials if we are on k8s. (#522) 2019-01-11 11:36:43 -07:00
dlorenc 170e0a2d94
Add a lot more timing data. (#518) 2019-01-10 13:27:55 -07:00
Sharif Elgamal 29b7c3e879
Adding TTL to caching (#488)
* Adding TTL to caching

* uncomment added lines

* cache TTL works for layers now

* remove debugging

* parse booleans correctly

* parse booleans correctly everywhere

* fix boolean parsing condition

* refactor benchmarking calls

* defer file properly
2018-12-13 14:20:25 -08:00
dlorenc 8408c53aa8
Improve cache layer uploads. (#443)
This change only uploads layers that were created from cache misses on RUN commands.
It also improves the cache-checking logic to handle this case.
Finally, it makes cache layer uploads happen in parallel with the rest of the build, logging
a warning if any fail.
2018-11-12 16:22:04 -06:00
Carlos Sanchez 5ed45ed2fb Preserve options when doing a cache push (#423)
* Preserve options when doing a cache push

Otherwise options like `insecure` are lost

* Do not override original object
2018-11-06 15:44:44 -06:00
Daisuke Taniwaki 05e3250043 Support insecure pull (#401) 2018-10-22 14:33:41 -07:00
Jason Hall 5a0c9b2a13 Update go-containerregistry dep and remove unnecessary Options 2018-10-01 14:11:26 -04:00
Priya Wadhwa c216fbf91b Add layer caching to kaniko
To add layer caching to kaniko, I added two flags: --cache and
--use-cache.

If --use-cache is set, then the cache will be used, and if --cache is
specified then that repo will be used to store cached layers. If --cache
isn't set, a cache will be inferred from the destination provided.

Currently, caching only works for RUN commands. Before executing the
command, kaniko checks if the cached layer exists. If it does, it pulls
it and extracts it. It then adds those files to the snapshotter and
append a layer to the config history.  If the cached layer does not exist, kaniko executes the command and
pushes the newly created layer to the cache.

All cached layers are tagged with a stable key, which is built based off
of:

1. The base image digest
2. The current state of the filesystem
3. The current command being run
4. The current config file (to account for metadata changes)

I also added two integration tests to make sure caching works

1. Dockerfile_test_cache runs 'date', which should be exactly the same
the second time the image is built
2. Dockerfile_test_cache_install makes sure apt-get install can be
reproduced
2018-09-13 18:32:53 -07:00
Priya Wadhwa 99ab68e7f4 Replace gometalinter with GolangCI-Lint
gometalinter is broken @ HEAD, and I looked into why that was. During
that process, I remembered that we took the linting scripts from
skaffold, and found that in skaffold gometalinter was replaced with
GolangCI-Lint:

https://github.com/GoogleContainerTools/skaffold/pull/619

The change made linting in skaffold faster, so I figured instead of
fixing gometalinter it made more sense to remove it and replace it with
GolangCI-Lint for kaniko as well.
2018-09-11 13:30:42 -07:00
Priya Wadhwa 0636fe6040 Merge branch 'master' of github.com:GoogleContainerTools/kaniko into stages 2018-08-30 16:17:44 -07:00
Priya Wadhwa 1db7fc2a61 Rebased 2018-08-30 10:16:08 -07:00
Sebastian Jackel 1a7de69f3e Rename DockerInsecure field to InsecurePush 2018-08-30 09:36:12 +02:00
Sebastian Jackel 4ba6148621 Implement separation between Insecure (HTTP) registry and skipping TLS verification into two separate command line parameters 2018-08-30 09:34:31 +02:00
sharifelgamal 493344e438
support multiple tags when writing to a tarfile 2018-08-28 18:14:03 -07:00
Priya Wadhwa 64a0b1d75f Added a KanikoStage type for each stage of a Dockerfile
I added a KanikoStage to hold each stage of the Dockerfile along with
information about each stage that would be useful later on.

The new KanikoStage type holds the stage itself, along with some
additional information:

1. FinalStage -- whether the current stage is the final stage
2. BaseImageStoredLocally/BaseImageIndex -- whether the base image for
this stage is stored locally, and if so what the index of the base image
is
3. SaveStage -- whether this stage needs to be saved for use in a future
stage

This is the first part of a larger refactor for building stages, which
will later make it easier to add layer caching.
2018-08-27 14:15:04 -07:00
Priya Wadhwa d867eadbb0 Review code comments; improved error messages for push 2018-08-23 14:27:13 -07:00
Priya Wadhwa cfa822f178 Refactor command line arguments and the executor
In this refactor I:

1. Created KanikoOptions to make it easier to pass around arguments
passed in through the command line
2. Reorganized executor.go by putting the logic for pushing the image in
a new file push.go
3. Made some error messages clearer
4. Fixed a mistake in the README for pushing to AWS
5. Marked the --bucket flag as hidden since we want people to use
--context instead, and marked an aws flag as hidden which is set in a
vendored directorya
2018-08-23 13:30:36 -07:00