Skip to content

forceUpdate: true clears Helm parameters when there is no tag in registry, causing invalid image referenceย #1351

@papaslon

Description

@papaslon

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

  1. Create an ArgoCD Application manifest with global.image.tag set 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
  2. Create an ImageUpdater CRD with forceUpdate: true and an imageName that 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"
  3. Apply both resources to the cluster

  4. Observe that argocd-image-updater removes the global.image.tag parameter from the Application manifest

  5. 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: true is set
  • The global.image.tag is 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: true is 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingregressionApplies if previously working feature stops working after a new change is implemented

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions