Home > other >  Jenkins execute all sub jobs before marking a top job fail or pass?
Jenkins execute all sub jobs before marking a top job fail or pass?

Time:01-12

def jobs = [
    'subjob1': true,
    'subjob2': false,
    'subjob3': true
]

pipeline
{
    agent { label "ag1" }

    stages
    {
        stage('stage1')
        {
            steps
            {
                script
                {
                    jobs.each
                    {
                        if ("$it.value".toBoolean())
                        {
                            stage("Stage $it.key")
                            {
                                build([job:"$it.key", wait:true, propagate:true])
                            }
                        }
                    }
                }
            }
        }
    }
}

This Jenkins job triggers other sub-jobs (via enter image description here

  • Related