-
Notifications
You must be signed in to change notification settings - Fork 318
Description
Describe the bug
When forceUpdate: true is set in the ImageUpdater CRD, argocd-image-updater sets Helm parameter (global.image.tag) to empty when there is no image tag specified in the Artifact Registry's imageName field. This causes a syntax error because the resulting image reference becomes invalid (e.g., registry/image: with an empty tag). Additionally, argocd-image-updater removes the global.image.tag Helm parameter that was explicitly set in the ArgoCD Application manifest.
Previously, the image updater would preserve the existing global.image.tag value even when there was no specified image tag in Artifact Registry.
To Reproduce
-
Create an ArgoCD Application manifest with
global.image.tagset as a Helm parameter:apiVersion: argoproj.io/v1alpha1 kind: Application metadata: name: example-app spec: project: preview source: repoURL: https://github.com/org/repo.git path: infrastructure/helm/frontend targetRevision: test helm: valueFiles: - ../envs/frontend-partners/values-preview.yaml parameters: - name: global.image.tag value: "mq@sha256:123456" forceString: true
-
Create an ImageUpdater CRD with
forceUpdate: trueand animageNamethat doesn't include a tag:apiVersion: argocd-image-updater.argoproj.io/v1alpha1 kind: ImageUpdater metadata: name: example-image-updater spec: namespace: argocd commonUpdateSettings: forceUpdate: true updateStrategy: "digest" writeBackConfig: method: "argocd" applicationRefs: - namePattern: "example-app" images: - alias: frontend-partners imageName: "example-registry/docker/frontend-partners" manifestTargets: helm: name: "global.image.name" tag: "global.image.tag"
-
Apply both resources to the cluster
-
Observe that argocd-image-updater removes the
global.image.tagparameter from the Application manifest -
Observe the error when ArgoCD tries to deploy the application
Expected behavior
The image updater should preserve the existing global.image.tag value when:
forceUpdate: trueis set- The
global.image.tagis explicitly set in the Application manifest as a Helm parameter
The image updater should not remove Helm parameters from the Application manifest, and should not set global.image.tag to empty, which results in invalid image references.
Additional context
- This issue only occurs when
forceUpdate: trueis set - When
forceUpdate: false(or omitted), the image updater works correctly and preserves the tag value - This appears to be a regression from previous behavior where the tag value was preserved
- Related to the fix for issue Cannot use digest update strategy with forceUpdate: true without version constraintย #1344
- The error occurs because Kubernetes/Docker cannot parse image references with empty tags (e.g.,
registry/image:)
Version
1.0.1
Logs
Failed to apply default image tag "example-registry/docker/frontend-partners:": couldn't parse image name "example-registry/docker/frontend-partners:": invalid reference format