File tree Expand file tree Collapse file tree 1 file changed +5
-5
lines changed
Expand file tree Collapse file tree 1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -16,11 +16,14 @@ def blueOceanUrl = ""
1616def currentPrNumber = null
1717
1818if (params. githubData) {
19- def slurper = new groovy.json.JsonSlurper ()
20- currentPrNumber = slurper. parseText(params. githubData)?. pr?. toString()
19+ withCredentials([usernamePassword(credentialsId : ' github-token' , passwordVariable : ' GIT_PASSWORD' , usernameVariable : ' GIT_USERNAME' )]) {
20+ githubHelper = GithubHelper . getInstance(" ${ GIT_PASSWORD} " , params. githubData)
21+ }
22+ currentPrNumber = githubHelper. getPRNumber()?. toString()
2123
2224 // Abort previous running builds of the same PR
2325 if (currentPrNumber) {
26+ def slurper = new groovy.json.JsonSlurper ()
2427 try {
2528 Jenkins . instance. getItemByFullName(env. JOB_NAME ). builds. findAll {
2629 it. isBuilding() && it. number < currentBuild. number
@@ -35,9 +38,6 @@ if (params.githubData) {
3538 echo " Could not abort previous builds: ${ e.message} "
3639 }
3740 }
38- withCredentials([usernamePassword(credentialsId : ' github-token' , passwordVariable : ' GIT_PASSWORD' , usernameVariable : ' GIT_USERNAME' )]) {
39- githubHelper = GithubHelper . getInstance(" ${ GIT_PASSWORD} " , params. githubData)
40- }
4141
4242 def blueOceanJobPath = env. JOB_NAME . replace(' /' , ' %2F' )
4343 blueOceanUrl = " ${ JENKINS_URL} blue/organizations/jenkins/${ blueOceanJobPath} /detail/${ env.JOB_BASE_NAME} /${ env.BUILD_NUMBER} /pipeline/"
You can’t perform that action at this time.
0 commit comments