argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
17.88k stars 5.46k forks source link

Appset PullRequestGenerator Webhook not working properly with gitlab #13766

Open Syst3m1cAn0maly opened 1 year ago

Syst3m1cAn0maly commented 1 year ago

Checklist:

Describe the bug

When using gitlab for the PullRequestGenerator, the webhook doesn't refresh the appset.

When I looked into the code, I notices that the webhook for PullRequestGenerator for gitlab tries to match the project id with the name. The fix would be either to change the code so it correctly matches the name of the project with the name set up in the PullRequestGenerator, or to try to also match with the name and update the documentation to indicate that the id is also acceptable for the project field.

To Reproduce

Configure an appset with the PullRequestGenerator and set the project field with the name or the path/name of the project. Upon creation, the expected applications are generated. When adding/changing state of a merge request and calling the webhook, th applicationset doesn't refresh. It only updates when it's requeued automatically after the delay configured.

Expected behavior

The Appset using PullRequestGenerator is correctly updated when calling the webhook.

Screenshots

Version

Paste the output from `argocd version` here.

Logs

Paste any relevant application logs here.
si-c613 commented 1 year ago

We have seen the same in our Application Set webhook and this does look to be the problem. I just switch project to be the projectID to test if that worked and it is working for now as a workaround...... That said the above PR would break the workaround, but also be more desirable.

I wonder if maybe there is an opportunity to adjust the schema to be one of projectName or projectID and depreciate project to maintain backwards compatibility for anyone who has already applied the workaround?

dakr0013 commented 1 year ago

Any updates? We have the same problem but cannot switch to the projectID because we use a matrix generator where the projectName for the PR generator is provided by a scmProvider generator.

alstephenclaypool commented 4 months ago

Running into the same issue where SCM generator is discovering projects and not seeing a way to grab the project ID from it, only the name. Anyone find any workarounds that would let them still use SCM generator + PR generator and have PR webhook working?