This is an automated email from the ASF dual-hosted git repository.
hyunkun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 3ae0409 fix jenkins job for snapshot version deployment (#7338)
3ae0409 is described below
commit 3ae0409862f11939cf6c238fc6b7620c5ad110f5
Author: Huang YunKun <[email protected]>
AuthorDate: Tue Mar 9 10:57:35 2021 +0800
fix jenkins job for snapshot version deployment (#7338)
---
Jenkinsfile | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/Jenkinsfile b/Jenkinsfile
index 83538c7..3d9993f 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -38,7 +38,7 @@ pipeline {
stage('Duplicate deploy check') {
steps {
script {
- def deployedCommitId = sh(returnStdout: true, script:
"curl --silent
https://builds.apache.org/job/Apache%20Dubbo/job/${env.JOB_BASE_NAME}/lastSuccessfulBuild/artifact/DEPLOY_COMMIT_ID
|| true").trim()
+ def deployedCommitId = sh(returnStdout: true, script:
"curl --silent
https://ci-builds.apache.org/job/Dubbo/job/${env.JOB_BASE_NAME}/lastSuccessfulBuild/artifact/DEPLOY_COMMIT_ID
|| true").trim()
env.DEPLOYED_COMMIT_ID = deployedCommitId
def commitId = sh(returnStdout: true, script: 'git
rev-parse HEAD').trim()
env.COMMIT_ID = commitId
@@ -65,22 +65,26 @@ pipeline {
def commitId = env.COMMIT_ID
println "Current commit id: $commitId"
- def commitStatusJson = sh(script: "curl --silent
https://api.github.com/repos/apache/dubbo/commits/$commitId/status",
returnStdout: true).trim()
- println "Commit status: \r\n$commitStatusJson"
+ def commitStatusJson = sh(script: "curl --silent
https://api.github.com/repos/apache/dubbo/actions/runs", returnStdout:
true).trim()
def jsonSlurper = new JsonSlurper()
def jsonObject = jsonSlurper.parseText(commitStatusJson)
- def status = jsonObject.state
-
- println "Current commit status is $status"
-
- if (status == "success") {
- env.STATUS_CHECK = "true"
- println "Continue to deploy snapshot"
- } else {
- env.STATUS_CHECK = "false"
- println "Current commit status not allow to deploy
snapshot"
+ def runs = jsonObject.workflow_runs
+
+ for (def run in runs) {
+ if (run.workflow_id == 5030221 && run.head_sha ==
commitId &&
+ run.event == "push" && run.head_branch ==
"master") {
+ println "Find github action for current commit:
$run"
+ if (run.status == "completed" && run.conclusion ==
"success") {
+ env.STATUS_CHECK = "true"
+ println "CI status is success for
commitId:$commitId, continue to deploy"
+ } else {
+ env.STATUS_CHECK = "false"
+ println "CI status is not success for
commitId:$commitId"
+ }
+ break;
+ }
}
}
}