@@ -24,30 +24,28 @@ def SetGithubStatus(githubToken, context, targetUrl, desc, status, repoOwner, re
24
24
"""
25
25
}
26
26
27
- def WaitForGithubAction (githubToken , repoOwner , repoName , gitHash , actionName )
27
+ def CheckNightlyTag (githubToken , repoOwner , repoName , expectedHash )
28
28
{
29
29
def maxAttempts = 30 // 5 minutes with 10-second intervals
30
30
def attempt = 0
31
31
32
32
while (attempt < maxAttempts) {
33
- def status = bash("""
33
+ def tagHash = bash("""
34
34
curl -s \\
35
35
-H "Authorization: Bearer ${ githubToken} " \\
36
- "https://api.github.com/repos/${ repoOwner} /${ repoName} /commits/ ${ gitHash } /status " |
37
- jq -r '.statuses[] | select(.context == " ${ actionName } ") | .state '
36
+ "https://api.github.com/repos/${ repoOwner} /${ repoName} /git/refs/tags/nightly " |
37
+ jq -r '.object.sha '
38
38
""" , true ). trim()
39
- // """
40
- if (status == " success " ) {
39
+
40
+ if (tagHash == expectedHash ) {
41
41
return true
42
- } else if (status == " failure" || status == " error" ) {
43
- error " GitHub Action ${ actionName} failed"
44
42
}
45
43
46
44
sleep 10
47
45
attempt++
48
46
}
49
47
50
- error " Timeout waiting for GitHub Action ${ actionName } to complete "
48
+ error " Timeout waiting for nightly tag to point to commit ${ expectedHash } "
51
49
}
52
50
53
51
def UploadArtifactToGithub (githubToken , repoOwner , repoName , tagName , artifactPath , artifactName )
@@ -409,8 +407,8 @@ pipeline
409
407
{
410
408
withCredentials([string(credentialsId : ' github-token' , variable : ' GITHUB_TOKEN' )])
411
409
{
412
- // Wait for GitHub Action to create/update the nightly tag
413
- WaitForGithubAction (' $GITHUB_TOKEN' , REPO_OWNER , REPO_NAME , GIT_HASH , " nightly-tag " )
410
+ // Wait for nightly tag to be updated to the correct commit
411
+ CheckNightlyTag (' $GITHUB_TOKEN' , REPO_OWNER , REPO_NAME , GIT_HASH )
414
412
415
413
// Upload Linux executable
416
414
unstash ' linux_build'
0 commit comments