Snippets Collections
stage ('ANOTHER JOB'){
            steps {
                build job: "Release Helpers/(TEST) Schedule Release Job2",
                parameters: [
                    [$class: 'StringParameterValue', name: 'V', value: "${newRelease}"],
                    [$class: 'StringParameterValue', name: 'ReleaseDate', value: "${currentRelease}"]
                ]
            }
        }
pipeline {
    stages { ... }
    post {
       // only triggered when blue or green sign
       success {
           slackSend(channel: 'alerts-testing', color: 'good', message: ":party_parrot: NOTIFICATION: NEW RELEASE ${newRelease} WILL BE CREATED AUTOMATICALLY :party_parrot:")
       }
       // triggered when red sign
       failure {
           slackSend(channel: 'alerts-testing', color: 'RED', message: ":alarm_clock: NOTIFICATION: NEW RELEASE ${newRelease} WITH SOME FAILURE :alarm_clock:")
       }
       // trigger every-works
       always {
           slackSend ...
       }
    }
}
        newRelease = listLastReleaseTag(service[0])
        newRelease = "V${listLastReleaseTag(service[0])}"
pipeline {
    agent { label 'spot-instance' }
    
        stage('Print') {
            steps {
                script {
                    def now = new Date()
                    dateRelease = now.format("yyyy-MM-dd", TimeZone.getTimeZone('UTC'))
                    echo "Current date ${dateRelease}."
                }
            }
        }

        stage ('Run another Job'){
            steps {
                build job: "Release Helpers/(TEST) Schedule Release Job2",
                parameters: [
                    [$class: 'StringParameterValue', name: 'V', value: "${dateRelease}"]

                ]
            }
        }
}
pipeline {
    agent { label 'spot-instance' }
    
    environment {
        currentDate = sh(returnStdout: true, script: 'date +%Y-%m-%d').trim()
    }

        stage ('Run another Job'){
            steps {
                build job: "Release Helpers/(TEST) Schedule Release Job2",
                parameters: [
                    [$class: 'StringParameterValue', name: 'ReleaseDate', value: "${currentDate}"]

                ]
            }
        }
}

def get_dummy_params(val)
{
    return [string(name: 'dummy', value: "$val")]
}

def create_jobs()
{
    def jobs = [:]
    for (int i=1; i <= 3; i++) {
        def x = i
        jobs["job-$x"] = { -> build([job: "job-$x", parameters: get_dummy_params(x) ]) }
    }
    return jobs
}

stage ('triggering') {
    parallel(create_jobs())
}
stage ('triggering') {
    def jobs = create_jobs()
    parallel([
        'job-1': { jobs['job-1'].call() },
        'job-2': { jobs['job-2'].call() },
        'job-3': { jobs['job-3'].call() },
        ])
}
star

Tue Jun 23 2020 08:10:05 GMT+0000 (UTC) https://issues.jenkins-ci.org/browse/JENKINS-38268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

#jenkins
star

Tue Jun 23 2020 08:09:07 GMT+0000 (UTC) https://issues.jenkins-ci.org/browse/JENKINS-38268?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel

#jenkins

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension