Retry hash retrieval from i.diawi.com if it returns null. Fixes #3455

Signed-off-by: Pedro Pombeiro <pombeirp@users.noreply.github.com>
This commit is contained in:
Pedro Pombeiro 2018-06-12 16:44:19 +02:00
parent 268b07fddc
commit 292d1e13ba
No known key found for this signature in database
GPG Key ID: A65DEB11E4BBC647
1 changed files with 10 additions and 4 deletions

14
Jenkinsfile vendored
View File

@ -60,8 +60,11 @@ timeout(90) {
stage('Deploy (Android)') {
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()
def hash = 'null'
for (int r = 0; r < 6 && hash == 'null'; r++) {
sh 'sleep 10'
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
sh ('echo ARTIFACT Android: ' + apkUrl)
@ -77,8 +80,11 @@ timeout(90) {
stage('Deploy (iOS)') {
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()
def hash = 'null'
for (int r = 0; r < 6 && hash == 'null'; r++) {
sh 'sleep 10'
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
sh ('echo ARTIFACT iOS: ' + ipaUrl)