Skip to content

Commit 6a3112d

Browse files
committed
for running benchmarks, retrieve GH token scoping the benchmarking-platform repo
1 parent 320a657 commit 6a3112d

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

.gitlab/benchmarks/microbenchmarks.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
before_script:
33
- |
44
set +e
5-
error_output=$({ dd-octo-sts token --scope DataDog/dd-trace-dotnet --policy gitlab.github-access.read-contents > "/tmp/github-token"; } 2>&1)
5+
echo "Attempting to retrieve a GitHub token for scope '$DDOCTOSTS_SCOPE' with policy '$DDOCTOSTS_POLICY' with dd-octo-sts..."
6+
error_output=$({ dd-octo-sts token --scope $DDOCTOSTS_SCOPE --policy $DDOCTOSTS_POLICY > "/tmp/github-token"; } 2>&1)
67
exit_code=$?
78
if [ $exit_code -ne 0 ]; then
8-
echo "ERROR: Failed to retrieve a GitHub token with dd-octo-sts gitlab.github-access.read-contents policy."
9+
echo "ERROR: Failed to retrieve GitHub token."
910
echo "Original error: $error_output"
1011
echo "Continuing execution anyway..."
1112
fi
@@ -26,6 +27,11 @@ build-dd-trace-dotnet-microbenchmarks-ami:
2627
DDOCTOSTS_ID_TOKEN:
2728
aud: dd-octo-sts
2829
variables:
30+
# Allows ephemeral instances to read content from dd-trace-dotnet
31+
# This is not strictly necessary in the current AMI build
32+
DDOCTOSTS_SCOPE: "DataDog/dd-trace-dotnet"
33+
DDOCTOSTS_POLICY: "gitlab.github-access.read-contents"
34+
2935
AWS_REGION: "us-east-1"
3036

3137
# Branch containing a provision for building the AMI
@@ -75,6 +81,10 @@ run-benchmarks:
7581
rules:
7682
- when: on_success
7783
variables:
84+
# Allows ephemeral instances to read content from benchmarking-platform
85+
DDOCTOSTS_SCOPE: "DataDog/benchmarking-platform"
86+
DDOCTOSTS_POLICY: "gitlab.github-access.read-contents"
87+
7888
AWS_REGION: "us-east-1"
7989

8090
# Branch containing 1. scripts to launch Windows benchmarks on ephemeral
@@ -87,10 +97,10 @@ run-benchmarks:
8797

8898
# Whether to cleanup ephemeral instances after benchmarks are run
8999
CLEANUP: "true"
90-
91100
before_script:
92101
- !reference [.dd-octo-sts-setup, before_script]
93102
script:
103+
- export GITHUB_TOKEN=$(cat /tmp/github-token)
94104
- git clone --branch $BP_INFRA_BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
95105
- ./platform/steps/run-windows-benchmarks.sh
96106
after_script:

0 commit comments

Comments
 (0)