#3148 add a step to flag the PR from the jenkins job
Merged 6 years ago by pingou. Opened 6 years ago by bstinson.
bstinson/pagure ci-add-pr-posting  into  master

file modified
+17 -1
@@ -1,3 +1,14 @@ 

+ import groovy.json.JsonOutput

+ 

+ def notifyPagurePR(repo, msg, status, credentials = 'pagure-auth'){

+     def json = JsonOutput.toJson([name: 'pagure', url: env.JOB_NAME, build: [full_url: currentBuild.absoluteUrl, status: status, number: currentBuild.number]])

+     println json

+ 

+     withCredentials([string(credentialsId: credentials, variable: PAGURE_PUSH_SECRET)]) {

+         sh "curl -X POST -d \'$json\' https://pagure.io/api/0/ci/jenkins/$repo/${env.PAGURE_PUSH_SECRET}/build-finished"

+     }

+ }

+ 

  def onmyduffynode(script){

      ansiColor('xterm'){

          timestamps{
@@ -48,7 +59,7 @@ 

          }

  

      } catch (e) {

-         currentBuild.result = "FAILED"

+         currentBuild.result = "FAILURE"

          throw e

      } finally {

          stage('Sync Artifacts'){
@@ -59,6 +70,11 @@ 

              sh 'cico node done ${SSID}'

          }

  

+         stage('Notify PR'){

+             res = currentBuild.currentResult

+             notifyPagurePR("pagure", "Build " + res + "! ", res, currentBuild.absoluteUrl)

+         }

+ 

          stage('Archive Artifacts'){

              archiveArtifacts artifacts: 'pagure/*.out'

          }

I need the push secret from pagure-ci added to jenkins before we merge this, but here's a first cut.

1 new commit added

  • we already have the credential
6 years ago

rebased onto 95cab91

6 years ago

Commit 5477493 fixes this pull-request

Pull-Request has been merged by pingou

6 years ago