Commit Graph

98 Commits

Author SHA1 Message Date
Jason Hall 59c2d2d08f
Collapse integration test workflows into one config (#1855)
* Collapse integration test workflows into one config

Remove last traces of Travis, including env vars and `make travis-setup`
and badges in README

* fix lint

* make integration tests pass on PRs
2021-12-22 20:04:40 -05:00
Jason Hall b1b6962726
Share the Go build cache when building in Dockerfiles (#1853)
On my machine this makes image rebuilds go from ~5m to 1.5s.

This also required setting DOCKER_BUILDKIT=1 in integration test image
builds.

I also took the opportunity to bump the Go version used in those tests
to Go 1.17 to match the image build processes, and tidied up the
workflow files a bit too (renaming for consistency, typos, whitespace,
etc.)
2021-12-22 12:43:12 -05:00
Matt Moore 49f0154b3f
Fix the e2e K8s test (#1842)
* Debugging the integration testing.

It seems to be consistently failing (also fix a typo in the file/leg name).

I'm disabling `-v` for `go test` because it interleaves the test output in ways that make it painful to read a single failing test's output when `t.Parallel` is involved.

* Try swapping registry:2 for the registry add-on

* Drop logf and make Logger private
2021-12-17 14:43:38 -05:00
Tejal Desai ee31dc93b6
Revert "Support mirror registries with path component (#1707)" (#1794)
* Revert "Support mirror registries with path component (#1707)"

This reverts commit 4e218f2162.

* fix tests and add co-sign back
2021-10-20 19:13:24 -07:00
wwade 82fc94d930
git: accept explicit commit hash for git context (#1765)
* git: accept explicit commit hash for git context

When checking out code from non-github repositories, the typical
assumptions may not be valid, e.g. that the only interesting
non-branch commits have ref names starting with refs/pull. A specific
example is fetching an un-merged commit from a gerrit repository by
commit hash.

This change just looks at the second part of the git context path and
checks if it's a SHA commit hash, and if so, will fetch and check out
this commit after cloning the repository.

Sample context argument:

    https://github.repo/project#e1772f228e06d15facdf175e5385e265b57068c0

* ci: fix test script to recognize any non-zero exit as an error

hack/linter.sh didn't properly install golangci-lint in hack/bin as I
already have another version of golangci-lint on my PATH, but then it
failed to execute because it was looking for it specifically in
hack/bin.

When the executable is not found, the exit code is 127 instead of 1,
and so test.sh ignored the error.

Two fixes:

1. `test.sh`:
  - Use `if (script) ...` instead of assigning / checking a result
    variable to determine if each validation script passed or failed.

2. `hack/linter.sh`:
  - Instead of checking for golangci-lint on the path, just
    specifically check for an executable file (`test -x`) in the
    expected location.

Co-authored-by: Wade Carpenter <wwade@users.noreply.github.com>
2021-10-19 19:27:15 -07:00
Gilbert Gilb's a42adb9bb4
Fix composite cache key for multi-stage copy command (#1735)
* chore: add workflows for pr tests

* fix unit tests

* fix formatting

* chore: fix gobuild

* change minikube script

* chore: fix lint install script

* chore: ignore and fix tests

* fix lint and run gofmt

* lint fixes

* k8s executor image only

* fix Makefile

* fix travis env variables

* more info on k8s tests

* fix travis run

* fix

* fix

* fix

* fix log

* some more changes

* increase timeout

* delete travis.yml and fix multiple copy tests

* fix registry mirror

* fix lint

* add concurency

* last attemot to fix k8 integrations

* diff id for diff workflows

* Fix composite cache key for multi-stage copy command (#1706)

PR #1518 reintroduced COPY layers caching using the `--cache-copy-layers`
flag. Unfortunately, this PR also introduced a bug by not including the
stage digest into the caching key of the COPY command when the
`--cache-copy-layers` flag was not set. As a result, kaniko would use
any previous (possibly stalled) layer from the cache because the digest
of the "COPY --from" command would never change.

PR author probably expected Go to fallthrough in the switch just like C
does. However, this is not the case. Go does not fallthrough in
switch-statements by default and requires the fallthrough keyword to be
used. Note that this keyword is not available in type-switches though,
because it wouldn't work properly with typings.

* refactor: add an abstract copy command interface to avoid code duplication

* fix typo in error message

Co-authored-by: Tejal Desai <tejal29@gmail.com>
2021-10-18 23:31:01 -07:00
Tejal Desai 1da17b6e9b
chore: add workflows for pr tests (#1766)
* chore: add workflows for pr tests

* fix unit tests

* fix formatting

* chore: fix gobuild

* change minikube script

* chore: fix lint install script

* chore: ignore and fix tests

* fix lint and run gofmt

* lint fixes

* k8s executor image only

* fix Makefile

* fix travis env variables

* more info on k8s tests

* fix travis run

* fix

* fix

* fix

* fix log

* some more changes

* increase timeout

* delete travis.yml and fix multiple copy tests

* fix registry mirror

* fix lint

* add concurency

* last attemot to fix k8 integrations

* diff id for diff workflows
2021-10-18 23:22:44 -07:00
Benjamin Krenn 57ea150cad
Exit Code Propagation (#1655)
* exit codes of failed RUN commands may now be propagated to the caller by using the --propagate-exit-code flag

* removed exit code propagation flag; the exit function now unwraps the error and looks for an exit code

* added integration test for exit code propagation

* added trailing new line in test Dockerfile_exit_code_propagation; tidying up README.md removing all traces of error propagation flag

* moved exit code propagation test to integration_test.go; moved exit code propagation test files to 'testdata' to avoid interference with other integration tests
2021-06-01 10:43:49 -07:00
Tejal Desai b04399eeac
add caching copy layers back (#1518)
* add caching copy layers back

* fix test

* lint

* fix test - 2

* Add integration test

* fix lint
2020-12-11 00:25:03 -08:00
Vincent Behar 131828a1ad
feat: support multiple registry mirrors with fallback (#1498)
Fixes #1473

The initial implementation of the registry mirror only allowed a single mirror, and if pulling from the mirror failed, the build would fail.

This change introduces:
- multiple registry mirrors instead of a single one
- fallback if an image can't be pulled from a registry

This is the same behavior as the docker daemon and will allow using a registry mirror such as `mirror.gcr.io` which is incomplete and doesn't have all the content that the default registry on docker.io has.

Note that there are no changes in the CLI flags, the `--registry-mirror` flag is still valid. But now it can be used multiple times to set up more than one registry mirror.

Co-authored-by: Tejal Desai <tejaldesai@google.com>
2020-12-08 16:16:25 -08:00
Yoan Blanc 5412ac65da
fixup! fixup! fixup! add should fail on 40x
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-06-20 10:46:41 +02:00
Yoan Blanc 999365f5f9
fixup! fixup! add should fail on 40x
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-06-20 10:42:59 +02:00
Yoan Blanc 8cc772ae9c
fixup! add should fail on 40x
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-06-20 10:15:50 +02:00
Tejal Desai 8074a70863
Merge pull request #1285 from antechrestos/fix/image_argument_name
Added integration test for multi level argument
2020-06-04 12:04:06 -07:00
Tejal Desai 994a412d0b some more renames 2020-06-02 16:08:46 -07:00
Tejal Desai cbf3073fda rename whitelist to ignorelist 2020-06-02 15:56:27 -07:00
Ben Einaudi 3462b7585b Added integration test for multi level argument
Added integration test to check that following pattern is supported

ARG TAG=1.2
ARG IMAGE=my-image:${TAG}
FROM ${IMAGE}
...
2020-05-24 13:04:31 +02:00
Tejal Desai 8a780be748
Merge pull request #1139 from JordanGoasdoue/allow-injecting-context-tar-gz
feat: allow injecting through stdin tar.gz on kaniko
2020-05-01 10:24:05 -07:00
Carlos Alexandro Becker 8b50908e48
test: fixed
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2020-04-03 17:15:40 -03:00
Carlos Alexandro Becker 0fc7b8a4f4
test: add it
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
2020-04-03 16:34:22 -03:00
Sam Stoelinga 1b662e7834
Merge pull request #1140 from samos123/fix-1122-public-gcr
Add ability to use public GCR repos without being authenticated
2020-03-24 10:31:58 -07:00
Jordan Goasdoué d08a767454 feat: allow injecting through stdin tar.gz on kaniko 2020-03-18 12:29:49 +01:00
Tejal Desai a173bf020b
Merge pull request #1115 from JordanGoasdoue/allow-build-context-from-local-targz
feat: add support of local '.tar.gz' file inside the kaniko container
2020-03-17 15:24:10 -07:00
Sam Stoelinga 0cfc5c635a Remove importing gcr images into docker registry
Previously there was a need to import public GCR images into the local
docker registry and replace the base images to use the local docker
registry. This is no longer needed since Kaniko now works with public
GCR images also for unauthenticated users.
2020-03-16 14:53:18 -07:00
Jordan GOASDOUE fda7ed4f74 feat: add support of local '.tar.gz' file inside the kaniko container 2020-03-12 22:51:30 +01:00
Yoan Blanc 53326fa0bf
executor: add --label flag
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-03-07 18:17:26 +01:00
cvgw 75f6bfe265 fix #1092 TestRelativePaths
Fix integraton test TestRelativePaths
2020-02-29 21:16:07 -08:00
Tejal Desai 7aa737c297
Merge pull request #1077 from greut/container-diff
test: refactor container-diff call
2020-02-27 21:57:42 -08:00
Yoan Blanc 8b34c99de8
fixup! integration: refactor container-diff
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-02-26 14:20:03 +01:00
Tejal Desai fb0cfd7464
Merge pull request #1049 from antechrestos/refactor/build_cache_in_integration_image_build
Refactor integration image built
2020-02-26 01:03:05 -08:00
Yoan Blanc f856b831d1
test: refactor container-diff call
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-02-26 07:00:33 +01:00
Yoan Blanc 474fdcf68d
image: fix registry mirror setup
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-02-16 11:41:51 +01:00
Yoan Blanc edc4eb33f4
Merge remote-tracking branch 'origin/master' into registry-mirror 2020-02-16 09:28:54 +01:00
Ben Einaudi 0c1d05520f Refactor integration imaqge built
The aim of this change is to hide the complexity of image not being rebuilt. Image builder won't also have to know the list of dockerfiles
2020-02-15 09:52:09 +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