Skip to content

Commit bb4e346

Browse files
authored
chore(ci): correct the notify-datadog-release job (#17705)
## Description Workflow automation API does not take in a JSON object with arbitrary keys as input body; rather, it takes in a single `input` string. We need to send our data as a JSON string to be parsed by the workflow downstream ## Testing https://app.datadoghq.com/workflow/dd0d5405-b38c-4f4f-8f4c-c0cd4a65d4d6?debugItem=workflow-data&instance=7b93ae7c-7cfa-419b-b1b3-9b17aac0cbbb https://gitlab.ddbuild.io/DataDog/apm-reliability/dd-trace-py/-/jobs/1635417293 Did a manual trigger from gitlab CI to verify e2e. Note that this was from a branch trigger, not a tag trigger where this usually needs to run ## Risks <!-- Note any risks associated with this change, or "None" if no risks --> ## Additional Notes I had claude do the `jq` stuff Co-authored-by: gyuheon.oh <gyuheon.oh@datadoghq.com>
1 parent 23a1b35 commit bb4e346

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

.gitlab/release.yml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,20 @@ notify_datadog_release:
5555
before_script:
5656
- apt-get update && apt-get install --no-install-recommends -y curl jq
5757
- >-
58-
DD_STS_API_KEY=$(curl -sS
59-
-H "Authorization: Bearer ${DD_STS_OIDC_TOKEN}"
60-
"https://dd-sts.us1.ddbuild.io/sts/datadog/exchange?policy=dd-trace-py-gitlab")
61-
- >-
62-
DD_STS_APP_KEY=$(curl -sS
58+
DD_STS_RESPONSE=$(curl -sS
6359
-H "Authorization: Bearer ${DD_STS_OIDC_TOKEN}"
6460
"https://dd-sts.us1.ddbuild.io/sts/datadog/exchange?policy=dd-trace-py-gitlab-app-key")
65-
- export DD_API_KEY=$(echo "$DD_STS_API_KEY" | jq -re '.api_key')
66-
- export DD_APP_KEY=$(echo "$DD_STS_APP_KEY" | jq -re '.application_key')
61+
- export DD_API_KEY=$(echo "$DD_STS_RESPONSE" | jq -re '.api_key')
62+
- export DD_APP_KEY=$(echo "$DD_STS_RESPONSE" | jq -re '.application_key')
6763
script:
64+
- sleep 3
6865
- |
6966
echo "Tag: ${CI_COMMIT_TAG} -> Commit SHA: ${CI_COMMIT_SHA}"
67+
PAYLOAD="{\"version\": \"${CI_COMMIT_TAG}\", \"git_commit_sha\": \"${CI_COMMIT_SHA}\"}"
68+
BODY=$(jq -n --arg input "$PAYLOAD" '{"meta": {"payload": {"input": $input}}}')
7069
curl --retry 3 --retry-delay 2 --fail -X POST \
7170
-H "Content-Type: application/json" \
7271
-H "DD-API-KEY: ${DD_API_KEY}" \
7372
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
74-
-d "{\"meta\": {\"payload\": {\"version\": \"${CI_COMMIT_TAG}\", \"git_commit_sha\": \"${CI_COMMIT_SHA}\"}}}" \
73+
-d "$BODY" \
7574
https://api.datadoghq.com/api/v2/workflows/dd0d5405-b38c-4f4f-8f4c-c0cd4a65d4d6/instances

0 commit comments

Comments
 (0)