Skip to content

pullRequest generator not working in latest v3.0.5 #23240

@rmdg88

Description

@rmdg88

Checklist:

  • I've searched in the docs and FAQ for my answer: https://bit.ly/argocd-faq.
  • I've included steps to reproduce the bug.
  • I've pasted the output of argocd version.

Describe the bug

We use both generators, pullrequest and git, so we can test deployments using the pr branch, however since the newer version, the pullrequest generator fails to work, errors with 401 (auth issue)

To Reproduce

Install argocd version v3.0.5
Configure argocd webhooks for github, create a secret for the generator, example github-token-pr-gen, with github PAT in key token and make a pr with the corresponding label, example preview of the example template

Template:

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: myapp
  namespace: argocd
spec:
  goTemplate: true
  generators:
  - matrix:
      generators:
      - pullRequest:
          github:
            owner: myuser
            repo: myrepo
            api: https://github.myorg.com/
            tokenRef:
              secretName: github-token-pr-gen
              key: token
            labels:
            - preview
          requeueAfterSeconds: 1800
      - git:
          repoURL: https://github.myorg.com/myuser/myrepo.git
          revision: '{{ .head_sha }}'
          files:
            - path: "./somepath/config.json"
...

Expected behavior

It works fine with v2.14.11 and previous versions

Screenshots

N/A

Version

v3.0.5

Logs

401

The applicationset controller errors out with similar error:
"child generators fails to list pull requests, 401 (auth)"

It also output the correct endpoint in the error message:
https://github.<myorg>.com/api/v3/repos/<myuser>/<myrepo>/pulls?per_page=100

Using the same template and token works fine in v2.14.11 and older versions and locally with curl

# example:
curl -H "Authorization: token <mytoken>" \
https://github.<myorg>.com/api/v3/repos/<myuser>/<myrepo>/pulls?per_page=100

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomponent:application-setsBulk application management relatedregressionBug is a regression, should be handled with high priority

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions