Skip to content

feat: workflow_dispatch approach for GitLab #660

Open

Description

@mavogel

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? :)

Activity

  1. mo-rieger commented on Apr 11, 2024

    @mo-rieger

    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.

  2. stefanprodan commented on Apr 11, 2024

    @stefanprodan
    Member

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

  3. nagyv commented on Apr 15, 2024

    @nagyv

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions