Welcome to the latest video in our "GitLab CI/CD" series! In this tutorial, we explore how to control when pipeline jobs run using the `when` keyword, a powerful tool for optimizing your GitLab pipeline workflows.
Join us as we break down the functionality of the `when` keyword, showing you how to configure jobs to run conditionally based on specific triggers. You'll learn about the different options available, such as :
1. *`on_success`* (default): The job will run only if all the previous jobs in the pipeline have succeeded.
2. **`on_failure`**: The job will run only if one or more of the previous jobs in the pipeline have failed.
3. **`always`**: The job will run regardless of whether previous jobs have succeeded or failed. This is useful for cleanup tasks or actions that need to occur regardless of the outcome of other jobs.
4. **`manual`**: The job will not run automatically; it must be triggered manually by a user. This is often used for jobs that require human intervention, such as deployments to production environments. When a job is set to `manual`, it will appear in the pipeline view with a "Play" button that users can click to start the job.
5. **`delayed`**: The job will be executed after a specified delay. This is useful for scenarios where you need to wait before running a job. You can specify the delay using the `start_in` keyword.
6. **`never`**: This value explicitly prevents the job from running under any circumstances. It's useful when you want to define a job in your `.gitlab-ci.yml` file but ensure it is never executed. Unlike others this cannot use directly, it’ll be use within rule which we will see in the next video.
Each of these options allows you to control job execution in different ways according to your needs.
We’ll walk through practical examples in your `.gitlab-ci.yml` file, demonstrating how to:
Set jobs to run automatically or manually.
Define jobs that run only on success or failure.
Use the `when` keyword in combination with other pipeline features for more complex scenarios.
With step-by-step guidance, you'll understand how to use this keyword to create more efficient and flexible pipelines that respond dynamically to your CI/CD needs.
By the end of this video, you'll have a solid understanding of how to control job execution timing using the `when` keyword, allowing you to build smarter and more efficient GitLab pipelines.
Don't miss this opportunity to enhance your GitLab CI/CD expertise—click play now and take full control of your pipeline jobs with the `when` keyword!
#GitLab #CICD #PipelineControl #gitlabpipeline #DevOps #SoftwareDevelopment #ProgrammingTutorial #ContinuousIntegration #ContinuousDelivery #DevOpsTutorial #Automation #TechTutorial #LearnGitLab #DevelopmentWorkflow #SoftwareEngineering #GitLabCI #PipelineConfiguration #WhenKeyword
Music: Future Bass
Musician: Michael OnLine