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

Support GitLab "System Hook" push webhooks for ApplicationSets #21062

Closed
eadred opened this issue Dec 4, 2024 · 1 comment · Fixed by #21243
Closed

Support GitLab "System Hook" push webhooks for ApplicationSets #21062

eadred opened this issue Dec 4, 2024 · 1 comment · Fixed by #21243
Labels
enhancement New feature or request

Comments

@eadred
Copy link
Contributor

eadred commented Dec 4, 2024

Summary

Similar to the issue that was reported in #9625, the ApplicationSet controller does not support Gitlab System Hook events - instead it will return a 400 response. Although the fix for 9625 added system hook support for Applications, the equivalent was not done for ApplicationSets.

Motivation

As with #9625, on a company GItlab instance it would be easier to be able to configure a system wide webhook centrally for ApplicationSets.

Proposal

Implement the same solution as for Applications (#12547), except on this line:

payload, err = h.gitlab.Parse(r, gitlab.PushEvents, gitlab.TagEvents, gitlab.MergeRequestEvents)

ie include gitlab.SystemHookEvents in the params.

@eadred eadred added the enhancement New feature or request label Dec 4, 2024
@conrity
Copy link

conrity commented Dec 13, 2024

We need this too, we would like to use webhook to trigger gitlab reconcile after new branch created.

apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
  name: preview-appset
  namespace: argocd
spec:
  goTemplate: true
  goTemplateOptions: ["missingkey=error"]
  generators:
  - scmProvider:
      gitlab:
        # The base GitLab group to scan.  You can either use the group id or the full namespaced path.
        group: "backend"
        # For self-hosted GitLab:
        api: https://gitlab.mycompany.com/
        # If true, scan every branch of every repository. If false, scan only the default branch. Defaults to false.
        allBranches: true
        # If true, recurses through subgroups. If false, it searches only in the base group. Defaults to false.
        includeSubgroups: true
        # If true and includeSubgroups is also true, include Shared Projects, which is gitlab API default.
        # If false only search Projects under the same path. Defaults to true.
        includeSharedProjects: true
        # Reference to a Secret containing an access token. (optional)
        tokenRef:
          secretName: gitlab-token
          key: token
      filters:
      - repositoryMatch: web-socket-service
        branchMatch: "^[a-zA-Z]+-[0-9]+.*$"

We have appset that generates feature-branches application, but refresh without webhook takes too much time.

eadred added a commit to eadred/argo-cd that referenced this issue Dec 18, 2024
Fixes argoproj#21062

Signed-off-by: eadred <eadred77@googlemail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants