Skip to content

Commit b5cd370

Browse files
Add sha verification in README instructions
1 parent 5285ac1 commit b5cd370

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,12 @@ Execute this script in your GitLab CI's job YAML before running the tests. Pass
1616
test_node:
1717
image: node:latest
1818
script:
19-
- LANGUAGES="js" SITE="datadoghq.com" API_KEY="YOUR_API_KEY_SECRET" source <(curl -Ls https://github.com/DataDog/test-optimization-gitlab-script/releases/download/v1.2.3/script.sh)
19+
- |
20+
LANGUAGES="js" SITE="datadoghq.com" API_KEY="YOUR_API_KEY_SECRET" \
21+
SRC=$(curl -fsSL https://github.com/DataDog/test-optimization-gitlab-script/releases/download/v1.2.5/script.sh); \
22+
echo "$SRC" | sha256sum | grep -q '^2932579e425337d91244232bc6ea2b549e2600703322896ab05a49877b6434e6' && \
23+
source <(echo "$SRC") || \
24+
echo "ERROR: SHA256 mismatch. Datadog Test Optimization autoinstrumentation not enabled." >&2
2025
- npm run test
2126
```
2227
@@ -49,7 +54,12 @@ test_node:
4954
- export DD_API_KEY="YOUR_API_KEY_SECRET"
5055
- export DD_ENV="staging-tests"
5156
- export DD_TAGS="layer:api,team:intake,key:value"
52-
- LANGUAGES="js" SITE="datad0g.com" source <(curl -Ls https://github.com/DataDog/test-optimization-gitlab-script/releases/download/v1.2.3/script.sh)
57+
- |
58+
LANGUAGES="js" SITE="datadoghq.com" \
59+
SRC=$(curl -fsSL https://github.com/DataDog/test-optimization-gitlab-script/releases/download/v1.2.5/script.sh); \
60+
echo "$SRC" | sha256sum | grep -q '^2932579e425337d91244232bc6ea2b549e2600703322896ab05a49877b6434e6' && \
61+
source <(echo "$SRC") || \
62+
echo "ERROR: SHA256 mismatch. Datadog Test Optimization autoinstrumentation not enabled." >&2
5363
- npm run test
5464
```
5565

@@ -65,7 +75,12 @@ To use this script with vitest you need to modify the NODE_OPTIONS environment v
6575
test_node_vitest:
6676
image: node:latest
6777
script:
68-
- LANGUAGES="js" SITE="datadoghq.com" API_KEY="YOUR_API_KEY_SECRET" source <(curl -Ls https://github.com/DataDog/test-optimization-gitlab-script/releases/download/v1.2.3/script.sh)
78+
- |
79+
LANGUAGES="js" SITE="datadoghq.com" API_KEY="YOUR_API_KEY_SECRET" \
80+
SRC=$(curl -fsSL https://github.com/DataDog/test-optimization-gitlab-script/releases/download/v1.2.5/script.sh); \
81+
echo "$SRC" | sha256sum | grep -q '^2932579e425337d91244232bc6ea2b549e2600703322896ab05a49877b6434e6' && \
82+
source <(echo "$SRC") || \
83+
echo "ERROR: SHA256 mismatch. Datadog Test Optimization autoinstrumentation not enabled." >&2
6984
- export NODE_OPTIONS="$NODE_OPTIONS --import $DD_TRACE_ESM_IMPORT"
7085
- npm run test
7186
```

0 commit comments

Comments
 (0)