gitlabgitlab-cigitlab-ci-runner

GitLab run pipeline only manually and not automatically


My GitLab pipelines execute automatically on every push, I want to manually run pipeline and not on every push.

Pipeline docs: https://docs.gitlab.com/ee/ci/yaml/#workflowrules

I tried this in .gitlab-ci.yml

workflow:
  rules:
    - when: manual    # Error: workflow:rules:rule when unknown value: manual

Solution

  • You should specify a condition that tells Gitlab to not run the pipeline specifically on push events like so:

    workflow:
      rules:
        - if: '$CI_PIPELINE_SOURCE == "push"'
          when: never  # Prevent pipeline run for push event
        - when: always # Run pipeline for all other cases