Skip to content

Commit 00430c5

Browse files
authored
Update entrypoint.sh
1 parent b05d6c4 commit 00430c5

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

entrypoint.sh

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
set -u
44

5+
DEFAULT_POLL_TIMEOUT=10
6+
POLL_TIMEOUT=${POLL_TIMEOUT:-$DEFAULT_POLL_TIMEOUT}
7+
58
git checkout "${GITHUB_REF:11}"
69

710
branch=$(git symbolic-ref --short HEAD)
@@ -13,15 +16,19 @@ sh -c "git remote add mirror $*"
1316
sh -c "echo pushing to $branch branch at $(git remote get-url --push mirror)"
1417
sh -c "git push mirror $branch"
1518

16-
sleep 5s
19+
sleep $POLL_TIMEOUT
1720

1821
pipeline_id=$(curl --header "PRIVATE-TOKEN: $GITLAB_PASSWORD" "https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/repository/commits/${branch}" | jq '.last_pipeline.id')
1922

23+
echo "Triggered CI for branch $branch}"
24+
echo "Working with pipeline id #${pipeline_id}"
25+
echo "Poll timeout set to ${POLL_TIMEOUT}
26+
2027
ci_status="pending"
2128
2229
until [[ "$ci_status" != "pending" && "$ci_status" != "running" ]]
2330
do
24-
sleep 5s
31+
sleep $POLL_TIMEOUT
2532
ci_output=$(curl --header "PRIVATE-TOKEN: $GITLAB_PASSWORD" "https://${GITLAB_HOSTNAME}/api/v4/projects/${GITLAB_PROJECT_ID}/pipelines/${pipeline_id}")
2633
ci_status=$(jq -n "$ci_output" | jq -r .status)
2734
ci_web_url=$(jq -n "$ci_output" | jq -r .web_url)

0 commit comments

Comments
 (0)