Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
73dce6c8
Commit
73dce6c8
authored
Dec 03, 2018
by
Rémy Coutable
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[QA] Better retrieve job ID for a retried job
Signed-off-by:
Rémy Coutable
<
remy@rymai.me
>
parent
2aeff449
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
5 deletions
+6
-5
scripts/review_apps/review-apps.sh
scripts/review_apps/review-apps.sh
+6
-5
No files found.
scripts/review_apps/review-apps.sh
View file @
73dce6c8
...
...
@@ -289,8 +289,8 @@ function get_job_id() {
local
url
=
"https://gitlab.com/api/v4/projects/
${
CI_PROJECT_ID
}
/pipelines/
${
CI_PIPELINE_ID
}
/jobs?per_page=100&page=
${
page
}${
query_string
}
"
echoerr
"GET
${
url
}
"
local
job_id
=
$(
curl
--silent
--show-error
--header
"PRIVATE-TOKEN:
${
API_TOKEN
}
"
"
${
url
}
"
| jq
"
.[] | select(.name ==
\"
${
job_name
}
\"
) | .id
"
)
[[
"
${
job_id
}
"
==
""
&&
"
${
page
}
"
-lt
"
$max_page
"
]]
||
break
local
job_id
=
$(
curl
--silent
--show-error
--header
"PRIVATE-TOKEN:
${
API_TOKEN
}
"
"
${
url
}
"
| jq
"
map(select(.name ==
\"
${
job_name
}
\"
)) | map(.id) | last
"
)
[[
"
${
job_id
}
"
==
"
null
"
&&
"
${
page
}
"
-lt
"
$max_page
"
]]
||
break
((
page++
))
done
...
...
@@ -328,17 +328,18 @@ function wait_for_job_to_be_done() {
# In case the job hasn't finished yet. Keep trying until the job times out.
local
interval
=
30
local
elapsed
=
0
local
elapsed
_seconds
=
0
while
true
;
do
local
job_status
=
$(
curl
--silent
--show-error
--header
"PRIVATE-TOKEN:
${
API_TOKEN
}
"
"
${
url
}
"
| jq
".status"
|
sed
-e
s/
\"
//g
)
[[
"
${
job_status
}
"
==
"pending"
||
"
${
job_status
}
"
==
"running"
]]
||
break
printf
"."
((
elapsed+
=
$interval
))
((
elapsed
_seconds
+
=
$interval
))
sleep
${
interval
}
done
echoerr
"Waited '
${
job_name
}
' for
${
elapsed
}
seconds."
local
elapsed_minutes
=
$((
elapsed_seconds
/
60
))
echoerr
"Waited '
${
job_name
}
' for
${
elapsed_minutes
}
minutes."
if
[[
"
${
job_status
}
"
==
"failed"
]]
;
then
echo
"The '
${
job_name
}
' failed."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment