Skip to content

Image updater unable to update image tags through ApplicationSet #1108

Open
@eric09240

Description

@eric09240

Describe the bug
Using write-back-target to deploy an application through an ApplicationSet fails to update the image parameters. This works when deploying as an Application.

Also referenced this example from a contributor.

 level=info msg="git checkout --force main" dir=/tmp/git-fake-webserver execID=6f9b7
 level=info msg=Trace args="[git checkout --force main]" dir=/tmp/git-fake-webserver operation_name="exec git" time_ms=412.68863500000003
level=info msg="git clean -ffdx" dir=/tmp/git-fake-webserver execID=2ba29
level=info msg=Trace args="[git clean -ffdx]" dir=/tmp/git-fake-webserver operation_name="exec git" time_ms=1.492445
level=error msg="Could not update application spec: failed to set image parameter version value: unexpected type  for root" application=fake-webserver

To Reproduce
Steps to reproduce the behavior:

values.yaml

containers:
  fakewebserver:
    name: fake-webserver
    image: "xxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/argo-tools/fake-webserver"
    tag: "main-cbc1056"

AppSet

---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: fake-webserver
  namespace: argo-cd
spec:
  goTemplate: true
  goTemplateOptions: ["missingkey=error"]
  generators:
    - git:
        repoURL: "https://foo.com/foo/argo-tools"
        revision: main
        directories:
        - path: "apps/fake-webserver/*/*"
        pathParamPrefix: app
        values:
          region: "{{index .path.segments 2}}"
          environment: "{{index .path.segments 3}}" 
  template:
    metadata:
      name: "fake-webserver-{{.values.region}}-{{.values.environment}}"
      namespace: argo-cd   
      labels:
        environment: "{{.values.environment}}"
        region: "{{.values.region}}"
      annotations:
        argocd-image-updater.argoproj.io/image-list: fake-webserver=xxxxxxxx.dkr.ecr.us-east-1.amazonaws.com/argo-tools/fake-webserver
        argocd-image-updater.argoproj.io/fake-webserver.update-strategy: newest-build
        argocd-image-updater.argoproj.io/fake-webserver.allow-tags: regexp:^main-
        argocd-image-updater.argoproj.io/fake-webserver.force-update: "true"
        argocd-image-updater.argoproj.io/fake-webserver.ignore-tags: regexp:^sha256
        argocd-image-updater.argoproj.io/write-back-method: git
        argocd-image-updater.argoproj.io/fake-webserver.helm.image-name: containers.fakewebserver.image 
        argocd-image-updater.argoproj.io/fake-webserver.helm.image-tag: containers.fakewebserver.tag 
        argocd-image-updater.argoproj.io/git-repository: https://foo.com/foo/argo-tools
        argocd-image-updater.argoproj.io/write-back-target: "helmvalues:/{{ .app.path.path }}/values.yaml"
        notifications.argoproj.io/subscribe.app-deployed.github: ""
        argocd-image-updater.argoproj.io/git-branch: main         
    spec: 
      project: argocd
      sources:
        - repoURL: https://foo.com/foo/argo-tools
          targetRevision: main
          ref: values
        - repoURL: https://foo.com/artifactory/argocd-virtual  
          chart: foo
          targetRevision: 3.*.*
          helm:
            releaseName: "fake-webserver-{{.values.environment}}"
            valueFiles:
              - "$values/{{ .app.path.path }}/values.yaml"
      destination:
        name: "{{.values.region}}-{{.values.environment}}"
        namespace: "fake-webserver-{{.values.environment}}"          
      syncPolicy:
        automated:
          prune: true
        syncOptions:
          - CreateNamespace=true
          - ServerSideDiff=false
          - ServerSideApply=false

 level=info msg="git checkout --force main" dir=/tmp/git-fake-webserver execID=6f9b7
 level=info msg=Trace args="[git checkout --force main]" dir=/tmp/git-fake-webserver operation_name="exec git" time_ms=412.68863500000003
level=info msg="git clean -ffdx" dir=/tmp/git-fake-webserver execID=2ba29
level=info msg=Trace args="[git clean -ffdx]" dir=/tmp/git-fake-webserver operation_name="exec git" time_ms=1.492445
level=error msg="Could not update application spec: failed to set image parameter version value: unexpected type  for root" application=fake-webserver

Error

Expected behavior
Expect Image Updater to write back to the values.yaml with the latest tag.

Additional context
Can confirm that Image Updater recognizes the latest tags.

Version
v16.0
v15.x

Logs

 level=info msg="git checkout --force main" dir=/tmp/git-fake-webserver execID=6f9b7
 level=info msg=Trace args="[git checkout --force main]" dir=/tmp/git-fake-webserver operation_name="exec git" time_ms=412.68863500000003
level=info msg="git clean -ffdx" dir=/tmp/git-fake-webserver execID=2ba29
level=info msg=Trace args="[git clean -ffdx]" dir=/tmp/git-fake-webserver operation_name="exec git" time_ms=1.492445
level=error msg="Could not update application spec: failed to set image parameter version value: unexpected type  for root" application=fake-webserver

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions