Restarting Parallel Stages in Jenkins

Viewed 23

I am currently trying to build a Jenkins pipeline that uses multiple parallel steps. The entire execution is as intended, but I am not able to restart a particular stage once I branch into parallel stages.

For example in the below pipeline I want to restart only Stage D2 after the build is complete. But I am getting an option to restart the entire "stage Parallel", but no option to restart the individual stages inside 'stage Parallel'.

Is there any way to restart from an intermediate stage within a parallel stage?

Jenkins pipeline image

pipeline 
{
    agent any
    stages {
        stage('Stage A') {
            agent any
            steps {
                sh """#!/bin/csh
                echo "Currently running A"
                """
                }
        }
        stage('Stage B') {
            agent any
            steps {
                sh """#!/bin/csh
                echo "Currently running B"
                """
                }
            }
        stage('Stage parallel') {
            parallel {
                stage('Stage C') {
                stages {
                    stage('Stage C_1') {
                        steps {
                        sh """#!/bin/csh
                        echo "Currently running C1"
                        """
                        }
                    }
                    stage('Stage C_2') {
                        steps {
                        sh """#!/bin/csh
                        echo "Currently running C2"
                        """
                        }
                    }
                }
                }
                stage ('Stage D') {
                    stages {
                        stage ('Stage D_1') {
                        steps {
                        sh """#!/bin/csh
                        echo "Currently running D1"
                        """
                        }
                    }
                        stage ('Stage D_2') {
                        steps {
                        sh """#!/bin/csh
                        echo "Currently running D2"
                        """
                            }
                    }
                        stage ('Stage D_3') {
                        steps {
                        sh """#!/bin/csh
                        echo "Currently running D3"
                        exit 1
                        """
                            }
                        }   
                    }
                }  
            }
        }
    }
} 
0 Answers
Related