[JIRA] (JENKINS-52391) Restarting Parallel Stages

5 views
Skip to first unread message

frank.genois@native-instruments.de (JIRA)

unread,
Jul 5, 2018, 8:32:02 AM7/5/18
to jenkinsc...@googlegroups.com
Frank Genois updated an issue
 
Jenkins / New Feature JENKINS-52391
Restarting Parallel Stages
Change By: Frank Genois
Summary: Restarting Parallel Stagesw Stages
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.10.1#710002-sha1:6efc396)

andrew.bayer@gmail.com (JIRA)

unread,
Nov 16, 2018, 1:28:05 PM11/16/18
to jenkinsc...@googlegroups.com
Andrew Bayer updated an issue
Change By: Andrew Bayer
Labels: stage-restart-improvements
This message was sent by Atlassian Jira (v7.11.2#711002-sha1:fdc329d)

jtaboada@cloudbees.com (JIRA)

unread,
Dec 19, 2018, 4:43:02 AM12/19/18
to jenkinsc...@googlegroups.com
Change By: Jose Blas Camacho Taboada
Assignee: Andrew Bayer Jose Blas Camacho Taboada

jtaboada@cloudbees.com (JIRA)

unread,
Dec 19, 2018, 4:44:02 AM12/19/18
to jenkinsc...@googlegroups.com
Assignee: Jose Blas Camacho Taboada Andrew Bayer

adam@yousician.com (JIRA)

unread,
Apr 5, 2019, 8:14:04 AM4/5/19
to jenkinsc...@googlegroups.com
Adam Kapos commented on New Feature JENKINS-52391
 
Re: Restarting Parallel Stages

We'd love to see support for this. Are there any known workarounds that would allow us to make this work, other than creating a separate pipeline for each parallel branch?

herisanu.gabriel@gmail.com (JIRA)

unread,
Apr 1, 2020, 11:01:05 AM4/1/20
to jenkinsc...@googlegroups.com
Gabriel Herisanu commented on New Feature JENKINS-52391
 
Re: Restarting Parallel Stages

You can use something like this:

#!groovy
def withCheck(String blockName, Closure closure) {
    script {
        def buildStage = true
        catchError(message: 'check previous build status', stageResult:'SUCCESS', buildResult: 'SUCCESS') {
            unstash name:"${blockName}"
            buildStage = false
        }

        if (buildStage) {
            closure.call()
            writeFile file: "${blockName}", text: "1"
            stash name: "${blockName}", includes: "${blockName}"
        }
    }
}

pipeline {
    agent none

    options {
        preserveStashes()
    }

    stages {
        stage("Build and test") {
            parallel() {
                stage("Build/Test Win64") {
                    agent {
                        label 'generic-agents'
                    }
                    steps {
                        withCheck("build-deploy-Win64") {
                            echo "test"
                        }

                        withCheck("test-Win64") {
                            echo "test"
                        }
                    }
                }

                stage("Build/Test Win32") {
                    agent {
                        label 'generic-agents'
                    }
                    steps {
                        withCheck("build-deploy-Win32") {
                            echo "test"
                        }

                        withCheck("test-Win32") {
                            echo "test"
                        }
                    }
                }
            }
        }

        stage("Deploy") {
            agent {
                label 'generic-agents'
            }
            steps {
                withCheck("build-deploy-win64") {
                    echo "test"
                }

                withCheck("test-win64") {
                    echo "test"
                }
            }
        }
    }
}

 

This message was sent by Atlassian Jira (v7.13.12#713012-sha1:6e07c38)
Atlassian logo

herisanu.gabriel@gmail.com (JIRA)

unread,
Apr 1, 2020, 11:03:07 AM4/1/20
to jenkinsc...@googlegroups.com
You can use something like this:
{code:java}

#!groovy
def withCheck(String blockName, Closure closure) {
    script {
        def buildStage = true
        catchError(message: 'check previous build status', stageResult:'SUCCESS', buildResult: 'SUCCESS') {
            unstash name:"${blockName}"
            buildStage = false
        }

        if (buildStage) {
            closure.call()
            writeFile file: "${blockName}", text: "1"
            stash name: "${blockName}", includes: "${blockName}"
        }
    }
}

pipeline {
    agent none

    options {
        preserveStashes()
    }

    stages {
        stage("Build and test") {
            parallel() {
                stage("Build/Test Win64") {
                    agent {
                     label ' generic-agents master '

                    }
                    steps {
                     withCheck("build-deploy-Win64") {
                     echo "test"
                     }

                     withCheck("test-Win64") {
                     echo "test"
                     }
                    }
                }

                stage("Build/Test Win32") {
                    agent {
                     label ' generic-agents master '

                    }
                    steps {
                     withCheck("build-deploy-Win32") {
                     echo "test"
                     }

                     withCheck("test-Win32") {
                     echo "test"
                     }
                    }
                }
            }
        }

        stage("Deploy") {
            agent {
                label ' generic-agents master '

            }
            steps {
                withCheck("build-deploy-win64") {
                    echo "test"
                }

                withCheck("test-win64") {
                    echo "test"
                }
            }
        }
    }
}
{code}
 

wohali@apache.org (JIRA)

unread,
Apr 1, 2020, 4:56:04 PM4/1/20
to jenkinsc...@googlegroups.com
Joan Touzet commented on New Feature JENKINS-52391
 
Re: Restarting Parallel Stages

Gabriel Herisanu This bug is about declarative language features - see the Epic Link and Sprint tagging above.

Your suggestion isn't declarative.

Reply all
Reply to author
Forward
0 new messages