Skip to content

Commit

Permalink
ci: fix workflow runs against target branches rc and develop (WPB-864…
Browse files Browse the repository at this point in the history
…5) 🍒 (#3272)

Co-authored-by: Yamil Medina <[email protected]>
github-actions[bot] and yamilmedina authored Aug 2, 2024
1 parent 6472a69 commit 61088d5
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -21,10 +21,22 @@ pipeline {
script {
def commit_hash = sh(script: 'git rev-parse HEAD', returnStdout: true).trim()
def pr_number = BRANCH_NAME.replaceAll(/\D/, '')
echo("Wait for github actions to start for ${BRANCH_NAME}")
def changeTargetBranch = env.CHANGE_TARGET

def targetWorkflowUrl
switch(changeTargetBranch) {
case ['release/candidate']:
targetWorkflowUrl = 'https://api.github.com/repos/wireapp/wire-android/actions/workflows/99460303/runs'
break
default:
targetWorkflowUrl = 'https://api.github.com/repos/wireapp/wire-android/actions/workflows/98603098/runs'
break
}

echo("Wait for github actions to start for ${BRANCH_NAME} against ${changeTargetBranch}")
timeout(time: 45, unit: 'MINUTES') {
waitUntil {
def output = sh label: 'Get runs', returnStdout: true, script: 'curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${CREDENTIALS}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/wireapp/wire-android/actions/workflows/98603098/runs'
def output = sh label: 'Get runs', returnStdout: true, script: "curl -s -L -H 'Accept: application/vnd.github+json' -H 'Authorization: Bearer ${CREDENTIALS}' -H 'X-GitHub-Api-Version: 2022-11-28' ${targetWorkflowUrl}"
def json = readJSON text: output
if (json['message']) {
echo("Output: " + output)
@@ -51,7 +63,7 @@ pipeline {
echo("Wait for apk to be build for ${BRANCH_NAME}")
timeout(time: 70, unit: 'MINUTES') {
waitUntil {
def output = sh label: 'Get runs', returnStdout: true, script: 'curl -s -L -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${CREDENTIALS}" -H "X-GitHub-Api-Version: 2022-11-28" https://api.github.com/repos/wireapp/wire-android/actions/workflows/98603098/runs'
def output = sh label: 'Get runs', returnStdout: true, script: "curl -s -L -H 'Accept: application/vnd.github+json' -H 'Authorization: Bearer ${CREDENTIALS}' -H 'X-GitHub-Api-Version: 2022-11-28' ${targetWorkflowUrl}"
def json = readJSON text: output
def runs = json['workflow_runs']
echo("Looking for hash " + commit_hash)

0 comments on commit 61088d5

Please sign in to comment.