Skip to content

Commit 2170e6f

Browse files
Attempt 2
1 parent 230e92c commit 2170e6f

File tree

2 files changed

+10
-21
lines changed

2 files changed

+10
-21
lines changed

.github/workflows/nightly-tag.yaml

+1-10
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,4 @@ jobs:
2525
2626
# Create new nightly tag
2727
git tag nightly
28-
git push origin nightly
29-
30-
- name: Set status check
31-
uses: bobheadxi/status@v1
32-
with:
33-
context: nightly-tag
34-
status: success
35-
description: "Nightly tag updated successfully"
36-
env:
37-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
git push origin nightly

Jenkinsfile

+9-11
Original file line numberDiff line numberDiff line change
@@ -24,30 +24,28 @@ def SetGithubStatus(githubToken, context, targetUrl, desc, status, repoOwner, re
2424
"""
2525
}
2626

27-
def WaitForGithubAction(githubToken, repoOwner, repoName, gitHash, actionName)
27+
def CheckNightlyTag(githubToken, repoOwner, repoName, expectedHash)
2828
{
2929
def maxAttempts = 30 // 5 minutes with 10-second intervals
3030
def attempt = 0
3131

3232
while (attempt < maxAttempts) {
33-
def status = bash("""
33+
def tagHash = bash("""
3434
curl -s \\
3535
-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'
3838
""", true).trim()
39-
//"""
40-
if (status == "success") {
39+
40+
if (tagHash == expectedHash) {
4141
return true
42-
} else if (status == "failure" || status == "error") {
43-
error "GitHub Action ${actionName} failed"
4442
}
4543

4644
sleep 10
4745
attempt++
4846
}
4947

50-
error "Timeout waiting for GitHub Action ${actionName} to complete"
48+
error "Timeout waiting for nightly tag to point to commit ${expectedHash}"
5149
}
5250

5351
def UploadArtifactToGithub(githubToken, repoOwner, repoName, tagName, artifactPath, artifactName)
@@ -409,8 +407,8 @@ pipeline
409407
{
410408
withCredentials([string(credentialsId: 'github-token', variable: 'GITHUB_TOKEN')])
411409
{
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)
414412

415413
// Upload Linux executable
416414
unstash 'linux_build'

0 commit comments

Comments
 (0)