single GH comment for both platforms

This commit is contained in:
Roman Volosovskyi 2018-06-01 07:24:58 +03:00
parent f8981ab6cb
commit b47caf5bbc
No known key found for this signature in database
GPG Key ID: 0238A4B5ECEE70DE
1 changed files with 10 additions and 15 deletions

25
Jenkinsfile vendored
View File

@ -24,7 +24,6 @@ timeout(90) {
load "$HOME/env.groovy" load "$HOME/env.groovy"
try { try {
stage('Git & Dependencies') { stage('Git & Dependencies') {
slackSend color: 'good', message: BRANCH_NAME + '(' + env.CHANGE_BRANCH + ') build started. ' + env.BUILD_URL slackSend color: 'good', message: BRANCH_NAME + '(' + env.CHANGE_BRANCH + ') build started. ' + env.BUILD_URL
@ -59,15 +58,11 @@ timeout(90) {
} }
stage('Deploy (Android)') { stage('Deploy (Android)') {
withCredentials([string(credentialsId: 'diawi-token', variable: 'token'), string(credentialsId: 'GIT_HUB_TOKEN', variable: 'githubToken')] ) { withCredentials([string(credentialsId: 'diawi-token', variable: 'token')] ) {
def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@android/app/build/outputs/apk/release/app-release.apk -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim() def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@android/app/build/outputs/apk/release/app-release.apk -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim()
sh 'sleep 10' sh 'sleep 10'
def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim() def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim()
apkUrl = 'https://i.diawi.com/' + hash apkUrl = 'https://i.diawi.com/' + hash
def commentMsg = "apk uploaded to " + apkUrl + " for branch " + BRANCH_NAME
def ghOutput = sh(returnStdout: true, script: "curl -u status-im:" + githubToken + " -H 'Content-Type: application/json' --data '{\"body\": \"" + commentMsg + "\"}' https://api.github.com/repos/status-im/status-react/issues/" + CHANGE_ID + "/comments")
println("Result of github comment curl: " + ghOutput)
sh ('echo ARTIFACT Android: ' + apkUrl) sh ('echo ARTIFACT Android: ' + apkUrl)
} }
@ -80,26 +75,26 @@ timeout(90) {
} }
stage('Deploy (iOS)') { stage('Deploy (iOS)') {
withCredentials([string(credentialsId: 'diawi-token', variable: 'token'), string(credentialsId: 'GIT_HUB_TOKEN', variable: 'githubToken')]) { withCredentials([string(credentialsId: 'diawi-token', variable: 'token')]) {
def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@status/StatusIm.ipa -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim() def job = sh(returnStdout: true, script: 'curl https://upload.diawi.com/ -F token='+token+' -F file=@status/StatusIm.ipa -F find_by_udid=0 -F wall_of_apps=0 | jq -r ".job"').trim()
sh 'sleep 10' sh 'sleep 10'
def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim() def hash = sh(returnStdout: true, script: "curl -vvv 'https://upload.diawi.com/status?token="+token+"&job="+job+"'|jq -r '.hash'").trim()
ipaUrl = 'https://i.diawi.com/' + hash ipaUrl = 'https://i.diawi.com/' + hash
def commentMsg = "ipa uploaded to " + ipaUrl + " for branch " + BRANCH_NAME
def ghOutput = sh(returnStdout: true, script: "curl -u status-im:" + githubToken + " -H 'Content-Type: application/json' --data '{\"body\": \"" + commentMsg + "\"}' https://api.github.com/repos/status-im/status-react/issues/" + CHANGE_ID + "/comments")
println("Result of github comment curl: " + ghOutput)
sh ('echo ARTIFACT iOS: ' + ipaUrl) sh ('echo ARTIFACT iOS: ' + ipaUrl)
} }
} }
stage('Slack Notification') { stage('Slack/GH Notifications') {
def c = (testPassed ? 'good' : 'warning' ) def c = (testPassed ? 'good' : 'warning' )
slackSend color: c, message: 'Branch: ' + BRANCH_NAME + slackSend color: c, message: ('Branch: ' + BRANCH_NAME + '\nAndroid: ' + apkUrl + '\niOS: ' + ipaUrl);
'\nAndroid: ' + apkUrl +
'\niOS: ' + ipaUrl withCredentials([string(credentialsId: 'GIT_HUB_TOKEN', variable: 'githubToken')]) {
def commentMsg = ("branch " + BRANCH_NAME + ":\\napk uploaded to " + apkUrl + "\\nipa uploaded to " + ipaUrl)
def ghOutput = sh(returnStdout: true, script: "curl -u status-im:" + githubToken + " -H 'Content-Type: application/json' --data '{\"body\": \"" + commentMsg + "\"}' https://api.github.com/repos/status-im/status-react/issues/" + CHANGE_ID + "/comments")
println("Result of github comment curl: " + ghOutput);
}
} }
// Android for e2e // Android for e2e