Commit Graph

132 Commits

Author SHA1 Message Date
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
Aris Buzachis 61312a95ae
fix(WORKDIR): use the config.User for the new dir permissions (#2269)
WORKDIR ignores the currently set USER and creates the new directories
with the root user ownership.

This changes that, by executing a chown after the mkdir if needed, and
also handle the case where the provided USER is an uid and the passwd
file is not available to resolve to the username.

Fixes #2259

Signed-off-by: Aris Buzachis <buzachis.aris@gmail.com>

Signed-off-by: Aris Buzachis <buzachis.aris@gmail.com>
2022-09-28 21:18:40 -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
Gabriel Nützi 90e426ba3f
refactor: Make CLI argument names consistent (#2084)
* fix: Wrong argument naming

* fix: tarPath as well

* Test

* fix: Fix tests

* np: Format markdown

* fix: Review changes
2022-08-22 09:10:11 -04:00
Lukas aad03dc285
fix: getUIDandGID is able to resolve non-existing users and groups (#2106)
* fix: getUIDandGID is able to resolve non-existing users and groups

A common pattern in dockerfiles is to provide a plain uid and gid number, which doesn't neccesarily exist inside the os.

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* test: add chown dockerfile

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* chore: format

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* chore: add comment

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* tests: fix chown dockerfile

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* refactor: split up getIdsFromUsernameAndGroup func

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* fix: implement raw uid logic for LookupUser

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* test: add dockerfiles for integration test

* fix: lookup user error message

* test: add dockerfiles for non-existing user testcase

* fix: forgot error check

* tests: fix syscall credentials test

* chore: add debug output for copy command

* tests: set specific gid for integration dockerfile

* tests: fix syscall credentials test

github runner had the exact uid that i was testing on, so the groups were not empty

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* tests: fix test script

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* chore: apply golangci lint checks

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* fix: reset file ownership in createFile if not root owned

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* chore: logrus.Debugf missed format variable

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* chore(test-script): remove go html coverage

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>

* test(k8s): increase wait timeout

Signed-off-by: Höhl, Lukas <lukas.hoehl@accso.de>
2022-07-12 10:21:37 -04:00
Gabriel Nützi c13f9b6027
fix: Add test for issue #2049 (#2114)
- This missing files problem should be fixed by PR #2066.
2022-06-01 06:55:36 -04:00
Gabriel Nützi 2789b974b9
fix: Regression test for #2066 (#2096)
* fix: Regression test for #2066

- Test `Dockerfile_test_issue_2066` fails on main@28432d3c

* np: Comment
2022-05-18 06:35:35 -04:00
Gabriel Nützi 28432d3c84
fix(ci): Docker build for issue 1837 (#2095)
* fix: Docker build for issue 1837

* fix: Linting
2022-05-17 14:21:57 -04:00
Gabriel Nützi 2d94d56af7
Fix resolving arguments over multi-stage build (#1928)
* Fix resolving argument over mulit-stage build

- Building multi-stage Dockerfiles did not correctly resolve
  ARG commands over different stages. Now, each stage depends on the
  build arguments set by the stage before.

Closes: #1911

* Fix resolving empty arg commands
2022-02-10 09:22:21 -08:00
François JACQUES 5c81fa5774
Fixes #1837 : keep file capabilities on archival (#1838)
Signed-off-by: JACQUES Francois <hypnoce@donarproject.org>
2021-12-22 20:05:39 -05: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
Kamal Nasser f21639daac
Fix snapshotter ignore list; do not attempt to delete whiteouts of ignored paths (#1652)
* avoid deleting whiteouts if they are in ignore list

* fix snapshotter ignore list

* include filesystem mounts in ignorelist of snapshotter
* clean up ignore list logic

* add unit and integration tests for #1652

* fix tests and ignore list updates
2021-06-04 10:07:24 -07:00
Tinjo Schöni 5f4e2f1366
Fix .dockerignore for build context copies in later stages (#1447)
* Extend .dockerignore integration test with copies in later stages

.dockerignore should continue to apply when copying from the build context in later stages, but it currently doesn't

* Replace excluded global with passed along FileContext struct

This new FileContext struct allows much cleaner handling of context specific file exclusions.
The global excluded file state is no longer needed.

Additionally this also fixes the issue where excluded files aren't being applied for build context copies in later build stages.
2020-10-08 12:47:14 -07:00
Yoan Blanc ca23ae441e
add should fail on 40x
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-06-20 09:49:11 +02:00
Tejal Desai 4ac51ef515 merge 2020-06-06 20:17:17 -07:00
Tejal Desai 35d2358482 add integration tests 2020-06-06 00:53:08 -07:00
Tejal Desai 2a7d33526b lint 2020-06-06 00:30:07 -07:00
Tejal Desai 43338d4b2f add a new run command along with a new flag 2020-06-05 19:53:16 -07: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 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 5e275d9824 Apply dockefile exclude only for first stage 2020-05-05 21:45:36 -07:00
Tejal Desai c6a98b754a
Make sure integration test has a relative workdir 2020-05-04 09:48:09 -07:00
Tejal Desai e32715ef55
Merge pull request #1164 from tstromberg/add-groups
Add secondary group impersonation w/ !cgo support
2020-05-03 22:00:36 -07:00
Tejal Desai ae11db43d7
Merge pull request #1193 from tp-tc/dangling-symlink
Ignore the target of dangling symlinks.
2020-05-03 20:47:12 -07:00
Tejal Desai a2af3272cf
Merge pull request #1192 from tp-tc/snapshot-maintainers
Handle `MAINTAINERS` when passing `--single-snapshot`.
2020-05-03 20:45:48 -07:00
Tom Prince c520218cec Don't generate cache key, if not caching builds.
The cache key generation does environment subsitution in places that running
the commands doesn't. This causes issues if a command uses complex shell
substitutions. The cache key is generated even if caching isn't enabled.

This disables the cache key generation if caching is not enabled. This doesn't
fix the underlying issue, but limits it to when the cache is being used.
2020-04-13 16:50:13 -06:00
Tom Prince 5061b72e42 Ignore the target of dangling symlinks. 2020-04-13 16:26:19 -06:00
Tom Prince 484d03550c Handle `MAINTAINERS` when passing `--single-snapshot`. 2020-04-13 15:54:27 -06:00
Thomas Stromberg a6504769e3 Add secondary group impersonation w/ !cgo support 2020-03-28 22:01:20 -07:00
Tejal Desai 2181c5e6f5 create correct link across Multistage builds 2020-03-07 11:28:16 -08:00
Yoan Blanc c7028c6d2f
run: user LookupId
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-03-05 16:44:55 +01:00
Tejal Desai 9e83210b07 Rebase over 1105 2020-03-04 14:16:24 -08:00
Yoan Blanc 55361b2998 fixup! fixup! integration: test user fancy home
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-03-04 14:14:21 -08:00
Yoan Blanc c8d2cb7071 fixup! integration: test user fancy home
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-03-04 14:14:21 -08:00
Yoan Blanc bfeb40d600 integration: test user fancy home
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-03-04 14:14:21 -08:00
Yoan Blanc 0c6571a1fc integration: test case for HOME
Signed-off-by: Yoan Blanc <yoan@dosimple.ch>
2020-03-04 14:11:49 -08:00
Tejal Desai bc399d9257 remove accessing user dir 2020-03-04 13:43:23 -08:00
Tejal Desai c1e3f42625 fix user metadata string 2020-03-04 13:08:38 -08:00
Cole Wippern 17ceb312c6
Merge pull request #1054 from cvgw/u/cgwippern/integration-tests-from-issues
Add integration tests from Issues
2020-03-03 11:47:23 -08:00
cvgw 75f6bfe265 fix #1092 TestRelativePaths
Fix integraton test TestRelativePaths
2020-02-29 21:16:07 -08:00
cvgw 5651ff8c92 remove failing tests, add later 2020-02-29 15:39:51 -08:00
cvgw 9f18d8006c add integration tests from GH issues 2020-02-27 11:04:55 -08:00
cvgw a675ad998a Resolve filepaths before scanning for changes 2020-02-20 09:45:44 -08:00
cvgw 61bcba23f2 Fix #1067 - image no longer available
replace the tenstartups/alpine image with the canonical alpine image in
our integration tests as the former is no longer available
2020-02-20 08:40:38 -08: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
Tejal Desai 2cd68d2e2f fix flake in copy symlink 2020-02-05 14:40:52 -08:00
Ben Einaudi 2f1e54e591 Expand build argument from environment when no value specified
Fixes #713
2020-01-30 12:01:06 +01:00
Tejal Desai 47ab3fe997
Merge branch 'master' into registry-mirror 2020-01-29 11:42:06 -08:00