diff --git a/lib/config/types.ts b/lib/config/types.ts index acb4c81fdba20f..b256241bbbf4e6 100644 --- a/lib/config/types.ts +++ b/lib/config/types.ts @@ -241,7 +241,10 @@ export interface RenovateConfig constraints?: Record; } -export interface AllConfig extends RenovateConfig, GlobalOnlyConfig {} +export interface AllConfig + extends RenovateConfig, + GlobalOnlyConfig, + RepoGlobalConfig {} export interface AssigneesAndReviewersConfig { assigneesFromCodeOwners?: boolean; diff --git a/lib/modules/manager/bundler/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/bundler/__snapshots__/artifacts.spec.ts.snap index d505c7aca07114..65b76e989d6925 100644 --- a/lib/modules/manager/bundler/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/bundler/__snapshots__/artifacts.spec.ts.snap @@ -15,11 +15,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 2.3.5 && ruby --version && bundler lock --update foo bar\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 2.3.5 && ruby --version && bundler lock --update foo bar\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "GEM_HOME": "/tmp/cache/others/gem", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", @@ -51,11 +52,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -w \\"/tmp/github/some/repo\\" renovate/ruby:latest bash -l -c \\"install-tool bundler 3.2.1 && ruby --version && bundler lock --update foo bar\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:latest bash -l -c \\"install-tool bundler 3.2.1 && ruby --version && bundler lock --update foo bar\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "GEM_HOME": "/tmp/cache/others/gem", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", @@ -87,11 +89,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 1.2 && ruby --version && bundler config --local gems-private.com some-user:some-password && bundler lock --update foo bar\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 1.2 && ruby --version && bundler config --local gems-private.com some-user:some-password && bundler lock --update foo bar\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "GEM_HOME": "/tmp/cache/others/gem", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", @@ -123,11 +126,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 2.3.5 && ruby --version && bundler config set --local gems-private.com some-user:some-password && bundler lock --update foo bar\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 2.3.5 && ruby --version && bundler config set --local gems-private.com some-user:some-password && bundler lock --update foo bar\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "GEM_HOME": "/tmp/cache/others/gem", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", @@ -159,11 +163,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 2.1 && ruby --version && bundler config set --local gems-private.com some-user:some-password && bundler lock --update foo bar\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 2.1 && ruby --version && bundler config set --local gems-private.com some-user:some-password && bundler lock --update foo bar\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "GEM_HOME": "/tmp/cache/others/gem", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", @@ -195,11 +200,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUNDLE_GEMS__PRIVATE__COM -e GEM_HOME -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 2.3.5 && ruby --version && bundler lock --update foo bar\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUNDLE_GEMS__PRIVATE__COM -e GEM_HOME -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:1.2.0 bash -l -c \\"install-tool bundler 2.3.5 && ruby --version && bundler lock --update foo bar\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "BUNDLE_GEMS__PRIVATE__COM": "some-user:some-password", "GEM_HOME": "/tmp/cache/others/gem", "HOME": "/home/user", @@ -232,11 +238,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -w \\"/tmp/github/some/repo\\" renovate/ruby:latest bash -l -c \\"install-tool bundler 2.3.5 && ruby --version && bundler lock --update foo bar\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e GEM_HOME -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:latest bash -l -c \\"install-tool bundler 2.3.5 && ruby --version && bundler lock --update foo bar\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "GEM_HOME": "/tmp/cache/others/gem", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", diff --git a/lib/modules/manager/cargo/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/cargo/__snapshots__/artifacts.spec.ts.snap index 0050250b9204a8..7aace6bcdaf5cf 100644 --- a/lib/modules/manager/cargo/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/cargo/__snapshots__/artifacts.spec.ts.snap @@ -84,11 +84,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_rust --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -w \\"/tmp/github/some/repo\\" renovate/rust bash -l -c \\"cargo update --manifest-path Cargo.toml --workspace\\"", + "cmd": "docker run --rm --name=renovate_rust --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/rust bash -l -c \\"cargo update --manifest-path Cargo.toml --workspace\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", diff --git a/lib/modules/manager/cargo/artifacts.spec.ts b/lib/modules/manager/cargo/artifacts.spec.ts index 83387b6d9ddb76..df04fea219a865 100644 --- a/lib/modules/manager/cargo/artifacts.spec.ts +++ b/lib/modules/manager/cargo/artifacts.spec.ts @@ -18,6 +18,7 @@ const config: UpdateArtifactsConfig = {}; const adminConfig: RepoGlobalConfig = { // `join` fixes Windows CI localDir: join('/tmp/github/some/repo'), + cacheDir: join('/tmp/cache'), }; describe('modules/manager/cargo/artifacts', () => { diff --git a/lib/modules/manager/cocoapods/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/cocoapods/__snapshots__/artifacts.spec.ts.snap index 2c41431eddb8bf..05afd4ac9a7b86 100644 --- a/lib/modules/manager/cocoapods/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/cocoapods/__snapshots__/artifacts.spec.ts.snap @@ -9,11 +9,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -w \\"/tmp/github/some/repo\\" renovate/ruby:2.7.4 bash -l -c \\"install-tool cocoapods 1.2.4 && pod install\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:2.7.4 bash -l -c \\"install-tool cocoapods 1.2.4 && pod install\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", @@ -38,11 +39,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -w \\"/tmp/github/some/repo\\" renovate/ruby:latest bash -l -c \\"install-tool cocoapods 1.2.4 && pod install\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:latest bash -l -c \\"install-tool cocoapods 1.2.4 && pod install\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", @@ -133,11 +135,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -w \\"/tmp/github/some/repo\\" renovate/ruby:2.7.4 bash -l -c \\"install-tool cocoapods 3.1.0 && gem install cocoapods-acknowledgements && pod install\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:2.7.4 bash -l -c \\"install-tool cocoapods 3.1.0 && gem install cocoapods-acknowledgements && pod install\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", @@ -194,11 +197,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -w \\"/tmp/github/some/repo\\" renovate/ruby:2.7.4 bash -l -c \\"install-tool cocoapods 3.1.0 && pod install\\"", + "cmd": "docker run --rm --name=renovate_ruby --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/ruby:2.7.4 bash -l -c \\"install-tool cocoapods 3.1.0 && pod install\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", diff --git a/lib/modules/manager/cocoapods/artifacts.spec.ts b/lib/modules/manager/cocoapods/artifacts.spec.ts index 8494353ee784a3..5619b7760150f4 100644 --- a/lib/modules/manager/cocoapods/artifacts.spec.ts +++ b/lib/modules/manager/cocoapods/artifacts.spec.ts @@ -248,6 +248,7 @@ describe('modules/manager/cocoapods/artifacts', () => { 'docker run --rm --name=renovate_ruby --label=renovate_child ' + '-v "/tmp/github/some/repo":"/tmp/github/some/repo" ' + '-v "/tmp/cache":"/tmp/cache" ' + + '-e BUILDPACK_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + 'renovate/ruby:2.7.4' + ' bash -l -c "' + @@ -290,6 +291,7 @@ describe('modules/manager/cocoapods/artifacts', () => { 'docker run --rm --name=renovate_ruby --label=renovate_child ' + '-v "/tmp/github/some/repo":"/tmp/github/some/repo" ' + '-v "/tmp/cache":"/tmp/cache" ' + + '-e BUILDPACK_CACHE_DIR ' + '-w "/tmp/github/some/repo" ' + 'renovate/ruby:latest' + ' bash -l -c "' + diff --git a/lib/modules/manager/composer/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/composer/__snapshots__/artifacts.spec.ts.snap index 1dbb56cbdb0233..27402472d57c64 100644 --- a/lib/modules/manager/composer/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/composer/__snapshots__/artifacts.spec.ts.snap @@ -291,11 +291,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_php --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e COMPOSER_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/php:7.3 bash -l -c \\"install-tool composer 1.10.17 && composer update --with-dependencies --ignore-platform-reqs --no-ansi --no-interaction --no-scripts --no-autoloader --no-plugins\\"", + "cmd": "docker run --rm --name=renovate_php --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e COMPOSER_CACHE_DIR -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/php:7.3 bash -l -c \\"install-tool composer 1.10.17 && composer update --with-dependencies --ignore-platform-reqs --no-ansi --no-interaction --no-scripts --no-autoloader --no-plugins\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "COMPOSER_CACHE_DIR": "/tmp/renovate/cache/others/composer", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", diff --git a/lib/modules/manager/gomod/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/gomod/__snapshots__/artifacts.spec.ts.snap index 12da24004519b0..f6c9eba1f5ceed 100644 --- a/lib/modules/manager/gomod/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/gomod/__snapshots__/artifacts.spec.ts.snap @@ -287,11 +287,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_go --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e GOPROXY -e GOPRIVATE -e GONOPROXY -e GONOSUMDB -e GOINSECURE -e GOFLAGS -e CGO_ENABLED -e GIT_CONFIG_KEY_0 -e GIT_CONFIG_VALUE_0 -e GIT_CONFIG_KEY_1 -e GIT_CONFIG_VALUE_1 -e GIT_CONFIG_KEY_2 -e GIT_CONFIG_VALUE_2 -e GIT_CONFIG_COUNT -w \\"/tmp/github/some/repo\\" renovate/go:latest bash -l -c \\"go get -d -t ./...\\"", + "cmd": "docker run --rm --name=renovate_go --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e GOPROXY -e GOPRIVATE -e GONOPROXY -e GONOSUMDB -e GOINSECURE -e GOFLAGS -e CGO_ENABLED -e GIT_CONFIG_KEY_0 -e GIT_CONFIG_VALUE_0 -e GIT_CONFIG_KEY_1 -e GIT_CONFIG_VALUE_1 -e GIT_CONFIG_KEY_2 -e GIT_CONFIG_VALUE_2 -e GIT_CONFIG_COUNT -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/go:latest bash -l -c \\"go get -d -t ./...\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "CGO_ENABLED": "1", "GIT_CONFIG_COUNT": "3", "GIT_CONFIG_KEY_0": "url.https://ssh:some-token@github.com/.insteadOf", @@ -336,11 +337,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_go --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e GOPROXY -e GOPRIVATE -e GONOPROXY -e GONOSUMDB -e GOINSECURE -e GOFLAGS -e CGO_ENABLED -w \\"/tmp/github/some/repo\\" renovate/go:latest bash -l -c \\"go get -d -t ./... && go mod tidy && go mod tidy\\"", + "cmd": "docker run --rm --name=renovate_go --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e GOPROXY -e GOPRIVATE -e GONOPROXY -e GONOSUMDB -e GOINSECURE -e GOFLAGS -e CGO_ENABLED -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/go:latest bash -l -c \\"go get -d -t ./... && go mod tidy && go mod tidy\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "CGO_ENABLED": "1", "GOFLAGS": "-modcacherw", "GOINSECURE": "insecure.example.com/*", @@ -378,11 +380,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_go --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e GOPROXY -e GOPRIVATE -e GONOPROXY -e GONOSUMDB -e GOINSECURE -e GOFLAGS -e CGO_ENABLED -w \\"/tmp/github/some/repo\\" renovate/go:latest bash -l -c \\"go get -d -t ./... && go mod tidy -compat=1.17 && go mod tidy -compat=1.17\\"", + "cmd": "docker run --rm --name=renovate_go --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e GOPROXY -e GOPRIVATE -e GONOPROXY -e GONOSUMDB -e GOINSECURE -e GOFLAGS -e CGO_ENABLED -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/go:latest bash -l -c \\"go get -d -t ./... && go mod tidy -compat=1.17 && go mod tidy -compat=1.17\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "CGO_ENABLED": "1", "GOFLAGS": "-modcacherw", "GOINSECURE": "insecure.example.com/*", @@ -420,11 +423,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_go --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e GOPROXY -e GOPRIVATE -e GONOPROXY -e GONOSUMDB -e GOINSECURE -e GOFLAGS -e CGO_ENABLED -w \\"/tmp/github/some/repo\\" renovate/go:latest bash -l -c \\"go get -d -t ./...\\"", + "cmd": "docker run --rm --name=renovate_go --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e GOPROXY -e GOPRIVATE -e GONOPROXY -e GONOSUMDB -e GOINSECURE -e GOFLAGS -e CGO_ENABLED -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/go:latest bash -l -c \\"go get -d -t ./...\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "CGO_ENABLED": "1", "GOFLAGS": "-modcacherw", "GOINSECURE": "insecure.example.com/*", diff --git a/lib/modules/manager/helmv3/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/helmv3/__snapshots__/artifacts.spec.ts.snap index e5becd956fa784..afe421d1c7435a 100644 --- a/lib/modules/manager/helmv3/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/helmv3/__snapshots__/artifacts.spec.ts.snap @@ -569,11 +569,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e HELM_EXPERIMENTAL_OCI -w \\"/tmp/github/some/repo\\" renovate/sidecar bash -l -c \\"install-tool helm v3.7.2 && helm repo add repo-test --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories ''\\"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e HELM_EXPERIMENTAL_OCI -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/sidecar bash -l -c \\"install-tool helm v3.7.2 && helm repo add repo-test --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories ''\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "HELM_EXPERIMENTAL_OCI": "1", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", @@ -728,11 +729,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e HELM_EXPERIMENTAL_OCI -w \\"/tmp/github/some/repo\\" renovate/sidecar bash -l -c \\"install-tool helm v3.7.2 && helm repo add stable --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories the_stable_url && helm repo add repo1 --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories the_repo1_url && helm repo add repo-test --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories ''\\"", + "cmd": "docker run --rm --name=renovate_sidecar --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e HELM_EXPERIMENTAL_OCI -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/sidecar bash -l -c \\"install-tool helm v3.7.2 && helm repo add stable --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories the_stable_url && helm repo add repo1 --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories the_repo1_url && helm repo add repo-test --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update --registry-config /tmp/renovate/cache/__renovate-private-cache/registry.json --repository-config /tmp/renovate/cache/__renovate-private-cache/repositories.yaml --repository-cache /tmp/renovate/cache/__renovate-private-cache/repositories ''\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "HELM_EXPERIMENTAL_OCI": "1", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", diff --git a/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap index 3c532cf7d28a86..ccf9ac3c98d6b1 100644 --- a/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/mix/__snapshots__/artifacts.spec.ts.snap @@ -21,11 +21,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_elixir --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -w \\"/tmp/github/some/repo\\" renovate/elixir bash -l -c \\"mix hex.organization auth renovate_test --key valid_test_token && mix deps.update private_package other_package\\"", + "cmd": "docker run --rm --name=renovate_elixir --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/elixir bash -l -c \\"mix hex.organization auth renovate_test --key valid_test_token && mix deps.update private_package other_package\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", @@ -79,11 +80,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_elixir --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -w \\"/tmp/github/some/repo\\" renovate/elixir bash -l -c \\"mix deps.update plug\\"", + "cmd": "docker run --rm --name=renovate_elixir --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/elixir bash -l -c \\"mix deps.update plug\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", diff --git a/lib/modules/manager/mix/artifacts.spec.ts b/lib/modules/manager/mix/artifacts.spec.ts index 191a9ee6da36e8..215320c8c77bbd 100644 --- a/lib/modules/manager/mix/artifacts.spec.ts +++ b/lib/modules/manager/mix/artifacts.spec.ts @@ -15,6 +15,7 @@ jest.mock('../../../util/host-rules'); const adminConfig: RepoGlobalConfig = { // `join` fixes Windows CI localDir: join('/tmp/github/some/repo'), + cacheDir: join('/tmp/cache'), }; const config: UpdateArtifactsConfig = {}; diff --git a/lib/modules/manager/npm/post-update/yarn.spec.ts b/lib/modules/manager/npm/post-update/yarn.spec.ts index 7ac9ac6f13c026..8ffd7c3b728906 100644 --- a/lib/modules/manager/npm/post-update/yarn.spec.ts +++ b/lib/modules/manager/npm/post-update/yarn.spec.ts @@ -44,7 +44,7 @@ describe('modules/manager/npm/post-update/yarn', () => { jest.clearAllMocks(); Fixtures.reset(); docker.resetPrefetchedImages(); - GlobalConfig.set({ localDir: '.' }); + GlobalConfig.set({ localDir: '.', cacheDir: '/tmp/cache' }); }); it.each([ @@ -62,7 +62,7 @@ describe('modules/manager/npm/post-update/yarn', () => { }, '/some-dir' ); - GlobalConfig.set({ localDir: '/' }); + GlobalConfig.set({ localDir: '/', cacheDir: '/tmp/cache' }); const execSnapshots = mockExecAll(exec, { stdout: yarnVersion, stderr: '', @@ -112,7 +112,11 @@ describe('modules/manager/npm/post-update/yarn', () => { }); it('allows and ignore scripts', async () => { - GlobalConfig.set({ localDir: '.', allowScripts: true }); + GlobalConfig.set({ + localDir: '.', + allowScripts: true, + cacheDir: '/tmp/cache', + }); Fixtures.mock( { 'yarn.lock': 'package-lock-contents', @@ -352,7 +356,11 @@ describe('modules/manager/npm/post-update/yarn', () => { it('supports corepack', async () => { process.env.BUILDPACK = 'true'; - GlobalConfig.set({ localDir: '.', binarySource: 'install' }); + GlobalConfig.set({ + localDir: '.', + binarySource: 'install', + cacheDir: '/tmp/cache', + }); Fixtures.mock( { 'package.json': '{ "packageManager": "yarn@3.0.0" }', @@ -395,7 +403,11 @@ describe('modules/manager/npm/post-update/yarn', () => { // sanity check for later refactorings expect(plocktest1YarnLockV1).toBeTruthy(); process.env.BUILDPACK = 'true'; - GlobalConfig.set({ localDir: '.', binarySource: 'install' }); + GlobalConfig.set({ + localDir: '.', + binarySource: 'install', + cacheDir: '/tmp/cache', + }); Fixtures.mock( { 'package.json': @@ -429,7 +441,7 @@ describe('modules/manager/npm/post-update/yarn', () => { // sanity check for later refactorings expect(plocktest1YarnLockV1).toBeTruthy(); expect(plocktest1PackageJson).toBeTruthy(); - GlobalConfig.set({ localDir: '.' }); + GlobalConfig.set({ localDir: '.', cacheDir: '/tmp/cache' }); Fixtures.mock( { 'package.json': plocktest1PackageJson, @@ -467,7 +479,11 @@ describe('modules/manager/npm/post-update/yarn', () => { // sanity check for later refactorings expect(plocktest1YarnLockV1).toBeTruthy(); expect(plocktest1PackageJson).toBeTruthy(); - GlobalConfig.set({ localDir: '.', binarySource: 'docker' }); + GlobalConfig.set({ + localDir: '.', + binarySource: 'docker', + cacheDir: '/tmp/cache', + }); Fixtures.mock( { 'package.json': plocktest1PackageJson, @@ -489,7 +505,7 @@ describe('modules/manager/npm/post-update/yarn', () => { { cmd: 'docker pull renovate/node', options }, { cmd: - `docker run --rm --name=renovate_node --label=renovate_child -v ".":"." -e CI -w "some-dir" renovate/node ` + + `docker run --rm --name=renovate_node --label=renovate_child -v ".":"." -v "/tmp/cache":"/tmp/cache" -e CI -e BUILDPACK_CACHE_DIR -w "some-dir" renovate/node ` + `bash -l -c "` + `install-tool yarn-slim 1.22.18` + ` && ` + @@ -512,7 +528,7 @@ describe('modules/manager/npm/post-update/yarn', () => { }, '/' ); - GlobalConfig.set({ localDir: '/tmp/renovate' }); + GlobalConfig.set({ localDir: '/tmp/renovate', cacheDir: '/tmp/cache' }); expect(await yarnHelper.checkYarnrc('.')).toEqual({ offlineMirror: true, yarnPath: '.yarn/cli.js', @@ -540,7 +556,7 @@ describe('modules/manager/npm/post-update/yarn', () => { }, '/' ); - GlobalConfig.set({ localDir: '/tmp/renovate' }); + GlobalConfig.set({ localDir: '/tmp/renovate', cacheDir: '/tmp/cache' }); expect(await yarnHelper.checkYarnrc('.')).toEqual({ offlineMirror: true, yarnPath: null, @@ -555,7 +571,7 @@ describe('modules/manager/npm/post-update/yarn', () => { }, '/' ); - GlobalConfig.set({ localDir: '/tmp' }); + GlobalConfig.set({ localDir: '/tmp', cacheDir: '/tmp/cache' }); expect(await yarnHelper.checkYarnrc('renovate')).toEqual({ offlineMirror: false, yarnPath: null, @@ -569,7 +585,7 @@ describe('modules/manager/npm/post-update/yarn', () => { }, '/tmp/renovate' ); - GlobalConfig.set({ localDir: '/tmp/renovate' }); + GlobalConfig.set({ localDir: '/tmp/renovate', cacheDir: '/tmp/cache' }); const { offlineMirror, yarnPath } = await yarnHelper.checkYarnrc('.'); expect(offlineMirror).toBeFalse(); expect(yarnPath).toBeNull(); diff --git a/lib/modules/manager/nuget/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/nuget/__snapshots__/artifacts.spec.ts.snap index 259826a3c51bdf..8b5d0c0a5fc3c9 100644 --- a/lib/modules/manager/nuget/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/nuget/__snapshots__/artifacts.spec.ts.snap @@ -149,11 +149,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_dotnet --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e NUGET_PACKAGES -w \\"/tmp/github/some/repo\\" renovate/dotnet bash -l -c \\"dotnet restore project.csproj --force-evaluate --configfile /tmp/renovate/cache/__renovate-private-cache/nuget/nuget.config\\"", + "cmd": "docker run --rm --name=renovate_dotnet --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e NUGET_PACKAGES -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/dotnet bash -l -c \\"dotnet restore project.csproj --force-evaluate --configfile /tmp/renovate/cache/__renovate-private-cache/nuget/nuget.config\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", diff --git a/lib/modules/manager/pip-compile/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/pip-compile/__snapshots__/artifacts.spec.ts.snap index 204395ba0adfa2..9bd760cce96e1b 100644 --- a/lib/modules/manager/pip-compile/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/pip-compile/__snapshots__/artifacts.spec.ts.snap @@ -84,11 +84,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pip-tools && pip-compile requirements.in\\"", + "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pip-tools && pip-compile requirements.in\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", @@ -119,11 +120,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pip-tools1.2.3 && pip-compile requirements.in\\"", + "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pip-tools1.2.3 && pip-compile requirements.in\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", diff --git a/lib/modules/manager/pipenv/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/pipenv/__snapshots__/artifacts.spec.ts.snap index ae00bd4ad3e2ec..79eb5b549ac8f6 100644 --- a/lib/modules/manager/pipenv/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/pipenv/__snapshots__/artifacts.spec.ts.snap @@ -111,11 +111,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e PIPENV_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python:latest bash -l -c \\"pip install --user pipenv && pipenv lock\\"", + "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python:latest bash -l -c \\"pip install --user pipenv && pipenv lock\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", @@ -147,11 +148,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e PIPENV_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pipenv==2020.8.13 && pipenv lock\\"", + "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pipenv==2020.8.13 && pipenv lock\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", @@ -183,11 +185,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e PIPENV_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pipenv==2020.8.13 && pipenv lock\\"", + "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pipenv==2020.8.13 && pipenv lock\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", @@ -219,11 +222,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e PIPENV_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pipenv==2020.1.1 && pipenv lock\\"", + "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/renovate/cache\\":\\"/tmp/renovate/cache\\" -e PIPENV_CACHE_DIR -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python bash -l -c \\"pip install --user pipenv==2020.1.1 && pipenv lock\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/renovate/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", diff --git a/lib/modules/manager/poetry/__snapshots__/artifacts.spec.ts.snap b/lib/modules/manager/poetry/__snapshots__/artifacts.spec.ts.snap index 5b31c037125134..0fd3a97eee973e 100644 --- a/lib/modules/manager/poetry/__snapshots__/artifacts.spec.ts.snap +++ b/lib/modules/manager/poetry/__snapshots__/artifacts.spec.ts.snap @@ -124,11 +124,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -w \\"/tmp/github/some/repo\\" renovate/python:2.7.5 bash -l -c \\"install-tool poetry 1.2.0 && poetry update --lock --no-interaction dep1\\"", + "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python:2.7.5 bash -l -c \\"install-tool poetry 1.2.0 && poetry update --lock --no-interaction dep1\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", @@ -159,11 +160,12 @@ Array [ }, }, Object { - "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -w \\"/tmp/github/some/repo\\" renovate/python:3.4.2 bash -l -c \\"install-tool poetry 1.2.0 && poetry update --lock --no-interaction dep1\\"", + "cmd": "docker run --rm --name=renovate_python --label=renovate_child -v \\"/tmp/github/some/repo\\":\\"/tmp/github/some/repo\\" -v \\"/tmp/cache\\":\\"/tmp/cache\\" -e BUILDPACK_CACHE_DIR -w \\"/tmp/github/some/repo\\" renovate/python:3.4.2 bash -l -c \\"install-tool poetry 1.2.0 && poetry update --lock --no-interaction dep1\\"", "options": Object { "cwd": "/tmp/github/some/repo", "encoding": "utf-8", "env": Object { + "BUILDPACK_CACHE_DIR": "/tmp/cache/buildpack", "HOME": "/home/user", "HTTPS_PROXY": "https://example.com", "HTTP_PROXY": "http://example.com", diff --git a/lib/modules/manager/poetry/artifacts.spec.ts b/lib/modules/manager/poetry/artifacts.spec.ts index 4b65af6b6325bd..073b1d98905a48 100644 --- a/lib/modules/manager/poetry/artifacts.spec.ts +++ b/lib/modules/manager/poetry/artifacts.spec.ts @@ -26,6 +26,7 @@ const hostRules = mocked(_hostRules); const adminConfig: RepoGlobalConfig = { localDir: join('/tmp/github/some/repo'), + cacheDir: join('/tmp/cache'), }; const config: UpdateArtifactsConfig = {}; diff --git a/lib/util/exec/env.ts b/lib/util/exec/env.ts index 7fef55acf6f7ac..6c610c509e540a 100644 --- a/lib/util/exec/env.ts +++ b/lib/util/exec/env.ts @@ -21,7 +21,7 @@ export function getChildProcessEnv( ): NodeJS.ProcessEnv { const env: NodeJS.ProcessEnv = {}; if (GlobalConfig.get('exposeAllEnv')) { - return { ...env, ...process.env }; + return { ...process.env }; } const envVars = [...basicEnvVars, ...customEnvVars]; envVars.forEach((envVar) => { diff --git a/lib/util/exec/index.spec.ts b/lib/util/exec/index.spec.ts index 61fe5ed66b9ae1..50c13be64ee7a9 100644 --- a/lib/util/exec/index.spec.ts +++ b/lib/util/exec/index.spec.ts @@ -31,7 +31,10 @@ describe('util/exec/index', () => { const cwd = '/tmp/renovate/github/some/repo/'; const defaultCwd = `-w "${cwd}"`; - const defaultVolumes = `-v "${cwd}":"${cwd}" -v "${cacheDir}":"${cacheDir}"`; + const defaultCacheVolume = `-v "${cacheDir}":"${cacheDir}"`; + const defaultVolumes = `-v "${cwd}":"${cwd}" ${defaultCacheVolume}`; + + const globalConfig: RepoGlobalConfig = { cacheDir }; beforeEach(() => { dockerModule.resetPrefetchedImages(); @@ -69,6 +72,15 @@ describe('util/exec/index', () => { const dockerPullOpts = { encoding }; const dockerRemoveOpts = dockerPullOpts; + const buildpackEnv = { + ...envMock.basic, + BUILDPACK_CACHE_DIR: `${cacheDir}buildpack`, + }; + const buildpackEnvFiltered = { + ...envMock.filtered, + BUILDPACK_CACHE_DIR: `${cacheDir}buildpack`, + }; + const testInputs: [string, TestInput][] = [ [ 'Single command', @@ -189,7 +201,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e BUILDPACK_CACHE_DIR ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -197,7 +209,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 900000, maxBuffer: 10485760, }, @@ -224,7 +236,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.filtered, + env: buildpackEnvFiltered, timeout: 900000, maxBuffer: 10485760, }, @@ -251,7 +263,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e SELECTED_ENV_VAR ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e SELECTED_ENV_VAR -e BUILDPACK_CACHE_DIR ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -259,7 +271,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.filtered, + env: buildpackEnvFiltered, timeout: 900000, maxBuffer: 10485760, }, @@ -279,7 +291,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: { ...envMock.basic, SELECTED_ENV_VAR: 'Default value' }, + env: { ...buildpackEnv, SELECTED_ENV_VAR: 'Default value' }, timeout: 900000, maxBuffer: 10485760, }, @@ -301,7 +313,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e SELECTED_ENV_VAR ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e SELECTED_ENV_VAR -e BUILDPACK_CACHE_DIR ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -309,7 +321,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: { ...envMock.basic, SELECTED_ENV_VAR: 'Default value' }, + env: { ...buildpackEnv, SELECTED_ENV_VAR: 'Default value' }, timeout: 900000, maxBuffer: 10485760, }, @@ -327,7 +339,7 @@ describe('util/exec/index', () => { outCmd: [ `${dockerPullCmd}:${tag}`, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} ${defaultCwd} ${fullImage}:${tag} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e BUILDPACK_CACHE_DIR ${defaultCwd} ${fullImage}:${tag} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -335,7 +347,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 900000, maxBuffer: 10485760, }, @@ -353,7 +365,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -v "${volume_1}":"${volume_1}" -v "${volume_2_from}":"${volume_2_to}" -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -v "${volume_1}":"${volume_1}" -v "${volume_2_from}":"${volume_2_to}" -e BUILDPACK_CACHE_DIR -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -361,7 +373,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 900000, maxBuffer: 10485760, }, @@ -379,7 +391,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child --user=foobar ${defaultVolumes} -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child --user=foobar ${defaultVolumes} -e BUILDPACK_CACHE_DIR -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -387,7 +399,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 900000, maxBuffer: 10485760, }, @@ -408,7 +420,7 @@ describe('util/exec/index', () => { outCmd: [ `docker pull ghcr.io/renovatebot/image`, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -w "${cwd}" ghcr.io/renovatebot/image bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e BUILDPACK_CACHE_DIR -w "${cwd}" ghcr.io/renovatebot/image bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -416,7 +428,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 900000, maxBuffer: 10485760, }, @@ -437,7 +449,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, `docker ps --filter name=myprefix_${image} -aq`, - `docker run --rm --name=myprefix_${image} --label=myprefix_child ${defaultVolumes} -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, + `docker run --rm --name=myprefix_${image} --label=myprefix_child ${defaultVolumes} -e BUILDPACK_CACHE_DIR -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -445,7 +457,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 900000, maxBuffer: 10485760, }, @@ -471,7 +483,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -w "${cwd}" ${fullImage} bash -l -c "preCommand1 && preCommand2 && ${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e BUILDPACK_CACHE_DIR -w "${cwd}" ${fullImage} bash -l -c "preCommand1 && preCommand2 && ${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -479,7 +491,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 900000, maxBuffer: 10485760, }, @@ -501,7 +513,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e BUILDPACK_CACHE_DIR -w "${cwd}" ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -509,7 +521,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 900000, maxBuffer: 10485760, }, @@ -531,7 +543,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 20 * 60 * 1000, maxBuffer: 10485760, }, @@ -573,7 +585,7 @@ describe('util/exec/index', () => { { cwd, encoding, - env: envMock.basic, + env: buildpackEnv, timeout: 900000, maxBuffer: 1024, }, @@ -593,7 +605,10 @@ describe('util/exec/index', () => { { cwd, encoding, - env: { ...envMock.basic, CUSTOM_KEY: 'CUSTOM_VALUE' }, + env: { + ...buildpackEnv, + CUSTOM_KEY: 'CUSTOM_VALUE', + }, timeout: 900000, maxBuffer: 10485760, }, @@ -618,7 +633,10 @@ describe('util/exec/index', () => { { cwd, encoding, - env: { ...envMock.basic, CUSTOM_KEY: 'CUSTOM_OVERRIDEN_VALUE' }, + env: { + ...buildpackEnv, + CUSTOM_KEY: 'CUSTOM_OVERRIDEN_VALUE', + }, timeout: 900000, maxBuffer: 10485760, }, @@ -641,7 +659,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e CUSTOM_KEY ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e CUSTOM_KEY -e BUILDPACK_CACHE_DIR ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -649,7 +667,10 @@ describe('util/exec/index', () => { { cwd, encoding, - env: { ...envMock.basic, CUSTOM_KEY: 'CUSTOM_VALUE' }, + env: { + ...buildpackEnv, + CUSTOM_KEY: 'CUSTOM_VALUE', + }, timeout: 900000, maxBuffer: 10485760, }, @@ -672,7 +693,7 @@ describe('util/exec/index', () => { outCmd: [ dockerPullCmd, dockerRemoveCmd, - `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e CUSTOM_KEY ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, + `docker run --rm --name=${name} --label=renovate_child ${defaultVolumes} -e CUSTOM_KEY -e BUILDPACK_CACHE_DIR ${defaultCwd} ${fullImage} bash -l -c "${inCmd}"`, ], outOpts: [ dockerPullOpts, @@ -680,7 +701,10 @@ describe('util/exec/index', () => { { cwd, encoding, - env: { ...envMock.basic, CUSTOM_KEY: 'CUSTOM_OVERRIDEN_VALUE' }, + env: { + ...buildpackEnv, + CUSTOM_KEY: 'CUSTOM_OVERRIDEN_VALUE', + }, timeout: 900000, maxBuffer: 10485760, }, @@ -715,7 +739,7 @@ describe('util/exec/index', () => { callback(null, { stdout: '', stderr: '' }); return undefined as never; }); - GlobalConfig.set({ cacheDir, localDir: cwd, ...adminConfig }); + GlobalConfig.set({ ...globalConfig, localDir: cwd, ...adminConfig }); await exec(cmd as string, inOpts); expect(actualCmd).toEqual(outCommand); @@ -732,19 +756,19 @@ describe('util/exec/index', () => { return undefined as never; }); - GlobalConfig.set({ binarySource: 'global' }); + GlobalConfig.set({ ...globalConfig, binarySource: 'global' }); await exec(inCmd, { docker }); await exec(inCmd, { docker }); - GlobalConfig.set({ binarySource: 'docker' }); + GlobalConfig.set({ ...globalConfig, binarySource: 'docker' }); await exec(inCmd, { docker }); await exec(inCmd, { docker }); - GlobalConfig.set({ binarySource: 'global' }); + GlobalConfig.set({ ...globalConfig, binarySource: 'global' }); await exec(inCmd, { docker }); await exec(inCmd, { docker }); - GlobalConfig.set({ binarySource: 'docker' }); + GlobalConfig.set({ ...globalConfig, binarySource: 'docker' }); await exec(inCmd, { docker }); await exec(inCmd, { docker }); @@ -753,15 +777,15 @@ describe('util/exec/index', () => { `echo hello`, `docker pull renovate/image`, `docker ps --filter name=renovate_image -aq`, - `docker run --rm --name=renovate_image --label=renovate_child renovate/image bash -l -c "echo hello"`, + `docker run --rm --name=renovate_image --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR renovate/image bash -l -c "echo hello"`, `docker ps --filter name=renovate_image -aq`, - `docker run --rm --name=renovate_image --label=renovate_child renovate/image bash -l -c "echo hello"`, + `docker run --rm --name=renovate_image --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR renovate/image bash -l -c "echo hello"`, `echo hello`, `echo hello`, `docker ps --filter name=renovate_image -aq`, - `docker run --rm --name=renovate_image --label=renovate_child renovate/image bash -l -c "echo hello"`, + `docker run --rm --name=renovate_image --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR renovate/image bash -l -c "echo hello"`, `docker ps --filter name=renovate_image -aq`, - `docker run --rm --name=renovate_image --label=renovate_child renovate/image bash -l -c "echo hello"`, + `docker run --rm --name=renovate_image --label=renovate_child ${defaultCacheVolume} -e BUILDPACK_CACHE_DIR renovate/image bash -l -c "echo hello"`, ]); }); @@ -770,7 +794,7 @@ describe('util/exec/index', () => { cpExec.mockImplementation(() => { throw new Error('some error occurred'); }); - GlobalConfig.set({ binarySource: 'install' }); + GlobalConfig.set({ ...globalConfig, binarySource: 'install' }); process.env.BUILDPACK = 'true'; const promise = exec('foobar', { toolConstraints: [{ toolName: 'npm' }] }); await expect(promise).rejects.toThrow('No tool releases found.'); @@ -792,7 +816,7 @@ describe('util/exec/index', () => { }); it('wraps error if removeDockerContainer throws an error', async () => { - GlobalConfig.set({ binarySource: 'docker' }); + GlobalConfig.set({ ...globalConfig, binarySource: 'docker' }); cpExec.mockImplementation(() => { throw new Error('some error occurred'); }); diff --git a/lib/util/exec/index.ts b/lib/util/exec/index.ts index 0bbd94e620290d..7470f4968c83b8 100644 --- a/lib/util/exec/index.ts +++ b/lib/util/exec/index.ts @@ -100,7 +100,13 @@ async function prepareRawExec( opts: ExecOptions = {} ): Promise { const { docker } = opts; - const { customEnvVariables } = GlobalConfig.get(); + const { customEnvVariables, cacheDir, binarySource } = GlobalConfig.get(); + + if (binarySource === 'docker' || binarySource === 'install') { + const buildPackCacheDir = upath.join(cacheDir, 'buildpack'); + opts.env ??= {}; + opts.env.BUILDPACK_CACHE_DIR = buildPackCacheDir; + } const rawOptions = getRawExecOptions(opts); @@ -108,9 +114,15 @@ async function prepareRawExec( if (isDocker(docker)) { logger.debug({ image: docker.image }, 'Using docker to execute'); - const extraEnv = { ...opts.extraEnv, ...customEnvVariables }; + const extraEnv = { + ...opts.extraEnv, + ...customEnvVariables, + }; const childEnv = getChildEnv(opts); - const envVars = dockerEnvVars(extraEnv, childEnv); + const envVars = [ + ...dockerEnvVars(extraEnv, childEnv), + 'BUILDPACK_CACHE_DIR', + ]; const cwd = getCwd(opts); const dockerOptions: DockerOptions = { ...docker, cwd, envVars }; const preCommands = [ diff --git a/lib/workers/global/config/parse/env.spec.ts b/lib/workers/global/config/parse/env.spec.ts index 6663906b331c9b..b00d71a437ad76 100644 --- a/lib/workers/global/config/parse/env.spec.ts +++ b/lib/workers/global/config/parse/env.spec.ts @@ -289,7 +289,7 @@ describe('workers/global/config/parse/env', () => { RENOVATE_DRY_RUN: 'false', }; const config = env.getConfig(envParam); - expect(config.dryRun).toBeNull(); + expect(config.dryRun).toBeUndefined(); }); it('dryRun null', () => { @@ -297,7 +297,7 @@ describe('workers/global/config/parse/env', () => { RENOVATE_DRY_RUN: 'null', }; const config = env.getConfig(envParam); - expect(config.dryRun).toBeNull(); + expect(config.dryRun).toBeUndefined(); }); it('requireConfig boolean true', () => { diff --git a/lib/workers/global/config/parse/env.ts b/lib/workers/global/config/parse/env.ts index 0b9c1fef7750c5..6bf497366b420b 100644 --- a/lib/workers/global/config/parse/env.ts +++ b/lib/workers/global/config/parse/env.ts @@ -108,18 +108,18 @@ export function getConfig(inputEnv: NodeJS.ProcessEnv): AllConfig { const coerce = coersions[option.type]; config[option.name] = coerce(envVal); if (option.name === 'dryRun') { - if (config[option.name] === 'true') { + if ((config[option.name] as string) === 'true') { logger.warn( 'env config dryRun property has been changed to full' ); config[option.name] = 'full'; - } else if (config[option.name] === 'false') { + } else if ((config[option.name] as string) === 'false') { logger.warn( 'env config dryRun property has been changed to null' ); - config[option.name] = null; - } else if (config[option.name] === 'null') { - config[option.name] = null; + delete config[option.name]; + } else if ((config[option.name] as string) === 'null') { + delete config[option.name]; } } if (option.name === 'requireConfig') { diff --git a/lib/workers/global/initialize.spec.ts b/lib/workers/global/initialize.spec.ts index 27df1dca77973a..f0ba565956eb04 100644 --- a/lib/workers/global/initialize.spec.ts +++ b/lib/workers/global/initialize.spec.ts @@ -1,10 +1,16 @@ -import { git } from '../../../test/util'; -import type { RenovateConfig } from '../../config/types'; +import { git, mockedFunction } from '../../../test/util'; +import type { AllConfig, RenovateConfig } from '../../config/types'; +import { initPlatform as _initPlatform } from '../../modules/platform'; import { globalInitialize } from './initialize'; jest.mock('../../util/git'); +const initPlatform = mockedFunction(_initPlatform); describe('workers/global/initialize', () => { + beforeEach(() => { + initPlatform.mockImplementationOnce((r) => Promise.resolve(r)); + }); + describe('checkVersions()', () => { it('throws if invalid version', async () => { const config: RenovateConfig = {}; @@ -13,7 +19,13 @@ describe('workers/global/initialize', () => { }); it('returns if valid git version', async () => { - const config: RenovateConfig = {}; + const config: RenovateConfig = { prCommitsPerRunLimit: 2 }; + git.validateGitVersion.mockResolvedValueOnce(true); + await expect(globalInitialize(config)).toResolve(); + }); + + it('supports buildpack', async () => { + const config: AllConfig = { binarySource: 'docker' }; git.validateGitVersion.mockResolvedValueOnce(true); await expect(globalInitialize(config)).toResolve(); }); diff --git a/lib/workers/global/initialize.ts b/lib/workers/global/initialize.ts index 81d603f34cd9dc..c0ec8e4338432d 100644 --- a/lib/workers/global/initialize.ts +++ b/lib/workers/global/initialize.ts @@ -28,6 +28,9 @@ async function setDirectories(input: AllConfig): Promise { logger.debug('Using cacheDir: ' + config.cacheDir); } await fs.ensureDir(config.cacheDir); + if (config.binarySource === 'docker' || config.binarySource === 'install') { + await fs.ensureDir(upath.join(config.cacheDir, 'buildpack')); + } return config; } @@ -53,7 +56,7 @@ function setGlobalHostRules(config: RenovateConfig): void { } export async function globalInitialize( - config_: RenovateConfig + config_: AllConfig ): Promise { let config = config_; await checkVersions();