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

feat: workflow_dispatch approach for GitLab #660

Open
mavogel opened this issue Dec 5, 2023 · 3 comments
Open

feat: workflow_dispatch approach for GitLab #660

mavogel opened this issue Dec 5, 2023 · 3 comments

Comments

@mavogel
Copy link

mavogel commented Dec 5, 2023

I was wondering if there is something planned to add the workflow_dispatch approach for GitLab, as it is with GitHub

->

_, _, err = g.Client.Repositories.Dispatch(ctx, g.Owner, g.Repo, opts)

During my research I found this issue: https://forum.gitlab.com/t/workflow-dispatch-approach-in-gitlab-ci/72426, which states triggering a pipeline with passed in environment variables (aka payload)

Update: or will the forwarder with a POST to trigger a pipeline / job via webhook do it:

err := postMessage(ctx, f.URL, f.ProxyURL, f.CertPool, event, func(req *retryablehttp.Request) {
?

Or does anyone have experience in implementing it? :)

@mo-rieger
Copy link

I am also trying to close the Feedback Loop from Flux to GitLab. Unfortunately, GitLab doesn't provide any action on a commit status change 😔.

Another option would be to use a Post-Deployment Job that triggers the GitLab Pipeline. But I think it would be nice to have this feature built into flux since I imagine it is a common use case.

To use the forwarder, a proxy would be required to translate the event from the flux provider to a valid GitLab webhook request.

Couldn't we create a GitLab Pipeline Trigger Provider that does this? I have something like this in mind.

---
apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Provider
metadata:
  name: gitlab-trigger
spec:
  type: gitlabtrigger
  address: # https://gitlab.example.com/api/v4/projects/<project_id>/ref/<ref_name>/trigger/pipeline
  secretRef:
    name: #<token> with your pipeline trigger token.
---
apiVersion: notification.toolkit.fluxcd.io/v1beta3
kind: Alert
metadata:
  name: gitlab-trigger
spec:
  summary: "staging (us-west-2)"
  providerRef:
    name: gitlab-trigger
  eventSeverity: info
  eventSources:
    - kind: Kustomization
      name: 'podinfo'
  eventMetadata: # could be used for optional CI/CD variables to be passed to the pipeline.
    - key: 'cluster'
      value: 'staging'
    - key: 'region'
      value: 'us-west-2'

I am happy to provide a PR if we agree that this makes sense.

@stefanprodan
Copy link
Member

We need for GitLab to tell us if the Pipeline Trigger is the right approach. CC @nagyv

@nagyv
Copy link

nagyv commented Apr 15, 2024

Hi! GitLab PM here. One GitLab team is working on https://gitlab.com/groups/gitlab-org/-/epics/10866 with the specific intent of supporting Flux integrations. Please, add you voice to the linked epic!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants