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

Unable to write back to git helm values, key not found in the map #877

Open
mimartin12 opened this issue Oct 1, 2024 · 6 comments
Open
Labels
bug Something isn't working helm

Comments

@mimartin12
Copy link

Describe the bug
When using the git writeback method, image updater is unable to create the file in the branch with the helm value updates with an error:
time="2024-10-01T15:32:52Z" level=error msg="Could not update application spec: failed to set image parameter name value: key component not found in the map" application=test

To Reproduce
Steps to reproduce the behavior:
Using the annotations:

        argocd-image-updater.argoproj.io/image-list: admin=somewhere.azurecr.io/admin:{{.branch}}
        argocd-image-updater.argoproj.io/update-strategy: digest
        argocd-image-updater.argoproj.io/admin.helm.image-name: component.admin.image.name
        argocd-image-updater.argoproj.io/admin.helm.image-tag: component.admin.image.tag
        argocd-image-updater.argoproj.io/write-back-method: git
        argocd-image-updater.argoproj.io/git-repository: [email protected]:company/admin.git
        argocd-image-updater.argoproj.io/write-back-target: 'helmvalues:/envs/{{.branch}}.yaml'
        argocd-image-updater.argoproj.io/git-branch: '{{.branch}}'

The Helm chart supports the structure:

component:
  admin:
    image:
      name: somewhere.azurecr.io/admin
      tag: dev

Expected behavior
A clear and concise description of what you expected to happen.

When a new image is added to the ACR, the updater creates a file /envs/{{.branch}}.yaml on the branch {{.branch}} with the newly set values, component.admin.image.name and component.admin.image.tag.

Additional context
Add any other context about the problem here.

It's worth noting, if I create the file manually at /envs/{{.branch}}.yaml and add the structure:

component:
  admin:
    image:
      name: somewhere.azurecr.io/admin
      tag: dev

The updates work.

Version
0.14.0

Logs

time="2024-10-01T15:32:52Z" level=error msg="Could not update application spec: failed to set image parameter name value: key component not found in the map" application=test
time="2024-10-01T15:32:52Z" level=info msg="Processing results: applications=1 images_considered=1 images_skipped=0 images_updated=0 errors=1"
time="2024-10-01T15:33:43Z" level=info msg="configmap informer cancelled"
time="2024-10-01T15:33:43Z" level=info msg="secrets informer cancelled"
@mimartin12 mimartin12 added the bug Something isn't working label Oct 1, 2024
@chengfang chengfang added the helm label Oct 1, 2024
@chengfang
Copy link
Collaborator

looks like #838 should have already fixed it.

In release-0.14 (the version you're testing with), https://github.com/argoproj-labs/argocd-image-updater/blob/release-0.14/pkg/argocd/update.go#L573 is where the error was raised.

In the above PR, this part has been rewritten to handle non-existing file or keys.

@mimartin12
Copy link
Author

looks like #838 should have already fixed it.

In release-0.14 (the version you're testing with), https://github.com/argoproj-labs/argocd-image-updater/blob/release-0.14/pkg/argocd/update.go#L573 is where the error was raised.

In the above PR, this part has been rewritten to handle non-existing file or keys.

Yes, I expect this to just create the file, but that doesn't seem to be the case. It can update an existing values file in the branch, but when pointing the config argocd-image-updater.argoproj.io/write-back-target to a file that doesn't exist just yet, it fails with the error above, time="2024-10-02T16:09:35Z" level=error msg="Could not update application spec: failed to set image parameter name value: key component not found in the map" application=test.

@chengfang
Copy link
Collaborator

The fix is in the current master branch, and will be included in the next release (0.15.0).

@mimartin12
Copy link
Author

The fix is in the current master branch, and will be included in the next release (0.15.0).

Great! Am I able to get those changes from the latest image tags, so I can test? Thanks!

@chengfang
Copy link
Collaborator

there is a latest snapshot tag https://quay.io/repository/argoprojlabs/argocd-image-updater?tab=tags but no guarantee of quality. 0.15.0 is forthcoming.

@mimartin12
Copy link
Author

Oh yeah, just something I can test with is great. Looking forward to 0.15.0!

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

No branches or pull requests

2 participants