Skip to content

Commit 5d42295

Browse files
committed
download the datadog-ci binary directly
1 parent a646478 commit 5d42295

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

.github/actions/upload-datadog/action.yaml

+33-2
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ inputs:
55
api-key:
66
description: "Datadog API key"
77
required: true
8+
version:
9+
description: "DataDog CI binary version to use"
10+
required: false
11+
default: "v2.48.0"
812
runs:
913
using: "composite"
1014
steps:
1115
- shell: bash
1216
run: |
17+
set -e
18+
1319
owner=${{ github.repository_owner }}
1420
echo "owner: $owner"
1521
if [[ $owner != "coder" ]]; then
@@ -21,8 +27,33 @@ runs:
2127
echo "No API key provided, skipping..."
2228
exit 0
2329
fi
24-
npm install -g @datadog/datadog-ci@2.21.0
25-
datadog-ci junit upload --service coder ./gotests.xml \
30+
31+
TMP_DIR=$(mktemp -d)
32+
BINARY_VERSION="${{ inputs.version }}"
33+
34+
if [[ "${{ runner.os }}" == "Windows" ]]; then
35+
BINARY_PATH="${TMP_DIR}/datadog-ci.exe"
36+
BINARY_URL="https://github.com/DataDog/datadog-ci/releases/download/${BINARY_VERSION}/datadog-ci_win-x64"
37+
elif [[ "${{ runner.os }}" == "macOS" ]]; then
38+
BINARY_PATH="${TMP_DIR}/datadog-ci"
39+
BINARY_URL="https://github.com/DataDog/datadog-ci/releases/download/${BINARY_VERSION}/datadog-ci_darwin-arm64"
40+
elif [[ "${{ runner.os }}" == "Linux" ]]; then
41+
BINARY_PATH="${TMP_DIR}/datadog-ci"
42+
BINARY_URL="https://github.com/DataDog/datadog-ci/releases/download/${BINARY_VERSION}/datadog-ci_linux-x64"
43+
else
44+
echo "Unsupported OS: ${{ runner.os }}"
45+
exit 1
46+
fi
47+
48+
echo "Downloading DataDog CI binary version ${BINARY_VERSION} for ${{ runner.os }}..."
49+
curl -sSL "$BINARY_URL" -o "$BINARY_PATH"
50+
51+
# Make binary executable (not needed for Windows)
52+
if [[ "${{ runner.os }}" != "Windows" ]]; then
53+
chmod +x "$BINARY_PATH"
54+
fi
55+
56+
"$BINARY_PATH" junit upload --service coder ./gotests.xml \
2657
--tags os:${{runner.os}} --tags runner_name:${{runner.name}}
2758
env:
2859
DATADOG_API_KEY: ${{ inputs.api-key }}

0 commit comments

Comments
 (0)