From 31853127d366c87ed33455e07f8cabc8d80fecce Mon Sep 17 00:00:00 2001
From: James Molet <jmolet@redhat.com>
Date: Jul 26 2018 18:55:36 +0000
Subject: [PATCH 1/5] test


---

diff --git a/somefile b/somefile
index ddd4f6b..ca44a44 100644
--- a/somefile
+++ b/somefile
@@ -1,3 +1,3 @@
 hello 1
-merge 13
+merge 14
 other thing

From 57db842cb3abb7a0fb5d368b9bdb730a7915456c Mon Sep 17 00:00:00 2001
From: James Molet <jmolet@redhat.com>
Date: Aug 01 2018 14:14:42 +0000
Subject: [PATCH 2/5] test


---

diff --git a/Jenkinsfile b/Jenkinsfile
index ebc4c2d..eb3c446 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -21,6 +21,16 @@ try {
     def resultComment = (currentResult == 'SUCCESS') ? 'Build passed.' : 'Build failed.'
     def pagurePR = scmVars.GIT_BRANCH.split('/')[-1]  // origin/pr/1234 -> 1234
     def pagureRepo = new URL(scmVars.GIT_URL).getPath() - ~/^\// - ~/.git$/  // https://pagure.io/my-repo.git -> my-repo
+
+    // magic to get jenkins build properties
+    def build = this.getProperty('binding').getVariable('build')
+    def listener = this.getProperty('binding').getVariable('listener')
+    def props = build.getEnvironment(listener)
+    def token = props['PAGURE_API_TOKEN']
+
+    echo "props TOKEN: ${token}"
+    echo "env TOKEN: ${env.PAGURE_API_TOKEN}"
+
     if (pagurePR != 'master') {
       build job: 'pr-updater',
           parameters: [
@@ -30,7 +40,8 @@ try {
                        [$class: 'StringParameterValue', name: 'PERCENT_PASSED', value: resultPercent],
                        [$class: 'StringParameterValue', name: 'COMMENT', value: resultComment],
                        [$class: 'StringParameterValue', name: 'REFERENCE_URL', value: "${env.BUILD_URL}"],
-                       [$class: 'StringParameterValue', name: 'REFERENCE_JOB_NAME', value: "${env.JOB_NAME}"]
+                       [$class: 'StringParameterValue', name: 'REFERENCE_JOB_NAME', value: "${env.JOB_NAME}"],
+                       [$class: 'hudson.model.PasswordParameterValue', name: 'TOKEN', value: "${token}"]
                       ]
     }
 }

From b7d63b59459a11d865aa3cf1737e3824e1aed3b9 Mon Sep 17 00:00:00 2001
From: James Molet <jmolet@redhat.com>
Date: Aug 01 2018 14:20:05 +0000
Subject: [PATCH 3/5] test


---

diff --git a/Jenkinsfile b/Jenkinsfile
index eb3c446..6479410 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -22,13 +22,6 @@ try {
     def pagurePR = scmVars.GIT_BRANCH.split('/')[-1]  // origin/pr/1234 -> 1234
     def pagureRepo = new URL(scmVars.GIT_URL).getPath() - ~/^\// - ~/.git$/  // https://pagure.io/my-repo.git -> my-repo
 
-    // magic to get jenkins build properties
-    def build = this.getProperty('binding').getVariable('build')
-    def listener = this.getProperty('binding').getVariable('listener')
-    def props = build.getEnvironment(listener)
-    def token = props['PAGURE_API_TOKEN']
-
-    echo "props TOKEN: ${token}"
     echo "env TOKEN: ${env.PAGURE_API_TOKEN}"
 
     if (pagurePR != 'master') {
@@ -41,7 +34,7 @@ try {
                        [$class: 'StringParameterValue', name: 'COMMENT', value: resultComment],
                        [$class: 'StringParameterValue', name: 'REFERENCE_URL', value: "${env.BUILD_URL}"],
                        [$class: 'StringParameterValue', name: 'REFERENCE_JOB_NAME', value: "${env.JOB_NAME}"],
-                       [$class: 'hudson.model.PasswordParameterValue', name: 'TOKEN', value: "${token}"]
+                       [$class: 'hudson.model.PasswordParameterValue', name: 'TOKEN', value: "${env.PAGURE_API_TOKEN}"]
                       ]
     }
 }

From 79ce65360810526bebacbea231e785bc93631169 Mon Sep 17 00:00:00 2001
From: James Molet <jmolet@redhat.com>
Date: Aug 01 2018 14:39:39 +0000
Subject: [PATCH 4/5] test


---

diff --git a/Jenkinsfile b/Jenkinsfile
index 6479410..ec5cdfb 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -22,7 +22,11 @@ try {
     def pagurePR = scmVars.GIT_BRANCH.split('/')[-1]  // origin/pr/1234 -> 1234
     def pagureRepo = new URL(scmVars.GIT_URL).getPath() - ~/^\// - ~/.git$/  // https://pagure.io/my-repo.git -> my-repo
 
-    echo "env TOKEN: ${env.PAGURE_API_TOKEN}"
+    echo "env TOKEN ID: ${env.PAGURE_API_TOKEN}"
+
+    withCredentials([string(credentialsId: "${env.PAGURE_API_TOKEN}", variable: 'TOKEN')]) {
+        echo "env TOKEN: ${env.TOKEN}"
+    }
 
     if (pagurePR != 'master') {
       build job: 'pr-updater',

From c19ee79c7b63e110edb0bdc2f8eda190486faa0d Mon Sep 17 00:00:00 2001
From: James Molet <jmolet@redhat.com>
Date: Aug 01 2018 14:40:55 +0000
Subject: [PATCH 5/5] test


---

diff --git a/Jenkinsfile b/Jenkinsfile
index ec5cdfb..2749189 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -26,7 +26,7 @@ try {
 
     withCredentials([string(credentialsId: "${env.PAGURE_API_TOKEN}", variable: 'TOKEN')]) {
         echo "env TOKEN: ${env.TOKEN}"
-    }
+
 
     if (pagurePR != 'master') {
       build job: 'pr-updater',
@@ -38,9 +38,10 @@ try {
                        [$class: 'StringParameterValue', name: 'COMMENT', value: resultComment],
                        [$class: 'StringParameterValue', name: 'REFERENCE_URL', value: "${env.BUILD_URL}"],
                        [$class: 'StringParameterValue', name: 'REFERENCE_JOB_NAME', value: "${env.JOB_NAME}"],
-                       [$class: 'hudson.model.PasswordParameterValue', name: 'TOKEN', value: "${env.PAGURE_API_TOKEN}"]
+                       [$class: 'hudson.model.PasswordParameterValue', name: 'TOKEN', value: "${env.TOKEN}"]
                       ]
     }
+    }
 }
 
 

