Skip to content

Commit cb31674

Browse files
Attempt 8
1 parent 244be8f commit cb31674

File tree

1 file changed

+18
-19
lines changed

1 file changed

+18
-19
lines changed

Jenkinsfile

+18-19
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,25 @@ def CheckNightlyTag(githubToken, repoOwner, repoName, expectedHash)
2929
def maxAttempts = 30 // 5 minutes with 10-second intervals
3030
def attempt = 0
3131

32+
// Install jq if not already installed
33+
bash """
34+
if ! command -v jq &> /dev/null; then
35+
echo "Installing jq..."
36+
sudo apt-get update
37+
sudo apt-get install -y jq
38+
fi
39+
"""
40+
3241
while (attempt < maxAttempts) {
33-
// Fetch all tags from the remote repository
34-
bash """
35-
git fetch --tags origin
36-
"""
37-
38-
// Check if the nightly tag exists and points to the expected commit
39-
def tagExists = bash("""
40-
if git rev-parse --verify nightly > /dev/null 2>&1; then
41-
echo "true"
42-
else
43-
echo "false"
44-
fi
42+
def tagHash = bash("""
43+
curl -s \\
44+
-H "Authorization: Bearer ${githubToken}" \\
45+
"https://api.github.com/repos/${repoOwner}/${repoName}/git/refs/tags/nightly" |
46+
jq -r '.object.sha'
4547
""", true).trim()
4648

47-
if (tagExists == "true") {
48-
def tagHash = bash("git rev-parse nightly", true).trim()
49-
if (tagHash == expectedHash) {
50-
return true
51-
}
49+
if (tagHash == expectedHash) {
50+
return true
5251
}
5352

5453
sleep 10
@@ -287,7 +286,7 @@ pipeline
287286

288287
//NOTE: We use Debug builds for now even for release.
289288
}
290-
/*
289+
291290
stage('Test')
292291
{
293292
parallel
@@ -404,7 +403,7 @@ pipeline
404403
}
405404
}
406405
}
407-
*/
406+
408407
stage('GitHub Operations')
409408
{
410409
agent { label 'linux' }

0 commit comments

Comments
 (0)