applicationset icon indicating copy to clipboard operation
applicationset copied to clipboard

Applicationset not refreshed after webhook event using matrix generator

Open sboschman opened this issue 3 years ago • 2 comments
trafficstars

As PR changes (e.g. change the label defined for the pr generator) on GitHub are not immediately picked up by ArgoCD, even though the webhook event is delivered oke according to GitHub, I did some investigating.

Timeline:

14:21:38Z: appset-controller log (no pr's labeled with 'preview' at this moment, so 0 apps is correct):

time="2021-12-20T14:21:38Z" level=info msg="generated 0 applications" generator="{<nil> <nil> <nil> <nil> <nil> <nil> 0xc000a00000 <nil>}"
time="2021-12-20T14:21:38Z" level=info msg="end reconcile" requeueAfter=3m0s

14:22:23Z: Webhook delivery (labeled one pr with 'preview'):

Content-Length: 0
Date: Mon, 20 Dec 2021 14:22:23 GMT
Vary: Accept-Encoding

14:22:23Z: Expected some webhook action here to trigger an appset refresh

14:24:40Z: appset-controller log (requeued reconcile expected at 14:21:38Z + 3mins ~ 14:24:38Z):

time="2021-12-20T14:24:40Z" level=info msg="created Application" app=my-app-pr-1-dir1 appSet=my-appset
time="2021-12-20T14:24:40Z" level=info msg="created Application" app=my-app-pr-1-dir2 appSet=my-appset

14:24:40Z: app-controller:

time="2021-12-20T14:24:40Z" level=info msg="Refreshing app status (spec.source differs), level (3)" application=my-app-pr-1-dir1

Based on the this code, I assume the webhook only works if the git or pr generators are used on their own, but not in combination with the matrix (or the new merge) generator.

I don't see the refesh log statement in the appset-controller logs, but there is no error either.

Example appset spec:

spec:
  generators:
  - matrix:
      generators:
      - pullRequest:
          github:
            labels:
            - preview
            owner: me
            repo: my-app
      - git:
          directories:
          - path: '*'
          repoURL: [email protected]:me/my-app-deployments.git
          revision: pr

Would it be possible to extend webhook support for 'nested' generators, like the matrix generator?

sboschman avatar Dec 20 '21 16:12 sboschman

got the same issue with this setup:

  generators:
    - matrix:       
        generators:        
        - pullRequest:
            github:
              owner: me
              repo: repo
              tokenRef:
                secretName: github-token
                key: token
              # Labels is used to filter the PRs that you want to target. (optional)
              labels:
              - setup
            requeueAfterSeconds: 300
        - list:
            elements:
            - version: 1.4.0

yevgeniyo-ps avatar Mar 16 '22 10:03 yevgeniyo-ps

Fixed via https://github.com/argoproj/argo-cd/pull/8998

crenshaw-dev avatar Apr 07 '22 17:04 crenshaw-dev