Skip to content

Commit c17f7c4

Browse files
committed
CI: Use githubHelper for the PR number
Signed-off-by: Alexey Rivkin <arivkin@nvidia.com>
1 parent 8d0c591 commit c17f7c4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

.ci/jenkins/Jenkinsfile.github

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@ def blueOceanUrl = ""
1616
def currentPrNumber = null
1717

1818
if (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/"

0 commit comments

Comments
 (0)