Created
April 6, 2017 13:02
-
-
Save visitbethel/f45fab597b54fdc7b4707284fe8a7fbf to your computer and use it in GitHub Desktop.
Get Jobname from Pipeline job
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
node { | |
echo 'Hello World' | |
// [Pipeline] echo | |
//here the steps : [SEFS_TEST_JUNIT_MODEL; | |
// BUILD_TEST_GOAL=org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject@1b3cff4[ShipmentEFS/SEFS_COMMON-6270/PARENT_POM], SEFS_TEST_JUNIT_MODEL; | |
// BUILD_TEST_GOAL=org.jenkinsci.plugins.workflow.multibranch.WorkflowMultiBranchProject@16d92a30[ShipmentEFS/SEFS_COMMON-6270/ASRI]] | |
echo "here the steps : ${STEPS}" | |
for (int i=0; i < STEPS.length; i++) { | |
echo "${STEPS[i]}" | |
echo STEPS[i].toString() | |
echo "${STEPS[i].BUILD_TEST_GOAL}" | |
def STEP = STEPS[i].BUILD_TEST_GOAL | |
sh "echo ${STEP.fullName}" | |
def n_minus_one = stepName(STEP.fullName) | |
stage(n_minus_one) { | |
//println STEP.getProperty('name') | |
// echo "name= " + STEP.name | |
// echo "fname= " + STEP.fullName | |
// echo "dname= " + STEP.displayName | |
// echo "rname= " + STEP.getClass() | |
// echo "rname= " + STEP.fullName.split('/') | |
// echo " > " + n_minus_one | |
build STEP.fullName | |
} | |
} | |
} | |
@NonCPS | |
def stepName(fullName) { | |
def a = fullName.split('/') | |
return a[a.size() -2 ] | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment