Skip to main content

How do I use the when: manual section in a pipeline as code?

To use the when: manual section in a GitLab pipeline as code, you can define a job or a step that requires manual intervention to proceed. This can be useful when you want to pause the pipeline execution and prompt a user to manually trigger the next step.

Here's an example of how you can use the when: manual section:

deploy:
stage: deploy
script:
- echo "Deploying..."
when: manual

In the above example:

The deploy job is defined in the deploy stage of the pipeline.

The script section includes the necessary deployment commands or scripts.

The when: manual section indicates that the job should wait for manual intervention before proceeding.

When this pipeline is executed, the deploy job will pause and display a manual play button in the GitLab UI. A user with appropriate permissions can manually trigger the job to continue the pipeline execution.

Using the when: manual section allows you to control the flow of your pipeline and ensure that critical steps, such as deployments, require manual approval or intervention before proceeding.

If you have further questions or need assistance with implementing the when: manual section or optimizing your pipelines, feel free to reach out to Cloud-Runner. We specialize in helping developers maximize the efficiency and performance of their CI/CD workflows. Visit cloud-runner.com to learn more about our services and how we can support your pipeline automation needs.