Commit Graph

65 Commits

Author SHA1 Message Date
Yoan Blanc edc4eb33f4
Merge remote-tracking branch 'origin/master' into registry-mirror 2020-02-16 09:28:54 +01:00
Ben Einaudi 3e2221cf6f Allow contributors to launch integration tests against local registry
This change allows user to launch integration tests with a local registry

Fixes #1012
2020-02-06 13:35:51 +01:00
Tejal Desai 3cd216f75b add the registry mirror flag 2020-01-30 15:37:10 -08:00
Tejal Desai 611ba51c88 fix web editor conflicts resolutions 2020-01-30 11:18:53 -08:00
Tejal Desai 47ab3fe997
Merge branch 'master' into registry-mirror 2020-01-29 11:42:06 -08:00
Sam Stoelinga 61af994a33 Run integration tests in Travis CI
- Change integration tests to use docker hub instead of GCR due to bug
in library that requires authentication with gcr.io even for public
images. See #966 for bug tracking this.
- Make uploading to GCS bucket configurable through a flag --uploadToGCS
- Utilize a locally deployed docker registry in travis CI to remove
dependency of needing to authenticate with GCP. This requires host
networking such that we can access the registry on localhost:5000
- Use the commit that's being tested for `TestGitBuildcontext`
- Remove duplicate GitBuildContext case that's now covered by default in
travis CI.
2020-01-19 22:33:04 -08:00
Yoan Blanc 140879fadd
Merge remote-tracking branch 'origin/master' into registry-mirror 2020-01-18 09:35:56 +01:00
Tejal Desai a6add78a97 do not use the git repo as context 2020-01-16 23:08:22 -08:00
Tejal Desai 20604dff3d
fix integration test 2020-01-16 22:12:35 -08:00
Sam Stoelinga 64bfc3eabb Fix bug with docker compatibility
ArgsEscaped according to Docker docs should only be set in Windows
environments: https://docs.docker.com/engine/api/v1.30/

It was causing integration test to fail with following message:
```
FAIL: TestRun/test_Dockerfile_test_metadata (8.48s)
           "Diff": {
             "Adds": [
               "ArgsEscaped: true"
             ],
             "Dels": [
               "ArgsEscaped: false"
             ]
```

However docker 18.xx returns ArgsEscaped: true
whereas docker 19.xx returns ArgsEscaped: false
Hence this patch also adds the docker version check to the integration
to ignore ArgsEscaped being different when 18.xx is used.
2020-01-13 21:18:54 -08:00
Sam Stoelinga 8cf392e20e Allow setting serviceAccount in integration test
Previously it would mount .config/gcloud directory which is not
recommended for systems such as CI that authenticate with Google Cloud.
This commit allows you to set the path to a service account.

By default previous behaviour will be as before so this shouldn't break
existing systems that run the integration test.
2020-01-12 18:54:50 -08:00
Sam Stoelinga fa94f6b942 Fix #950 integration test failing on go 1.13
From Golang 1.13 release notes:
Testing flags are now registered in the new Init function, which is
invoked by the generated main function for the test. As a result,
testing flags are now only registered when running a test binary, and
packages that call flag.Parse during package initialization may cause
tests to fail.
2020-01-07 09:46:25 -08:00
Yoan Blanc 3ad9f7d94c
fixup! fixup! fixup! integration-test: using registry-mirror
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2019-12-23 09:34:32 +01:00
Yoan Blanc e05bdd58f2
fixup! fixup! integration-test: using registry-mirror
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2019-12-23 09:32:13 +01:00
Yoan Blanc 9fb2111379
fixup! integration-test: using registry-mirror
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2019-12-22 14:10:12 +01:00
Yoan Blanc c7d173cd99
integration-test: using registry-mirror
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2019-12-22 11:29:03 +01:00
Yoan Blanc 908025b6d3
integration: removing test on docker
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2019-12-22 11:18:34 +01:00
Yoan Blanc 3678b70239
Merge remote-tracking branch 'origin/master' into registry-mirror 2019-12-22 11:10:15 +01:00
Cole Wippern bdabd774fc Update linter and fix errors
* disable linters that are now enabled by default in new version
* fix linter errors
2019-12-21 12:27:14 -08:00
Cole Wippern 05447f1eaa clean up unused code 2019-12-09 13:57:59 -08:00
Cole Wippern c2645b2207 Fix #897 - only build required docker images
Only build the docker images required for the integration tests which
will be executed rather than building all docker images every time.
2019-12-02 13:19:43 -08:00
Yoan Blanc 6e2287c969
readme: add --registry-mirror
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2019-11-10 12:55:31 +01:00
Yoan Blanc 73f7ea0d2c
fixup! integration: build using registry-mirror
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2019-11-08 16:17:00 +01:00
Yoan Blanc dd9758cccc
integration: build using registry-mirror
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2019-11-08 15:39:43 +01:00
Tejal Desai 22188595f0
Merge pull request #768 from N4rm0/fix-envar-replacement-for-url
Fix #691 - ADD does not understand ENV variables
2019-10-04 01:17:22 -07:00
Monard Vong a63a809e98 fix tests 2019-09-22 00:26:35 +02:00
Hugues Alary 4327e9ba24 Resolve relative paths to absolute paths in command line arguments
The executor accepts a few arguments dockerfile, context, cache-dir and
digest-file that all represent paths. This commits allows those paths to
be relative to the working directory of the executor.

Fixes #732 #731 #675
2019-08-27 21:06:26 +00:00
Carlos Alexandro Becker 46a738f2b2
fix: integration tests
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2019-06-22 12:18:42 -03:00
Carlos Alexandro Becker f0b9ad3a57
feat: support specifying branch for cloning
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2019-06-22 11:45:07 -03:00
Priya Wadhwa 8b459b57aa Test git buildcontext 2019-02-21 13:03:02 -08:00
dlorenc e14b660947
Fix a bug in volume handling for multi-stage images. (#554)
We were previously not resetting the whitelist between stages, this caused issues with volumes.
2019-02-07 09:01:49 -06:00
dlorenc 9f65174cb8
Generate the config.json from gcloud rather than relying on a hardcoded one. (#551)
marketplace.gcr.io now requires auth, but our credential helper doesn't know that.
2019-02-04 16:53:59 -06:00
dlorenc b0e7c0e8cd
Upload benchmarks to GCS. (#523) 2019-01-17 16:10:14 -05:00
dlorenc ddeef6d224
Refactor tests and make them run in parallel. (#499) 2018-12-21 12:17:57 -06: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
Priya Wadhwa b0b36ed85a Re-add support for .dockerignore file
This PR adds support for the dockerignore file. Previously when kaniko
had support for the dockerignore file, kaniko first went through the
build context and deleted files that were meant to be ignored. This
resulted in a really bad bug where files in user mounted volumes would
be deleted (my bad).

This time around, instead of modifying the build context at all, kaniko
will check if a file should be excluded when executing ADD/COPY
commands. If a file should be excluded (based on the .dockerignore) it
won't be copied over from the buildcontext and shouldn't end up in the
final image.

I also added a .dockerignore file and Dockerfile as an integration test,
which should fail if the dockerignore is not being processed correctly or if files aren't being excluded correctly.
Also, I removed all the integration testing from the previous version of the
dockerignore support.
2018-12-10 15:20:25 -08:00
Sharif Elgamal 7cde036f44
Add benchmarking code (#448)
* adding benchmarking code

* enable writing to file

* fix build

* time more stuff

* adding benchmarking to integration tests

* compare docker and kaniko times in integration tests

* Switch to setting benchmark file with an env var

* close file at the right time

* fix integration test with environment variables

* fix integration tests

* Adding benchmarking documentation to DEVELOPEMENT.md

* human readable benchmarking steps
2018-11-28 11:54:12 -08:00
Priya Wadhwa e7faec5f0a Skip .dockerignore test 2018-11-26 11:50:57 -08:00
Priya Wadhwa 313250f321 Remove support for .dockerignore
Remove support for .dockerignore file until I can change it to ignore
files in memory instead of deleting them

Refer to #466
2018-11-26 11:11:30 -08:00
Priya Wadhwa 55e6157000 Fix bugs with .dockerignore and improve integration test
I improved handling of the .dockerignore file by:

1. Using docker's parser to parse the .dockerignore and using their
helper functions to determine if a file should be deleted
2. Copying the Dockerfile we are building to /kaniko/Dockerfile so that
if the Dockerfile is specified in .dockerignore it won't be deleted, and
if it is specified in the .dockerignore it won't end up in the final
image
3. I also improved the integration test to create a temp directory with
files to ignore, and updated the .dockerignore to include exclusions (!)
2018-10-31 12:50:23 -07:00
Sharif Elgamal effac9dfc3
Persistent volume caching for base images (#383)
* comments

* initial commit for persisent volume caching

* cache warmer works

* general cleanup

* adding some debugging

* adding missing files

* Fixing up cache retrieval and cleanup

* fix tests

* removing auth since we only cache public images

* simplifying the caching logic

* fixing logic

* adding volume cache to integration tests. remove auth from cache warmer image.

* add building warmer to integration-test

* move sample yaml files to examples dir

* small test fix
2018-10-11 13:38:05 -07:00
Priya Wadhwa 589197b416 Fix travis @ HEAD
I merged a contributor's PR which modifed the HasFilepathPrefix function
to take an additional argument, but the PR hadn't been rebased. One of the
liting tests in Travis caught this bug.
2018-10-01 14:56:46 -07:00
priyawadhwa 8f0d257134
Merge pull request #334 from peter-evans/fix-volume-cmd
Fix handling of the volume directive
2018-10-01 14:49:33 -07:00
dlorenc e1b0f7732e
Fixes a whitelist issue when untarring files in ADD commands. (#371)
* Fixes a whitelist issue when untarring files in ADD commands.

* Add go-cmp test tool.

* Make the integration test tolerate some file differences.
2018-09-28 11:42:07 -07:00
peter-evans b1e28ddb4f Fix handling of volume directive 2018-09-28 11:16:25 +09:00
Priya Wadhwa eb7194a165 Fix linting errors 2018-09-13 22:06:38 -07: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 7635421ae9 Add t.Helper() call to checkLayers for better error logging 2018-09-11 16:24:21 -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 5bdb87e0e7 Extract filesystem in order rather than in reverse
Extracting the layers of the filesystem in order will make it easier to
extract cached layers and deal with hardlinks.

This PR implements extracting in order and adds an integration tests to
make sure hardlinks are extracted properly.

It also fixes two bugs I found when extracting symlinks:

1. We'd get a "file exists" error when trying to symlink to an existing
file with a whiteout later in the layer tarball
2. We'd get a "file exists" error when trying to create a symlink from a
file that was created in a prior layer (perhaps as a regular file or as
a symlink pointing to someting else)

To fix both of these, we resolve all symlinks in a layer at the end. I
also added logic to delete any existing paths before creating the
symlink.
2018-08-29 15:44:38 -07:00