Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyCTHsu committed Jan 14, 2025
1 parent 234c306 commit 098305b
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ vaccine:
stage: vaccine
needs: [create-multiarch-lib-injection-image]
script: |
ls -al
GH_VACCINE_PAT=$(vault kv get -field=vaccine-token kv/k8s/gitlab-runner/dd-trace-rb/github-token)
REPO="TonyCTHsu/vaccine"
POLL_INTERVAL=30 # seconds
POLL_INTERVAL=60 # seconds
# Trigger workflow
echo "Triggering workflow..."
Expand All @@ -171,15 +172,9 @@ vaccine:
-d '{"ref":"master", "inputs": {"commit_sha": "'$CI_COMMIT_SHA'"}}' 2>&1)
HTTP_STATUS=$(echo "$TRIGGER_RESPONSE" | tail -n1)
RESPONSE_BODY=$(echo "$TRIGGER_RESPONSE" | sed '$ d')
if [ "$HTTP_STATUS" -eq 403 ]; then
echo "Error: Workflow trigger failed - Authentication failed"
echo "Response: $RESPONSE_BODY"
exit 1
elif [ "$HTTP_STATUS" -ne 204 ]; then
if [ "$HTTP_STATUS" -ne 204 ]; then
echo "Error: Workflow trigger failed with status $HTTP_STATUS"
echo "Response: $RESPONSE_BODY"
echo "Response: $(echo "$TRIGGER_RESPONSE" | sed '$ d')"
exit 1
fi
Expand All @@ -197,18 +192,12 @@ vaccine:
HTTP_STATUS=$(echo "$RUNS_RESPONSE" | tail -n1)
RESPONSE_BODY=$(echo "$RUNS_RESPONSE" | sed '$ d')
if [ "$HTTP_STATUS" -eq 403 ]; then
echo "Error: Fetching runs failed - Authentication failed"
echo "Response: $RESPONSE_BODY"
exit 1
elif [ "$HTTP_STATUS" -ne 200 ]; then
if [ "$HTTP_STATUS" -ne 200 ]; then
echo "Error: Fetching runs failed with status $HTTP_STATUS"
echo "Response: $RESPONSE_BODY"
exit 1
fi
echo "Response body: $RESPONSE_BODY"
# Get the most recent run ID
WORKFLOW_ID=$(echo "$RESPONSE_BODY" | jq -r '.workflow_runs[0].id')
Expand All @@ -230,11 +219,7 @@ vaccine:
HTTP_STATUS=$(echo "$RUN_RESPONSE" | tail -n1)
RESPONSE_BODY=$(echo "$RUN_RESPONSE" | sed '$ d')
if [ "$HTTP_STATUS" -eq 403 ]; then
echo "Error: Fetching run status failed - Authentication failed"
echo "Response: $RESPONSE_BODY"
exit 1
elif [ "$HTTP_STATUS" -ne 200 ]; then
if [ "$HTTP_STATUS" -ne 200 ]; then
echo "Error: Fetching run status failed with status $HTTP_STATUS"
echo "Response: $RESPONSE_BODY"
exit 1
Expand Down

0 comments on commit 098305b

Please sign in to comment.