Trigger pipeline manually only

How to disable pipelines to be triggered automatically?

I am having a pipeline for creating a new environment for the branch after it is ready for the testing.

Now all pushed commits are triggering the pipeline but it does not do anything, because the first step has:

  when: manual
  allow_failure: false

If I am adding only: something to the job. Than pipelines are not being triggered automatically, but then if I am trying to start pipeline manually it says that there are no suitable jobs for this branch.

Because of this behaviour, hundreds of not started pipelines are present on the list. Another plus for this approach is being able to set up dynamic build variables for the entire pipeline.

I was hoping that workflow rules (https://docs.gitlab.com/ee/ci/yaml/#workflowrules) will be the tool to make this work, but unfortunately, there is no manual option there.

Has anyone found the solution on how to manage pipelines only manually triggering them?

1 Like

Hi @lkiii
have you manage to stop manual jobs to trigger?

Unfortunately no. We are just flooding the pipelines list with not started pipelines

I ended up using

  only:
    - web
  allow_failure: false

seems to work ok

It appears that Gitlab’s use of “manual” means “requiring manual confirmation”; jobs so marked show up under the pipeline itself thus:

image

If you click the “play” button they start, or you can click the job name and get a panel to let you tweak the settings:

Which is well and good but when you’re trying to work out how to create the equivalent of a Jenkins/Bamboo/Circle “manual trigger” it’s quite misleading.

Infact, what we appear to actually be looking for is “web”.

Hopefully this will help:

workflow:
  rules:
    - if: $CI_JOB_MANUAL

The answer by @zhaparoff did not work for me. But $CI_PIPELINE_SOURCE == 'web' did the trick for me.
More specifically, I needed automatic triggers for merge requests, tags, and default branch commits, but also manual trigger on other branches.

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
    - if: $CI_COMMIT_TAG
    - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
    - if: $CI_PIPELINE_SOURCE == 'web'
1 Like

Hi,

Can you be more precise what you mean with “pipeline manually”?
If I understand you correctly, you don’t want a pipeline to be created automatically (for example with each commit).

You can use workflow:rules

workflow:
  rules:
    - if: $CI_PIPELINE_SOURCE == "web"

The definition of web is:

For pipelines created by selecting New pipeline in the GitLab UI, from the project’s Build > Pipelines section.

There are other option as well see here.


manual is only needed if you want to trigger the job manually, not pipeline!