Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(helmv3): add --force-update when adding a repo #26512

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions lib/modules/manager/helmv3/__snapshots__/artifacts.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
exports[`modules/manager/helmv3/artifacts alias name is picked, when repository is as alias and dependency defined 1`] = `
[
{
"cmd": "helm repo add repo1 https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --username basicUser --password secret",
"cmd": "helm repo add repo1 https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update --username basicUser --password secret",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -52,7 +52,7 @@ exports[`modules/manager/helmv3/artifacts alias name is picked, when repository
exports[`modules/manager/helmv3/artifacts do not add registryAliases to repository list 1`] = `
[
{
"cmd": "helm repo add jetstack https://charts.jetstack.io",
"cmd": "helm repo add jetstack https://charts.jetstack.io --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand All @@ -74,7 +74,7 @@ exports[`modules/manager/helmv3/artifacts do not add registryAliases to reposito
},
},
{
"cmd": "helm repo add nginx https://kubernetes.github.io/ingress-nginx",
"cmd": "helm repo add nginx https://kubernetes.github.io/ingress-nginx --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -145,7 +145,7 @@ exports[`modules/manager/helmv3/artifacts log into private registries and reposi
},
},
{
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --username basicUser --password secret",
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update --username basicUser --password secret",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -216,7 +216,7 @@ exports[`modules/manager/helmv3/artifacts log into private registries and reposi
},
},
{
"cmd": "helm repo add stable the_stable_url",
"cmd": "helm repo add stable the_stable_url --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand All @@ -238,7 +238,7 @@ exports[`modules/manager/helmv3/artifacts log into private registries and reposi
},
},
{
"cmd": "helm repo add repo1 https://the_repo1_url --username basicUser --password secret",
"cmd": "helm repo add repo1 https://the_repo1_url --force-update --username basicUser --password secret",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand All @@ -260,7 +260,7 @@ exports[`modules/manager/helmv3/artifacts log into private registries and reposi
},
},
{
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable",
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -309,7 +309,7 @@ exports[`modules/manager/helmv3/artifacts log into private registries and reposi
exports[`modules/manager/helmv3/artifacts returns null if unchanged 1`] = `
[
{
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable",
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -358,7 +358,7 @@ exports[`modules/manager/helmv3/artifacts returns null if unchanged 1`] = `
exports[`modules/manager/helmv3/artifacts returns updated Chart.lock 1`] = `
[
{
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable",
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -407,7 +407,7 @@ exports[`modules/manager/helmv3/artifacts returns updated Chart.lock 1`] = `
exports[`modules/manager/helmv3/artifacts returns updated Chart.lock for lockfile maintenance 1`] = `
[
{
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable",
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -468,7 +468,7 @@ exports[`modules/manager/helmv3/artifacts returns updated Chart.lock with docker
},
},
{
"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 HELM_REGISTRY_CONFIG -e HELM_REPOSITORY_CONFIG -e HELM_REPOSITORY_CACHE -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" ghcr.io/containerbase/sidecar bash -l -c "install-tool helm v3.7.2 && helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update ''"",
"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 HELM_REGISTRY_CONFIG -e HELM_REPOSITORY_CONFIG -e HELM_REPOSITORY_CACHE -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" ghcr.io/containerbase/sidecar bash -l -c "install-tool helm v3.7.2 && helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update && helm dependency update ''"",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -496,7 +496,7 @@ exports[`modules/manager/helmv3/artifacts returns updated Chart.lock with docker
exports[`modules/manager/helmv3/artifacts sets repositories from registryAliases 1`] = `
[
{
"cmd": "helm repo add stable the_stable_url",
"cmd": "helm repo add stable the_stable_url --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand All @@ -518,7 +518,7 @@ exports[`modules/manager/helmv3/artifacts sets repositories from registryAliases
},
},
{
"cmd": "helm repo add repo1 the_repo1_url",
"cmd": "helm repo add repo1 the_repo1_url --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand All @@ -540,7 +540,7 @@ exports[`modules/manager/helmv3/artifacts sets repositories from registryAliases
},
},
{
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable",
"cmd": "helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down Expand Up @@ -601,7 +601,7 @@ exports[`modules/manager/helmv3/artifacts sets repositories from registryAliases
},
},
{
"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 HELM_REGISTRY_CONFIG -e HELM_REPOSITORY_CONFIG -e HELM_REPOSITORY_CACHE -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" ghcr.io/containerbase/sidecar bash -l -c "install-tool helm v3.7.2 && helm repo add stable the_stable_url && helm repo add repo1 the_repo1_url && helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable && helm dependency update ''"",
"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 HELM_REGISTRY_CONFIG -e HELM_REPOSITORY_CONFIG -e HELM_REPOSITORY_CACHE -e CONTAINERBASE_CACHE_DIR -w "/tmp/github/some/repo" ghcr.io/containerbase/sidecar bash -l -c "install-tool helm v3.7.2 && helm repo add stable the_stable_url --force-update && helm repo add repo1 the_repo1_url --force-update && helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update && helm dependency update ''"",
"options": {
"cwd": "/tmp/github/some/repo",
"encoding": "utf-8",
Expand Down
10 changes: 5 additions & 5 deletions lib/modules/manager/helmv3/artifacts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ describe('modules/manager/helmv3/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable',
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update',
},
{
cmd: "helm dependency update ''",
Expand Down Expand Up @@ -343,7 +343,7 @@ describe('modules/manager/helmv3/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable',
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update',
options: {
env: {
HELM_EXPERIMENTAL_OCI: '1',
Expand Down Expand Up @@ -411,7 +411,7 @@ describe('modules/manager/helmv3/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable',
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update',
options: {
env: {
HELM_EXPERIMENTAL_OCI: '1',
Expand Down Expand Up @@ -486,7 +486,7 @@ describe('modules/manager/helmv3/artifacts', () => {
]);
expect(execSnapshots).toMatchObject([
{
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable',
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update',
options: {
env: {
HELM_EXPERIMENTAL_OCI: '1',
Expand Down Expand Up @@ -546,7 +546,7 @@ describe('modules/manager/helmv3/artifacts', () => {
).toBeNull();
expect(execSnapshots).toMatchObject([
{
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable',
cmd: 'helm repo add repo-test https://gitlab.com/api/v4/projects/xxxxxxx/packages/helm/stable --force-update',
options: {
env: {
HELM_EXPERIMENTAL_OCI: '1',
Expand Down
2 changes: 1 addition & 1 deletion lib/modules/manager/helmv3/artifacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ async function helmCommands(
// add helm repos if an alias or credentials for the url are defined
classicRepositories.forEach((value) => {
const { username, password } = value.hostRule;
const parameters = [`${value.repository}`];
const parameters = [`${value.repository}`, `--force-update`];
const isPrivateRepo = username && password;
if (isPrivateRepo) {
parameters.push(`--username ${quote(username)}`);
Expand Down