diff --git a/Jenkinsfile b/Jenkinsfile index 56954cf955..a5e0c5b0ea 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -24,7 +24,6 @@ timeout(90) { load "$HOME/env.groovy" try { - stage('Git & Dependencies') { slackSend color: 'good', message: BRANCH_NAME + '(' + env.CHANGE_BRANCH + ') build started. ' + env.BUILD_URL @@ -59,15 +58,11 @@ timeout(90) { } 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() sh 'sleep 10' 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 - - 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) } @@ -80,26 +75,26 @@ timeout(90) { } 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() sh 'sleep 10' 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 - 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) } } - stage('Slack Notification') { + stage('Slack/GH Notifications') { def c = (testPassed ? 'good' : 'warning' ) - slackSend color: c, message: 'Branch: ' + BRANCH_NAME + - '\nAndroid: ' + apkUrl + - '\niOS: ' + ipaUrl + slackSend color: c, message: ('Branch: ' + BRANCH_NAME + '\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