1- .setup :
2- script :
3- - mkdir -p ~/.aws
4- - /app/bp-infra/tools/fetch-ssm-parameter.sh $AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER > ~/.aws/config || exit $?
5- - export AWS_PROFILE=ephemeral-infra-ci
6- - export BP_INFRA_KEY_PAIR_NAME=$(cat ~/.aws/key-pair-name.txt)
7- - export BP_INFRA_KEY_PAIR_PRIVATE_KEY_PATH=~/.aws/key-pair-private-key.pem
1+ .dd-octo-sts-setup :
2+ before_script :
3+ - |
4+ set +e
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)
7+ exit_code=$?
8+ if [ $exit_code -ne 0 ]; then
9+ echo "Error: Failed to retrieve GitHub token."
10+ echo "Original error: $error_output"
11+ echo "Continuing execution anyway..."
12+ fi
13+ set -e
814
915stages :
10- - infra-update
16+ - build-win
1117 - check-azure-pipeline
1218 - benchmarks
1319 - benchmarks-win
@@ -19,64 +25,76 @@ workflow:
1925variables :
2026 MACROBENCHMARKS_CI_IMAGE : 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/benchmarking-platform:dotnet-throughput-8
2127
22- check_azure_pipeline :
28+ check-azure-pipeline :
2329 stage : check-azure-pipeline
30+ tags : ["arch:amd64"]
2431 image : $MACROBENCHMARKS_CI_IMAGE
25- script :
26- - git clone --branch dd-trace-dotnet/macro https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform && cd platform
27- - ./wait-for-pipeline.sh
32+ rules :
33+ - if : $CI_COMMIT_REF_NAME == "master"
34+ interruptible : false
35+ - interruptible : true
36+ timeout : 1h
2837 artifacts :
2938 name : " artifacts"
3039 when : always
3140 paths :
3241 - platform/artifacts/
3342 - build-id.txt
3443 expire_in : 3 months
35- tags : ["arch:amd64"]
36- timeout : 1h
37- rules :
38- - if : $CI_COMMIT_REF_NAME == "master"
39- interruptible : false
40- - interruptible : true
44+ variables :
45+ # Set this for quickly testing benchmarking workflows.
46+ HARDCODED_BUILD_ID : " "
47+ script :
48+ - |
49+ if [[ -n "$HARDCODED_BUILD_ID" ]]; then
50+ echo "Using hardcoded build ID $HARDCODED_BUILD_ID"
51+ echo "export buildId=$HARDCODED_BUILD_ID" > build-id.txt
52+ exit 0
53+ fi
54+ - git clone --branch dd-trace-dotnet/macro https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform && cd platform
55+ - ./wait-for-pipeline.sh
56+
4157
42- update-bp-infra :
43- stage : infra-update
58+ build-dd-trace-dotnet-macrobenchmarks-ami :
59+ stage : build-win
4460 tags : ["arch:amd64"]
45- timeout : 3h
61+ image : registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dd-trace-dotnet-macro
4662 allow_failure : true
47- # Image created in the following job https://gitlab.ddbuild.io/DataDog/benchmarking-platform-tools/-/jobs/869830045
48- image : registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dotnet-microbenchmarks-2
63+ when : manual
64+ timeout : 3h
65+ variables :
66+ AWS_REGION : " us-east-1"
67+
68+ # Branch containing a provision for building the macrobenchmarks AMI
69+ BP_INFRA_BENCHMARKING_PLATFORM_BRANCH : " dd-trace-dotnet/macro"
4970
71+ # Whether to cleanup instances after building the AMI, since the AMI is
72+ # based on an instance that is created in this job
73+ CLEANUP : " true"
5074 script :
51- - git clone --branch dd-trace-dotnet/macro https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
52- - mkdir -p ~/.aws
53- - /app/bp-infra/tools/fetch-ssm-parameter.sh $AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER >> ~/.aws/config || exit $?
54- - aws ssm get-parameter --region "$AWS_REGION" --name "ci.${CI_PROJECT_NAME}.ephemeral-infra-ci.windows-benchmarking-key-pair-name" --with-decryption --query "Parameter.Value" --out text >> ~/.aws/key-pair-name.txt
55- - aws ssm get-parameter --region "$AWS_REGION" --name "ci.${CI_PROJECT_NAME}.ephemeral-infra-ci.windows-benchmarking-key-private-key" --with-decryption --query "Parameter.Value" --out text >> ~/.aws/key-pair-private-key.pem
56- - export AWS_PROFILE=ephemeral-infra-ci
57- - export BP_INFRA_KEY_PAIR_NAME=$(cat ~/.aws/key-pair-name.txt)
58- - export BP_INFRA_KEY_PAIR_PRIVATE_KEY_PATH=~/.aws/key-pair-private-key.pem
59- - bp-infra launch --no-cleanup --provision ./platform/ephemeral-infra/provisions/macrobenchmark-ami.yaml --region "${AWS_REGION}" --bypass-stack-destroy
75+ - git clone --branch $BP_INFRA_BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
76+ - CLEANUP_ARG=$([[ "$CLEANUP" == "false" ]] && echo "--no-cleanup" || echo "")
77+ - |
78+ bp-infra launch --region "${AWS_REGION}" --os "windows" \
79+ --provision ./platform/ephemeral-infra/ami.yaml \
80+ --bypass-stack-destroy \
81+ $CLEANUP_ARG
6082 after_script :
61- - !reference [.setup, script]
83+ # Makes sure the instance is cleaned up.
84+ # Note: This does not clean up the created AMI.
6285 - |
63- bp-infra cleanup --provision ./platform/ephemeral-infra/provisions/macrobenchmark-ami.yaml \
64- --region "${AWS_REGION}" \
65- --bypass-stack-destroy
66- rules :
67- - when : manual
68- variables :
69- AWS_REGION : " us-east-1"
70- CLEANUP : " false"
71- AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER : " ci.dd-trace-dotnet.ephemeral-infra-ci.dd-trace-dotnet-profile"
72- AWS_EPHEMERAL_INFRA_PROFILE_NAME : " ephemeral-infra-ci"
73- AWS_EPHEMERAL_INFRA_ARTIFACTS_BUCKET_URI : " s3://windows-benchmarking-results/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_JOB_ID"
74- AWS_EPHEMERAL_INFRA_REGION : " us-east-1"
86+ if [ "$CLEANUP" == "true" ]; then
87+ bp-infra cleanup --region "${AWS_REGION}" --os "windows" \
88+ --provision ./platform/ephemeral-infra/ami.yaml \
89+ --bypass-stack-destroy
90+ else
91+ echo "'CLEANUP' is set to 'false'. Will not cleanup."
92+ fi
7593
7694.benchmarks-x86 :
7795 stage : benchmarks
7896 tags : ["runner:apm-k8s-same-cpu"]
79- needs : ["check_azure_pipeline "]
97+ needs : ["check-azure-pipeline "]
8098 timeout : 2h
8199 retry :
82100 max : 2
@@ -260,7 +278,7 @@ profiler_cpu_timer_create-x86:
260278.benchmarks-arm64 :
261279 stage : benchmarks
262280 tags : ["runner:apm-k8s-same-cpu"]
263- needs : ["check_azure_pipeline "]
281+ needs : ["check-azure-pipeline "]
264282 timeout : 2h
265283 retry :
266284 max : 2
@@ -453,10 +471,12 @@ profiler_cpu_timer_create-arm64:
453471
454472.benchmarks-win :
455473 stage : benchmarks-win
456- needs : ["check_azure_pipeline "]
474+ needs : ["check-azure-pipeline "]
457475 tags : ["arch:amd64"]
458476 image : registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dd-trace-dotnet-macro
459- timeout : 2h
477+ id_tokens :
478+ DDOCTOSTS_ID_TOKEN :
479+ aud : dd-octo-sts
460480 retry :
461481 max : 2
462482 when :
@@ -470,13 +490,18 @@ profiler_cpu_timer_create-arm64:
470490 - if : $CI_COMMIT_REF_NAME == "master"
471491 interruptible : false
472492 - interruptible : true
493+ timeout : 2h
473494 artifacts :
474495 name : " artifacts"
475496 when : always
476497 paths :
477498 - platform/artifacts/
478499 expire_in : 3 months
479500 variables :
501+ # Allows ephemeral instances to read content from benchmarking-platform
502+ DDOCTOSTS_SCOPE : " DataDog/benchmarking-platform"
503+ DDOCTOSTS_POLICY : " gitlab.github-access.read-contents"
504+
480505 AWS_REGION : " us-east-1"
481506
482507 # Branch containing 1. scripts to launch Windows benchmarks on ephemeral
@@ -503,12 +528,16 @@ profiler_cpu_timer_create-arm64:
503528 K6_OPTIONS_HIGH_LOAD_VUS : 2
504529
505530 DD_RUNTIME_METRICS_ENABLED : true
531+ before_script :
532+ - !reference [.dd-octo-sts-setup, before_script]
506533 script :
507534 - source build-id.txt
508- - echo "Building for the following build https://dev.azure.com/datadoghq/dd-trace-dotnet/_build/results?buildId=$buildId&view=results"
509- - git clone --branch $BP_INFRA_BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform && cd platform
510- - ./ephemeral-infra/run-windows-benchmarks.sh
535+ - echo "Running Windows benchmarks for build https://dev.azure.com/datadoghq/dd-trace-dotnet/_build/results?buildId=$buildId&view=results"
536+ - export GITHUB_TOKEN=$(cat /tmp/github-token)
537+ - git clone --branch $BP_INFRA_BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
538+ - ./platform/steps/run-windows-benchmarks.sh
511539 after_script :
540+ # TODO: Consider having an ephemeral-infra/cleanup-windows-benchmarks.sh
512541 - |
513542 if [ "$CLEANUP" == "true" ]; then
514543 bp-infra cleanup --provision ./platform/ephemeral-infra/provisions/macrobenchmark-ephemeral-instance.yaml \
0 commit comments