diff --git a/Jenkinsfile b/Jenkinsfile index 772d43f45f..12c68d4b28 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -117,6 +117,7 @@ pipeline { -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ -e DOCKER_GRAPHDRIVER \ -e TESTDEBUG \ + -e TEST_INTEGRATION_USE_SNAPSHOTTER \ -e TEST_SKIP_INTEGRATION_CLI \ -e TIMEOUT \ -e VALIDATE_REPO=${GIT_URL} \ @@ -203,6 +204,7 @@ pipeline { --name docker-pr$BUILD_NUMBER \ -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ -e DOCKER_GRAPHDRIVER \ + -e TEST_INTEGRATION_USE_SNAPSHOTTER \ -e TEST_SKIP_INTEGRATION \ -e TIMEOUT \ -e VALIDATE_REPO=${GIT_URL} \ @@ -322,6 +324,7 @@ pipeline { -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ -e DOCKER_GRAPHDRIVER \ -e TESTDEBUG \ + -e TEST_INTEGRATION_USE_SNAPSHOTTER \ -e TEST_SKIP_INTEGRATION_CLI \ -e TIMEOUT \ -e VALIDATE_REPO=${GIT_URL} \ @@ -415,6 +418,7 @@ pipeline { --name docker-pr$BUILD_NUMBER \ -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ -e DOCKER_GRAPHDRIVER \ + -e TEST_INTEGRATION_USE_SNAPSHOTTER \ -e TEST_SKIP_INTEGRATION \ -e TIMEOUT \ -e VALIDATE_REPO=${GIT_URL} \ @@ -524,6 +528,7 @@ pipeline { -e DOCKER_GITCOMMIT=${GIT_COMMIT} \ -e DOCKER_GRAPHDRIVER \ -e TESTDEBUG \ + -e TEST_INTEGRATION_USE_SNAPSHOTTER \ -e TEST_SKIP_INTEGRATION_CLI \ -e TIMEOUT \ -e VALIDATE_REPO=${GIT_URL} \ diff --git a/Makefile b/Makefile index cfe3c17e4b..994d2d9f46 100644 --- a/Makefile +++ b/Makefile @@ -72,6 +72,7 @@ DOCKER_ENVS := \ -e GITHUB_ACTIONS \ -e TEST_FORCE_VALIDATE \ -e TEST_INTEGRATION_DIR \ + -e TEST_INTEGRATION_USE_SNAPSHOTTER \ -e TEST_SKIP_INTEGRATION \ -e TEST_SKIP_INTEGRATION_CLI \ -e TESTCOVERAGE \ diff --git a/daemon/daemon.go b/daemon/daemon.go index 272ab6bc5c..67a413806e 100644 --- a/daemon/daemon.go +++ b/daemon/daemon.go @@ -142,6 +142,10 @@ func (daemon *Daemon) Features() *map[string]bool { // UsesSnapshotter returns true if feature flag to use containerd snapshotter is enabled func (daemon *Daemon) UsesSnapshotter() bool { + // TEST_INTEGRATION_USE_SNAPSHOTTER is used for integration tests only. + if os.Getenv("TEST_INTEGRATION_USE_SNAPSHOTTER") != "" { + return true + } if daemon.configStore.Features != nil { if b, ok := daemon.configStore.Features["containerd-snapshotter"]; ok { return b @@ -982,6 +986,11 @@ func NewDaemon(ctx context.Context, config *config.Config, pluginStore *plugin.S } if d.UsesSnapshotter() { + if os.Getenv("TEST_INTEGRATION_USE_SNAPSHOTTER") != "" { + logrus.Warn("Enabling containerd snapshotter through the $TEST_INTEGRATION_USE_SNAPSHOTTER environment variable. This should only be used for testing.") + } + logrus.Info("Starting daemon with containerd snapshotter integration enabled") + // FIXME(thaJeztah): implement automatic snapshotter-selection similar to graph-driver selection; see https://github.com/moby/moby/issues/44076 if driverName == "" { driverName = containerd.DefaultSnapshotter diff --git a/hack/make/.integration-test-helpers b/hack/make/.integration-test-helpers index bbfc4edb86..b1c31b0b90 100644 --- a/hack/make/.integration-test-helpers +++ b/hack/make/.integration-test-helpers @@ -169,6 +169,7 @@ test_env() { PATH="$PATH" \ TEMP="$TEMP" \ TEST_CLIENT_BINARY="$TEST_CLIENT_BINARY" \ + TEST_INTEGRATION_USE_SNAPSHOTTER="$TEST_INTEGRATION_USE_SNAPSHOTTER" \ "$@" ) }