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

Git write-back-target helmvalues Got panic: runtime error: invalid memory address or nil pointer dereference #835

Open
minkbear opened this issue Aug 21, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@minkbear
Copy link

minkbear commented Aug 21, 2024

Describe the bug

got error

time="2024-08-21T16:26:00Z" level=info msg=Trace args="[git fetch origin --tags --force --prune]" dir=/tmp/git-workload-in-cluster-app-podinfo-test1868138268 operation_name="exec git" time_ms=1916.5610530000001
time="2024-08-21T16:26:00Z" level=info msg="git config user.name argocd-image-updater" dir=/tmp/git-workload-in-cluster-app-podinfo-test1868138268 execID=29dd2
time="2024-08-21T16:26:00Z" level=info msg=Trace args="[git config user.name argocd-image-updater]" dir=/tmp/git-workload-in-cluster-app-podinfo-test1868138268 operation_name="exec git" time_ms=10.841928000000001
time="2024-08-21T16:26:00Z" level=info msg="git config user.email [email protected]" dir=/tmp/git-workload-in-cluster-app-podinfo-test1868138268 execID=da41d
time="2024-08-21T16:26:00Z" level=info msg=Trace args="[git config user.email [email protected]]" dir=/tmp/git-workload-in-cluster-app-podinfo-test1868138268 operation_name="exec git" time_ms=2.3861109999999996
time="2024-08-21T16:26:00Z" level=info msg="git checkout --force develop" dir=/tmp/git-workload-in-cluster-app-podinfo-test1868138268 execID=cd67d
time="2024-08-21T16:26:00Z" level=info msg=Trace args="[git checkout --force develop]" dir=/tmp/git-workload-in-cluster-app-podinfo-test1868138268 operation_name="exec git" time_ms=36.427568
time="2024-08-21T16:26:00Z" level=info msg="git clean -ffdx" dir=/tmp/git-workload-in-cluster-app-podinfo-test1868138268 execID=4d9e3
time="2024-08-21T16:26:00Z" level=info msg=Trace args="[git clean -ffdx]" dir=/tmp/git-workload-in-cluster-app-podinfo-test1868138268 operation_name="exec git" time_ms=5.22551
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1f565e8]

goroutine 131 [running]:
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.mergeKustomizeOverride(0xc000117098, 0xb29?)
	/src/argocd-image-updater/pkg/argocd/update.go:528 +0x48
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.marshalParamsOverride(0xc0006ee408, {0xc000824c00, 0xb29, 0xb2a})
	/src/argocd-image-updater/pkg/argocd/update.go:428 +0x4a5
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.writeOverrides(0xc0006ee408, 0xc0007065a0, {0x2904318, 0xc0002768c0})
	/src/argocd-image-updater/pkg/argocd/git.go:279 +0x249
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.commitChangesGit(0xc0006ee408, 0xc0007065a0, {0xc000981890, 0x1, 0x1}, 0x2694540)
	/src/argocd-image-updater/pkg/argocd/git.go:214 +0x746
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.commitChanges(0xc000958ff0?, 0xc0006c02a0?, {0xc000981890?, 0xc000505648?, 0xcff4f1?})
	/src/argocd-image-updater/pkg/argocd/update.go:704 +0x4e
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.commitChangesLocked(0xc0006ee408?, 0xc0007065a0?, 0x34?, {0xc000981890?, 0x1?, 0x1?})
	/src/argocd-image-updater/pkg/argocd/update.go:683 +0xfe
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.UpdateApplication(0xc00098bb18, 0xc000958ff0)
	/src/argocd-image-updater/pkg/argocd/update.go:350 +0x1fcd
main.runImageUpdater.func1({_, _}, {{{{0xc00031ecc0, 0xb}, {0xc000209878, 0x14}}, {{0xc0006c0210, 0x24}, {0x0, 0x0}, ...}, ...}, ...})
	/src/argocd-image-updater/cmd/run.go:339 +0x2ef
created by main.runImageUpdater in goroutine 1
	/src/argocd-image-updater/cmd/run.go:321 +0x9d8
time="2024-08-21T16:26:27Z" level=info msg="argocd-image-updater v0.14.0+af844fe starting [loglevel:INFO, interval:2m0s, healthport:8080]"
time="2024-08-21T16:26:27Z" level=warning msg="commit message template at /app/config/commit.template does not exist, using default"
time="2024-08-21T16:26:27Z" level=info msg="Loaded 1 registry configurations from /app/config/registries.conf"

To Reproduce
Steps to reproduce the behavior:

Add annotations for ApplicationSet

      annotations:
        argocd-image-updater.argoproj.io/image-list: "myimage=myecrrepo/app-podinfo:test"
        argocd-image-updater.argoproj.io/myimage.update-strategy: digest
        argocd-image-updater.argoproj.io/myimage.force-update: "true"
        argocd-image-updater.argoproj.io/myimage.helm.image-name: image.repository
        argocd-image-updater.argoproj.io/myimage.helm.image-tag: image.tag
        argocd-image-updater.argoproj.io/write-back-method: git
        argocd-image-updater.argoproj.io/write-back-target: "helmvalues:./../values.yaml"

and my values.yaml is

skipDeploy: "false"

containerPort: 9898

image:
  repository: myecrrepo/app-podinfo
  tag: test

container:
  command:

Expected behavior

change image.tag

Version

argocd-image-updater v0.14.0+af844fe

@minkbear minkbear added the bug Something isn't working label Aug 21, 2024
@minkbear minkbear changed the title Got panic: runtime error: invalid memory address or nil pointer dereference Git write-back-target helmvalues Got panic: runtime error: invalid memory address or nil pointer dereference Aug 21, 2024
@chengfang
Copy link
Collaborator

around https://github.com/argoproj-labs/argocd-image-updater/blob/v0.14.0/pkg/argocd/update.go#L428 , the updater thinks its a kustomize type app instead of a helm type, and proceeds to write back as a kustomize app and failed. I'm wondering if there is anything in your app that makes it looks like a kustomize app?

@minkbear
Copy link
Author

minkbear commented Aug 22, 2024

around https://github.com/argoproj-labs/argocd-image-updater/blob/v0.14.0/pkg/argocd/update.go#L428 , the updater thinks its a kustomize type app instead of a helm type, and proceeds to write back as a kustomize app and failed. I'm wondering if there is anything in your app that makes it looks like a kustomize app?

@chengfang Oh, I used helm and kustomize in the same folder look like below

├── app-podinfo
│   ├── test
│   │   ├── configs
│   │   │   ├── app-podinfos-configs-test.env
│   │   │   ├── kustomization.yaml
│   │   └── values.yaml

and my Application show below

spec:
      project: default
      sources:
      - repoURL: myecrrepo
        targetRevision: main
        path: 'apps/app-podinfo/test/configs'
        kustomize:
          commonAnnotationsEnvsubst: true
      - repoURL: 'https://chart.onechart.dev'
        chart: onechart
        targetRevision: 0.69.0
        helm:
          releaseName: app-podinfo
          ignoreMissingValueFiles: true
          valueFiles:
            - $values/gitops/workloads/configs/global-onechart-values.yaml
            - $values/apps/app-podinfo/test/values.yaml
          valuesObject:
            appName: app-podinfo
            podAnnotations:
              secret.reloader.stakater.com/reload: 'app-podinfo-secret'
              configmap.reloader.stakater.com/reload: 'app-podinfo-config'
            existingSecrets:
              - name: 'app-podinfo-secret'
            existingConfigMaps:
              - name: 'app-podinfo-config'
      - repoURL: myecrrepo
        targetRevision: main
        ref: values

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