Skip to content

Commit

Permalink
Allow specifying vaccine ref to use in GitLab
Browse files Browse the repository at this point in the history
  • Loading branch information
lloeki committed Feb 12, 2025
1 parent 6b55226 commit c7ff282
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ vaccine:
stage: vaccine
needs: [create-multiarch-lib-injection-image]
script: |
.gitlab/scripts/vaccine.sh
.gitlab/scripts/vaccine.sh master
4 changes: 3 additions & 1 deletion .gitlab/scripts/vaccine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ GH_VACCINE_PAT=$(vault kv get -field=vaccine-token kv/k8s/gitlab-runner/dd-trace
REPO="Datadog/vaccine"
POLL_INTERVAL=60 # seconds

REF="${1:-master}"

# Trigger workflow
echo "Triggering workflow..."
TRIGGER_RESPONSE=$(curl -X POST \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: token $GH_VACCINE_PAT" \
-w "\n%{http_code}" \
"https://api.github.com/repos/$REPO/actions/workflows/vaccine.yml/dispatches" \
-d '{"ref":"master", "inputs": {"commit_sha": "'$CI_COMMIT_SHA'"}}' 2>&1)
-d '{"ref":"'${REF}'", "inputs": {"commit_sha": "'$CI_COMMIT_SHA'"}}' 2>&1)

HTTP_STATUS=$(echo "$TRIGGER_RESPONSE" | tail -n1)
if [ "$HTTP_STATUS" -ne 204 ]; then
Expand Down

0 comments on commit c7ff282

Please sign in to comment.