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

Ineffective custom helm values file with write-back-target annotation #1004

Open
fabiobozzo opened this issue Jan 10, 2025 · 2 comments
Open
Labels
bug Something isn't working

Comments

@fabiobozzo
Copy link

Describe the bug
I've recently enabled the image updater on our existing rollout process.
The image is updated correctly, once I push a new tag of it to our private ECR repo. ArgoCD detects a new presence and deploys it to the corresponding application in our dev environment.

The bug affects the Git write-back method. Although I specify my existing Helm values file as the target, ArgoCD commits a new file, inside the chart's folder.

To Reproduce
My application is configured w/ the following annotations:

billing:
      repoURL: https://github.com/myorg/argocd-workloads-repo.git
      path: charts/billing
      targetRevision: main
      valueFiles:
        - /multi-repo/argo-app-of-apps/dev/billing-values.yaml
      annotations:
        argocd-image-updater.argoproj.io/image-list: billing=00000000000.dkr.ecr.us-east-1.amazonaws.com/myorg/myrepo/billing
        argocd-image-updater.argoproj.io/billing.update-strategy: latest
        argocd-image-updater.argoproj.io/write-back-method: git
        argocd-image-updater.argoproj.io/write-back-target: "helmvalues:../../multi-repo/argo-app-of-apps/dev/billing-values.yaml"
        argocd-image-updater.argoproj.io/billing.helm.image-name: image.repository
        argocd-image-updater.argoproj.io/billing.helm.image-tag: image.tag

Expected behavior
I expect ArgoCD to update the image.tag field in the existing file I specified as write-back-target ( which we used to manage manually ) instead of creating one in what he thinks it's the default path.

Additional context

Repository Root

│
├── charts/
│   └── billing/
│       ├── .argocd-source-billing.yaml    # Created here instead of updating values file
│       └── [other chart files]
│
└── multi-repo/
    └── argo-app-of-apps/
        └── dev/
            ├── values.yaml                 # Contains app-of-apps config with image updater annotations
            └── billing-values.yaml         # Should be updated but isn't

Key Files:

  1. /multi-repo/argo-app-of-apps/dev/values.yaml

    • Contains image updater config:
      argocd-image-updater.argoproj.io/write-back-target: "helmvalues:/multi-repo/argo-app-of-apps/dev/billing-values.yaml"
  2. /multi-repo/argo-app-of-apps/dev/billing-values.yaml

    • Contains values that should be updated:
      image:
        repository: 0000000000.dkr.ecr.us-east-1.amazonaws.com/myorg/myrepo/billing
        tag: master-bef7237
  3. /charts/billing/.argocd-source-billing.yaml

    • Created instead of updating billing-values.yaml:
      helm:
        parameters:
        - name: image.repository
          value: 0000000000.dkr.ecr.us-east-1.amazonaws.com/myorg/myrepo/billing
          forcestring: true
        - name: image.tag
          value: argocd-image-updater-dev-7159c44
          forcestring: true

Version

kubectl get deployment argocd-image-updater -n argocd -o=jsonpath='{.spec.template.spec.containers[0].image}'
quay.io/argoprojlabs/argocd-image-updater:v0.12.2

Logs

time="2025-01-10T11:26:10Z" level=info msg="Successfully updated image '00000000000.dkr.ecr.us-east-1.amazonaws.com/myorg/myrepo/billing:argocd-image-updater-dev-ef4150c' to '00000000000.dkr.ecr.us-east-1.amazonaws.com/myorg/myrepo/billing:argocd-image-updater-dev-80fde7d', but pending spec update (dry run=false)" alias=billing application=billing image_name=myorg/myrepo/billing image_tag=argocd-image-updater-dev-ef4150c registry=00000000000.dkr.ecr.us-east-1.amazonaws.com
time="2025-01-10T11:26:10Z" level=info msg="Committing 1 parameter update(s) for application billing" application=billing
time="2025-01-10T11:26:10Z" level=info msg="Starting configmap/secret informers"
time="2025-01-10T11:26:11Z" level=info msg="Configmap/secret informer synced"
time="2025-01-10T11:26:11Z" level=info msg="secrets informer cancelled"
time="2025-01-10T11:26:11Z" level=info msg="Initializing https://github.com/myorg/argocd-workloads-myrepo.git to /tmp/git-billing2412957573"
time="2025-01-10T11:26:11Z" level=info msg="configmap informer cancelled"
time="2025-01-10T11:26:11Z" level=info msg="rm -rf /tmp/git-billing2412957573" dir= execID=93685
time="2025-01-10T11:26:11Z" level=info msg=Trace args="[rm -rf /tmp/git-billing2412957573]" dir= operation_name="exec rm" time_ms=0.593046
time="2025-01-10T11:26:11Z" level=info msg="git fetch origin --tags --force" dir=/tmp/git-billing2412957573 execID=27c8c
time="2025-01-10T11:26:11Z" level=info msg=Trace args="[git fetch origin --tags --force]" dir=/tmp/git-billing2412957573 operation_name="exec git" time_ms=786.499686
time="2025-01-10T11:26:11Z" level=info msg="git config user.name argocd-image-updater" dir=/tmp/git-billing2412957573 execID=8f951
time="2025-01-10T11:26:11Z" level=info msg=Trace args="[git config user.name argocd-image-updater]" dir=/tmp/git-billing2412957573 operation_name="exec git" time_ms=0.883429
time="2025-01-10T11:26:11Z" level=info msg="git config user.email [email protected]" dir=/tmp/git-billing2412957573 execID=a98d5
time="2025-01-10T11:26:11Z" level=info msg=Trace args="[git config user.email [email protected]]" dir=/tmp/git-billing2412957573 operation_name="exec git" time_ms=0.841534
time="2025-01-10T11:26:11Z" level=info msg="git checkout --force main" dir=/tmp/git-billing2412957573 execID=3677f
time="2025-01-10T11:26:11Z" level=info msg=Trace args="[git checkout --force main]" dir=/tmp/git-billing2412957573 operation_name="exec git" time_ms=14.635403
time="2025-01-10T11:26:11Z" level=info msg="git clean -fdx" dir=/tmp/git-billing2412957573 execID=8773f
time="2025-01-10T11:26:11Z" level=info msg=Trace args="[git clean -fdx]" dir=/tmp/git-billing2412957573 operation_name="exec git" time_ms=1.189294
time="2025-01-10T11:26:11Z" level=info msg="Successfully updated the live application spec" application=billing
time="2025-01-10T11:26:11Z" level=info msg="Processing results: applications=1 images_considered=1 images_skipped=0 images_updated=1 errors=0"
@fabiobozzo fabiobozzo added the bug Something isn't working label Jan 10, 2025
@chengfang
Copy link
Collaborator

argocd-image-updater:v0.12.2 is pretty old version. Can you try the latest release v0.15.2? Everything else looks it should work.

@chengfang
Copy link
Collaborator

You may want to take a look at the sample app: https://github.com/chengfang/image-updater-examples/tree/main/write-helmvalues

It writes to a custom helm values file in the target git repo. It has been working for recent argo-cd and image-updater versions. You can check the commit history to see the values file write-helmvalues/source2/values.yaml was updated by the updater.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants