From 27ecedc2f6dececc107ad78ebf3fa2d67c2dd2c4 Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 10:46:26 -0600 Subject: [PATCH 01/11] check if merged --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index b477b029..fa2ced86 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -28,7 +28,11 @@ class GitHubAPI implements Serializable { GHPullRequest ghPullRequest = getRepo().getPullRequest(prNumber) ghPullRequest.merge(mergeMsg) - return ghPullRequest.getMergeCommitSha() + if (ghPullRequest.isMerged()) { + return ghPullRequest.getMergeCommitSha() + } + + return null } def rebasePRByNumber(def prNumber) { From 8d38287d1b758d89caf9db047e859918ac34bf11 Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 10:59:57 -0600 Subject: [PATCH 02/11] loop for 5 seconds --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index fa2ced86..930e0795 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -28,8 +28,18 @@ class GitHubAPI implements Serializable { GHPullRequest ghPullRequest = getRepo().getPullRequest(prNumber) ghPullRequest.merge(mergeMsg) - if (ghPullRequest.isMerged()) { - return ghPullRequest.getMergeCommitSha() + int finish = 5 + int start = 0 + while(start <= finish) { + + if (ghPullRequest.isMerged()) { + return ghPullRequest.getMergeCommitSha() + } + + sleep(1000) + + start = start + 1 + } return null From e7c941256a5f4a1d5ee7b7751a0622c63cafa043 Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 11:01:33 -0600 Subject: [PATCH 03/11] fixing typo --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index 930e0795..93dcdf8c 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -31,13 +31,14 @@ class GitHubAPI implements Serializable { int finish = 5 int start = 0 while(start <= finish) { + print "waiting for merge" if (ghPullRequest.isMerged()) { return ghPullRequest.getMergeCommitSha() } sleep(1000) - + start = start + 1 } From b4685b32d26787fd3d4adf8da466af905404ff4a Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 11:05:15 -0600 Subject: [PATCH 04/11] fixing typo --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index 93dcdf8c..7908fec6 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -28,13 +28,14 @@ class GitHubAPI implements Serializable { GHPullRequest ghPullRequest = getRepo().getPullRequest(prNumber) ghPullRequest.merge(mergeMsg) - int finish = 5 + int finish = 10 int start = 0 while(start <= finish) { print "waiting for merge" if (ghPullRequest.isMerged()) { - return ghPullRequest.getMergeCommitSha() + return 10 + //return ghPullRequest.getMergeCommitSha() } sleep(1000) From e58d6497ebfbfdcfa96f50aee0fa92730d30f569 Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 11:07:38 -0600 Subject: [PATCH 05/11] fixing typo --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index 7908fec6..859670d8 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -31,7 +31,7 @@ class GitHubAPI implements Serializable { int finish = 10 int start = 0 while(start <= finish) { - print "waiting for merge" + println "waiting for merge" if (ghPullRequest.isMerged()) { return 10 @@ -44,7 +44,7 @@ class GitHubAPI implements Serializable { } - return null + return 1 } def rebasePRByNumber(def prNumber) { From b0c7c0eb864939924416052e3db9eee669193d55 Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 11:10:13 -0600 Subject: [PATCH 06/11] fixing typo --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 1 + 1 file changed, 1 insertion(+) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index 859670d8..bd43e1e4 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -33,6 +33,7 @@ class GitHubAPI implements Serializable { while(start <= finish) { println "waiting for merge" + return 5 if (ghPullRequest.isMerged()) { return 10 //return ghPullRequest.getMergeCommitSha() From 17ad6d7818d5adb5d0886bbc96bb1ce0b47327df Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 11:16:49 -0600 Subject: [PATCH 07/11] fixing typo --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index bd43e1e4..ce3a1e69 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -31,15 +31,12 @@ class GitHubAPI implements Serializable { int finish = 10 int start = 0 while(start <= finish) { - println "waiting for merge" - return 5 if (ghPullRequest.isMerged()) { - return 10 - //return ghPullRequest.getMergeCommitSha() + return ghPullRequest.getMergeCommitSha() } - sleep(1000) + sleep 10 start = start + 1 From 5234700c43b69c03d405768e8e394127e65c600b Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 11:19:36 -0600 Subject: [PATCH 08/11] fixing typo --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index ce3a1e69..2b7cfef3 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -36,7 +36,7 @@ class GitHubAPI implements Serializable { return ghPullRequest.getMergeCommitSha() } - sleep 10 + Thread.sleep(1000) start = start + 1 From a322c813b5885bf4f30266f4f7a1fdbc952c28e6 Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 11:22:43 -0600 Subject: [PATCH 09/11] fixing typo --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index 2b7cfef3..1173efa0 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -42,7 +42,7 @@ class GitHubAPI implements Serializable { } - return 1 + return null } def rebasePRByNumber(def prNumber) { From d2faccf567b4695fc505d5d901a5c1a6ff5cc9bd Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 13:27:43 -0600 Subject: [PATCH 10/11] fixing typo --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index 1173efa0..5b179790 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -27,22 +27,9 @@ class GitHubAPI implements Serializable { def mergePRByNumber(def prNumber, String mergeMsg) { GHPullRequest ghPullRequest = getRepo().getPullRequest(prNumber) ghPullRequest.merge(mergeMsg) + GHPullRequest ghPullRequestRefreshed = getRepo().getPullRequest(prNumber) - int finish = 10 - int start = 0 - while(start <= finish) { - - if (ghPullRequest.isMerged()) { - return ghPullRequest.getMergeCommitSha() - } - - Thread.sleep(1000) - - start = start + 1 - - } - - return null + return ghPullRequestRefreshed.getMergeCommitSha() } def rebasePRByNumber(def prNumber) { From 05151efcf73a9acf060ce95fc8337618e013501f Mon Sep 17 00:00:00 2001 From: jstuart Date: Fri, 7 Dec 2018 13:37:54 -0600 Subject: [PATCH 11/11] refreshing pr object --- src/org/centos/contra/pipeline/GitHubAPI.groovy | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/org/centos/contra/pipeline/GitHubAPI.groovy b/src/org/centos/contra/pipeline/GitHubAPI.groovy index 5b179790..36a1825c 100644 --- a/src/org/centos/contra/pipeline/GitHubAPI.groovy +++ b/src/org/centos/contra/pipeline/GitHubAPI.groovy @@ -27,22 +27,22 @@ class GitHubAPI implements Serializable { def mergePRByNumber(def prNumber, String mergeMsg) { GHPullRequest ghPullRequest = getRepo().getPullRequest(prNumber) ghPullRequest.merge(mergeMsg) - GHPullRequest ghPullRequestRefreshed = getRepo().getPullRequest(prNumber) + GHPullRequest ghPullRequestMerged = getRepo().getPullRequest(prNumber) - return ghPullRequestRefreshed.getMergeCommitSha() + return ghPullRequestMerged.getMergeCommitSha() } def rebasePRByNumber(def prNumber) { GHPullRequest ghPullRequest = getRepo().getPullRequest(prNumber) ghPullRequest.merge(null, null, GHPullRequest.MergeMethod.REBASE) + GHPullRequest ghPullRequestMerged = getRepo().getPullRequest(prNumber) - return ghPullRequest.getMergeCommitSha() + return ghPullRequestMerged.getMergeCommitSha() } - def rebasePR(GHPullRequest ghPullRequest) { + void rebasePR(GHPullRequest ghPullRequest) { ghPullRequest.merge(null, null, GHPullRequest.MergeMethod.REBASE) - return ghPullRequest.getMergeCommitSha() } def getRepo() {