Created
September 27, 2022 04:00
-
-
Save st-cyrill/faeb222b7449cb407e4ed4f9e5b30831 to your computer and use it in GitHub Desktop.
Trigger another build (Jenkins Project) by groovy example; Groovy Postbuild
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jenkins.* | |
import jenkins.model.* | |
import hudson.model.* | |
// pipeline job (org.jenkinsci.plugins.workflow.job.WorkflowJob) | |
def job = "foo" | |
// Trigger another build (Jenkins Project) Example | |
// NOTE: build is defined by Jenkins groovy plugin https://stackoverflow.com/a/36583480 | |
// https://github.com/jenkinsci/workflow-job-plugin/blob/master/src/test/java/org/jenkinsci/plugins/workflow/job/console/DefaultLogStorageTest.java | |
Jenkins.instance.getItemByFullName(job).scheduleBuild2(0, new CauseAction(new Cause.UpstreamCause(manager.build))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment