From the course: Intermediate Jenkins: Automate, Integrate, and Secure CI/CD Workflows at Scale

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Use test results to stop a pipeline

Use test results to stop a pipeline

In the previous video, we saw how Jenkins can publish test reports. Now let's see how we can use failed tests to manage the stages in a pipeline. For this demo, I've updated the code base with a set of tests that will always fail. This will help us observe different failure modes in the pipeline. I'm logged into my Jenkins server and I've set up two new pipelines with the same stages we saw in the previous lesson. The pipeline I used earlier is running fine and has the green check mark that we know and love. But the pipelines using the test that will always fail are showing a red X indicating a failed pipeline and an orange exclamation point meaning the pipeline is unstable. Let's take a closer look at the differences. Looking at the pipeline overview of the failed pipeline, we can see the failure occurred in the test stage. This is expected. As a result, the build and deploy stages are skipped completely, and the pipeline wraps up by completing the steps in the post-action stage. In…

Contents