File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 2
2
3
3
set -u
4
4
5
+ DEFAULT_POLL_TIMEOUT=10
6
+ POLL_TIMEOUT=${POLL_TIMEOUT:- $DEFAULT_POLL_TIMEOUT }
7
+
5
8
git checkout " ${GITHUB_REF: 11} "
6
9
7
10
branch=$( git symbolic-ref --short HEAD)
@@ -13,15 +16,19 @@ sh -c "git remote add mirror $*"
13
16
sh -c " echo pushing to $branch branch at $( git remote get-url --push mirror) "
14
17
sh -c " git push mirror $branch "
15
18
16
- sleep 5s
19
+ sleep $POLL_TIMEOUT
17
20
18
21
pipeline_id=$( curl --header " PRIVATE-TOKEN: $GITLAB_PASSWORD " " https://${GITLAB_HOSTNAME} /api/v4/projects/${GITLAB_PROJECT_ID} /repository/commits/${branch} " | jq ' .last_pipeline.id' )
19
22
23
+ echo " Triggered CI for branch $branch }"
24
+ echo " Working with pipeline id #${pipeline_id} "
25
+ echo " Poll timeout set to ${POLL_TIMEOUT}
26
+
20
27
ci_status=" pending"
21
28
22
29
until [[ " $ci_status " != " pending" && " $ci_status " != " running" ]]
23
30
do
24
- sleep 5s
31
+ sleep $POLL_TIMEOUT
25
32
ci_output=$( curl --header " PRIVATE-TOKEN: $GITLAB_PASSWORD " " https://${GITLAB_HOSTNAME} /api/v4/projects/${GITLAB_PROJECT_ID} /pipelines/${pipeline_id} " )
26
33
ci_status=$( jq -n " $ci_output " | jq -r .status)
27
34
ci_web_url=$( jq -n " $ci_output " | jq -r .web_url)
You can’t perform that action at this time.
0 commit comments