Skip to content

Regression after recent commit, Segmentation fault #621

@ZOrfeas

Description

@ZOrfeas

Describe the bug
Segmentation fault due to (semi-)recent commit.
On release v0.12.2 argocd-image-updater functions properly. But the current version in the master branch segfaults.
The commit to blame is most probably d5a8f94 , this is the first one to break from the ones between v0.12.2 and now.

To Reproduce
Not extremely straightforward, but currently using a very simple setup, with a helm chart for argocd-image-updater.

Chart config:
  image:
    repository: "<some-registry>/<something>/argocd-image-updater"
    pullPolicy: Always
    tag: "v0.12.2-patched"
  config:
    gitCommitTemplate: |
      build: automatic update of {{ .AppName }} [skip ci]

      {{ range .AppChanges -}}
      updates image {{ .Image }}:
        from '{{ .OldTag }}'
        to   '{{ .NewTag }}'
      {{ end -}}
    registries:
      - name: <Some registry name>
        api_url: https://<some-registry-api-url>
        prefix: <some-prefix>
        credentials: <redacted>
        default: true
  extraArgs:
    - --interval
    - 30s
And the relevant argo-Application annotations
    argocd-image-updater.argoproj.io/image-list: web-server=<some-registry>/<something>/<some-image>
    argocd-image-updater.argoproj.io/web-server.helm.image-name: image.repository
    argocd-image-updater.argoproj.io/web-server.update-strategy: latest # can also use "newest-build" if using manually built latest version of argocd-image-updater
    argocd-image-updater.argoproj.io/write-back-method: git

Expected behavior
To not segfault :)

Additional context
Encountered while trying to add a feature required for my team

Version
First commit to break seems to be d5a8f94

Logs

Crash logs
time="2023-09-14T13:25:56Z" level=info msg=Trace args="[rm -rf /tmp/git-<redacted>3928236953]" dir= operation_name="exec rm" time_ms=1.767175
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0xc3eb4d]

goroutine 660 [running]:
github.com/argoproj/argo-cd/v2/util/git.HTTPSCreds.Environ({{0xc0004f5078, 0x7}, {0xc000b6b2e0, 0x1a}, 0x0, {0x0, 0x0}, {0x0, 0x0}, {0x0, ...}, ...})
	/go/pkg/mod/github.com/argoproj/argo-cd/[email protected]/util/git/creds.go:218 +0xb6d
github.com/argoproj-labs/argocd-image-updater/ext/git.(*nativeGitClient).runCredentialedCmd(0xc0001fc2a0, {0x244e214?, 0xc000a79e90?}, {0xc00099b2d8?, 0x6?, 0x27c9478?})
	/src/argocd-image-updater/ext/git/client.go:595 +0x8b
github.com/argoproj-labs/argocd-image-updater/ext/git.(*nativeGitClient).Fetch(0xc0001fc2a0, {0x0?, 0x0?})
	/src/argocd-image-updater/ext/git/client.go:332 +0x236
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.commitChangesGit(0xc0004a6c00, 0xc0002fa320, {0xc0007cc720, 0x1, 0x1}, 0x25852f0)
	/src/argocd-image-updater/pkg/argocd/git.go:159 +0x365
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.commitChanges(0xc0004b6fd0?, 0xc00088b050?, {0xc0007cc720?, 0xc00099b690?, 0x1be27fa?})
	/src/argocd-image-updater/pkg/argocd/update.go:563 +0x5b
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.commitChangesLocked(0xc0004a6c00?, 0xc0002fa320?, 0x34?, {0xc0007cc720?, 0x1?, 0x1?})
	/src/argocd-image-updater/pkg/argocd/update.go:543 +0x10c
github.com/argoproj-labs/argocd-image-updater/pkg/argocd.UpdateApplication(0xc00099bb88, 0x19?)
	/src/argocd-image-updater/pkg/argocd/update.go:331 +0x1f2d
main.runImageUpdater.func1({_, _}, {{{{0xc0004f4910, 0xb}, {0xc0009fcf30, 0x14}}, {{0xc0004f4990, 0xa}, {0x0, 0x0}, ...}, ...}, ...})
	/src/argocd-image-updater/cmd/run.go:313 +0x287
created by main.runImageUpdater
	/src/argocd-image-updater/cmd/run.go:299 +0xa1e

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