Skip to content

Commit 56ef825

Browse files
committed
Payload needs to be on one 'input' string
1 parent 2794c56 commit 56ef825

2 files changed

Lines changed: 8 additions & 36 deletions

File tree

.gitlab-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -629,5 +629,5 @@ test-dd-sts:
629629
aud: rapid-seceng-sit
630630
script:
631631
- apt-get update && apt-get install -y curl
632-
- 'echo "API key policy response code: $(curl -s -o /dev/null -w %{http_code} -H "Authorization: Bearer ${DD_STS_OIDC_TOKEN}" https://dd-sts.us1.ddbuild.io/sts/datadog/exchange?policy=dd-trace-py-gitlab)"'
633-
- 'echo "APP key policy response code: $(curl -s -o /dev/null -w %{http_code} -H "Authorization: Bearer ${DD_STS_OIDC_TOKEN}" https://dd-sts.us1.ddbuild.io/sts/datadog/exchange?policy=dd-trace-py-gitlab-app-key)"'
632+
- 'curl -s -o /dev/null -w "API key request http status code: %{http_code}\n" -H "Authorization: Bearer ${DD_STS_OIDC_TOKEN}" "https://dd-sts.us1.ddbuild.io/sts/datadog/exchange?policy=dd-trace-py-gitlab"'
633+
- 'curl -s -o /dev/null -w "APP key request http status code: %{http_code}\n" -H "Authorization: Bearer ${DD_STS_OIDC_TOKEN}" "https://dd-sts.us1.ddbuild.io/sts/datadog/exchange?policy=dd-trace-py-gitlab-app-key"'

.gitlab/release.yml

Lines changed: 6 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -43,37 +43,10 @@ release_pypi_prod:
4343
variables:
4444
PYPI_REPOSITORY: pypi
4545

46-
# notify_datadog_release:
47-
# extends: .release_base
48-
# needs: [ "ddtrace package", "release_pypi_prod" ]
49-
# image: ${PYPI_PUBLISH_IMAGE}
50-
# id_tokens:
51-
# DD_STS_OIDC_TOKEN:
52-
# aud: rapid-seceng-sit
53-
# tags: [ "arch:amd64" ]
54-
# before_script:
55-
# - apt-get update && apt-get install --no-install-recommends -y curl jq
56-
# - >-
57-
# DD_STS_RESPONSE=$(curl -sS
58-
# -H "Authorization: Bearer ${DD_STS_OIDC_TOKEN}"
59-
# "https://dd-sts.us1.ddbuild.io/sts/datadog/exchange?policy=dd-trace-py-gitlab-app-key")
60-
# - export DD_API_KEY=$(echo "$DD_STS_RESPONSE" | jq -re '.api_key')
61-
# - export DD_APP_KEY=$(echo "$DD_STS_RESPONSE" | jq -re '.application_key')
62-
# script:
63-
# - |
64-
# echo "Tag: ${CI_COMMIT_TAG} -> Commit SHA: ${CI_COMMIT_SHA}"
65-
# curl --retry 3 --retry-delay 2 --fail -X POST \
66-
# -H "Content-Type: application/json" \
67-
# -H "DD-API-KEY: ${DD_API_KEY}" \
68-
# -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
69-
# -d "{\"meta\": {\"payload\": {\"version\": \"${CI_COMMIT_TAG}\", \"git_commit_sha\": \"${CI_COMMIT_SHA}\"}}}" \
70-
# https://api.datadoghq.com/api/v2/workflows/dd0d5405-b38c-4f4f-8f4c-c0cd4a65d4d6/instances
71-
7246
notify_datadog_release:
73-
stage: release
74-
when: manual
47+
extends: .release_base
7548
allow_failure: true
76-
needs: []
49+
needs: [ "ddtrace package", "release_pypi_prod" ]
7750
image: ${PYPI_PUBLISH_IMAGE}
7851
id_tokens:
7952
DD_STS_OIDC_TOKEN:
@@ -87,14 +60,13 @@ notify_datadog_release:
8760
"https://dd-sts.us1.ddbuild.io/sts/datadog/exchange?policy=dd-trace-py-gitlab-app-key")
8861
- export DD_API_KEY=$(echo "$DD_STS_RESPONSE" | jq -re '.api_key')
8962
- export DD_APP_KEY=$(echo "$DD_STS_RESPONSE" | jq -re '.application_key')
90-
- '[ -n "$DD_API_KEY" ] && echo "DD_API_KEY is set (${#DD_API_KEY} chars)" || echo "DD_API_KEY is EMPTY"'
91-
- '[ -n "$DD_APP_KEY" ] && echo "DD_APP_KEY is set (${#DD_APP_KEY} chars)" || echo "DD_APP_KEY is EMPTY"'
9263
script:
64+
- sleep 3
9365
- |
94-
echo "Testing workflow API with hardcoded values..."
95-
PAYLOAD='{"version": "v0.0.0-dry-run", "git_commit_sha": "0000000000000000000000000000000000000000"}'
66+
echo "Tag: ${CI_COMMIT_TAG} -> Commit SHA: ${CI_COMMIT_SHA}"
67+
PAYLOAD="{\"version\": \"${CI_COMMIT_TAG}\", \"git_commit_sha\": \"${CI_COMMIT_SHA}\"}"
9668
BODY=$(jq -n --arg input "$PAYLOAD" '{"meta": {"payload": {"input": $input}}}')
97-
curl --retry 3 --retry-delay 2 -w "\nHTTP status: %{http_code}\n" -X POST \
69+
curl --retry 3 --retry-delay 2 --fail -X POST \
9870
-H "Content-Type: application/json" \
9971
-H "DD-API-KEY: ${DD_API_KEY}" \
10072
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \

0 commit comments

Comments
 (0)