Run Conditions

This feature is only available to Pipes that have been created via the Pipekit Web UI.

You can choose which git event(s) trigger the execution of a Pipe, and on which cluster the resulting pipe is executed. You can choose from the following options:

  • Git Branch

  • Git Tag

  • Git Pull/Merge Request

For each one, you can choose a specific name (eg Branch="main") or a regex (eg Branch="^feature/.*$"). Finally, for each source type and name/regex, you can define which cluster the workflow is executed on.

For example, any git branches that match the regex ^feature/.*$ could trigger the Pipe to run on the dev cluster, any git branches that match the regex ^release/.*$ could trigger the Pipe to run on the staging cluster, and any git branches that match the regex ^main$ could trigger the Pipe to run on the prod cluster.

You can choose multiple options. If you do so, the Pipe will run if any of the options are met.

Pull/Merge Request Labels

If there are labels for your pull/merge requests to be used (github, gitlab), you can choose which labels will trigger the Pipe Run. To use this feature, while creating a pipe, choose the Pull Request Run Condition Source Type, and then select the label(s) you want to match against.

When a pull/merge request is submitted to the repository, Pipekit will check if the pull/merge request labels match the run condition labels you have selected. The pipe will then trigger a run if one of the the run condition labels match the pull/merge request labels.

If you leave the labels field blank, the Pipe will run for all pull/merge requests matching the regex.

Currently, Pipekit only supports selecting run condition labels when creating a pipe from scratch. You can't modify an existing Pipe's run condition labels after the pipe has been created.

Environment variables and Pipe information

Git Commit

Pipekit passes an environment variable to the workflow when it is triggered by Run Conditions. The variable, GIT_COMMIT contains either the sha1 of the Pull/Merge request, or the name of the branch or tag that triggered the workflow.

Pipe information

Pipekit also injects labels into your running workflow, which you could turn into environment variables:

kind: Workflow
  name: get-pipe-info
    - name: get-pipe-info
        - name: RUN_UUID
              fieldPath: metadata.labels['']
        - name: PIPE_UUID
              fieldPath: metadata.labels['']
        image: alpine
          - sh
          - -c
          - |
            echo: "$RUN_UUID"
            echo: "$PIPE_UUID"
            echo: "$PIPE_UUID/runs/$RUN_UUID"

Last updated