Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
issuer: https://gitlab.ddbuild.io

subject_pattern: "project_path:DataDog/apm-reliability/dd-trace-dotnet:ref_type:(branch|tag):ref:.*"

permissions:
contents: read
18 changes: 14 additions & 4 deletions .gitlab/benchmarks/macrobenchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,13 @@ profiler_cpu_timer_create-arm64:
- platform/artifacts/
expire_in: 3 months
variables:
AWS_REGION: "us-east-1"

# Branch containing 1. scripts to launch Windows benchmarks on ephemeral
# instances (to be used by GitLab CI runners) and 2. scripts to run Windows
# benchmarks (to be used by the ephemeral instances).
BP_INFRA_BENCHMARKING_PLATFORM_BRANCH: "dd-trace-dotnet/macro"

# Whether to cleanup ephemeral instances after benchmarks are run
CLEANUP: "true"

Expand All @@ -489,14 +496,17 @@ profiler_cpu_timer_create-arm64:
script:
- source build-id.txt
- echo "Building for the following build https://dev.azure.com/datadoghq/dd-trace-dotnet/_build/results?buildId=$buildId&view=results"
- export BP_INFRA_BENCHMARKING_PLATFORM_BRANCH=dd-trace-dotnet/macro
- git clone --branch $BP_INFRA_BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform && cd platform
- ./ephemeral-infra/run-windows-benchmarks.sh
after_script:
- |
bp-infra cleanup --provision ./platform/ephemeral-infra/provisions/macrobenchmark-ephemeral-instance.yaml \
--region "${AWS_REGION}" \
--bypass-stack-destroy
if [ "$CLEANUP" == "true" ]; then
bp-infra cleanup --provision ./platform/ephemeral-infra/provisions/macrobenchmark-ephemeral-instance.yaml \
--region "${AWS_REGION}" \
--bypass-stack-destroy
else
echo "'CLEANUP' is set to 'false'. Will not cleanup."
fi

baseline-win:
extends: .benchmarks-win
Expand Down
172 changes: 109 additions & 63 deletions .gitlab/benchmarks/microbenchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,101 +1,147 @@
.setup:
script:
- mkdir -p ~/.aws
- /app/bp-infra/tools/fetch-ssm-parameter.sh $AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER > ~/.aws/config || exit $?
- export AWS_PROFILE=ephemeral-infra-ci
- export BP_INFRA_KEY_PAIR_NAME=$(cat ~/.aws/key-pair-name.txt)
- export BP_INFRA_KEY_PAIR_PRIVATE_KEY_PATH=~/.aws/key-pair-private-key.pem
.dd-octo-sts-setup:
before_script:
- |
set +e
error_output=$({ dd-octo-sts token --scope DataDog/dd-trace-dotnet --policy gitlab.github-access.read-contents > "/tmp/github-token"; } 2>&1)
exit_code=$?
if [ $exit_code -ne 0 ]; then
echo "ERROR: Failed to retrieve a GitHub token with dd-octo-sts gitlab.github-access.read-contents policy."
echo "Original error: $error_output"
echo "Continuing execution anyway..."
fi
set -e

stages:
- infra-update
- build
- benchmarks

update-bp-infra:
stage: infra-update
build-dd-trace-dotnet-microbenchmarks-ami:
stage: build
tags: ["arch:amd64"]
timeout: 3h
tags: ["arch:amd64"]
allow_failure: true
# Image created in the following job https://gitlab.ddbuild.io/DataDog/benchmarking-platform-tools/-/jobs/869830045
when: manual
image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dd-trace-dotnet-micro
id_tokens:
DDOCTOSTS_ID_TOKEN:
aud: dd-octo-sts
variables:
AWS_REGION: "us-east-1"

# TODO: Change to dd-trace-dotnet/micro before merging
# Branch containing a provision for building the AMI
BP_INFRA_BENCHMARKING_PLATFORM_BRANCH: "augusto/dd-trace-dotnet-micro-bp-ui"

PROVISION_FILE: "platform/ephemeral-infra/ami.yaml"

# Where AMI creation artifacts will be stored
BP_INFRA_ARTIFACTS_BUCKET_NAME: "windows-benchmarking-results-us-east-1"

# Whether to cleanup instances after building the AMI, since the AMI is
# based on an instance that is created in this job
CLEANUP: "true"
before_script:
- !reference [.dd-octo-sts-setup, before_script]
script:
- git clone --branch dd-trace-dotnet/micro https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
- mkdir -p ~/.aws
- /app/bp-infra/tools/fetch-ssm-parameter.sh $AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER >> ~/.aws/config || exit $?
- 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
- 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
- export AWS_PROFILE=ephemeral-infra-ci
- export BP_INFRA_KEY_PAIR_NAME=$(cat ~/.aws/key-pair-name.txt)
- export BP_INFRA_KEY_PAIR_PRIVATE_KEY_PATH=~/.aws/key-pair-private-key.pem
- bp-infra launch --provision ./platform/ephemeral-infra/base-instance.yaml --region "${AWS_REGION}" --bypass-stack-destroy
- git clone --branch $BP_INFRA_BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
# TODO: Uncomment the second line, remove the first one
- |
if [ -z "$GITHUB_TOKEN" ]; then
GITHUB_TOKEN=$(cat /tmp/github-token)
fi
echo "GITHUB_TOKEN=$GITHUB_TOKEN" > .env
# - echo "GITHUB_TOKEN=$(cat /tmp/github-token)" > .env
- CLEANUP_ARG=$([[ "$CLEANUP" == "false" ]] && echo "--no-cleanup" || echo "")
- |
bp-infra launch --region "${AWS_REGION}" --os "windows" \
--provision "${PROVISION_FILE}" \
--bypass-stack-destroy \
--env .env \
$CLEANUP_ARG
after_script:
- !reference [.setup, script]
# Makes sure the instance is cleaned up.
# Note: This does not clean up the created AMI.
- |
bp-infra cleanup --provision ./platform/ephemeral-infra/base-instance.yaml \
--region "${AWS_REGION}" \
--bypass-stack-destroy

rules:
- when: manual
variables:
AWS_REGION: "us-east-1"
CLEANUP: "false"
AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER: "ci.dd-trace-dotnet.ephemeral-infra-ci.dd-trace-dotnet-profile"
AWS_EPHEMERAL_INFRA_PROFILE_NAME: "ephemeral-infra-ci"
AWS_EPHEMERAL_INFRA_ARTIFACTS_BUCKET_URI: "s3://windows-benchmarking-results/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_JOB_ID"
AWS_EPHEMERAL_INFRA_REGION: "us-east-1"
if [ "$CLEANUP" == "true" ]; then
bp-infra cleanup --region "${AWS_REGION}" --os "windows" \
--provision "${PROVISION_FILE}" \
--bypass-stack-destroy
else
echo "'CLEANUP' is set to 'false'. Will not cleanup."
fi

run-benchmarks:
stage: benchmarks
tags: ["arch:amd64"]
timeout: 2h
# Image created in the following job https://gitlab.ddbuild.io/DataDog/benchmarking-platform-tools/-/jobs/869830045
image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dd-trace-dotnet-micro
id_tokens:
DDOCTOSTS_ID_TOKEN:
aud: dd-octo-sts
# TODO: Revert to the commented lines before merging
when: manual
# rules:
# - when: on_success
variables:
AWS_REGION: "us-east-1"

# TODO: Change to dd-trace-dotnet/micro before merging
# Branch containing 1. scripts to launch Windows benchmarks on ephemeral
# instances (to be used by GitLab CI runners) and 2. scripts to run Windows
# benchmarks (to be used by the ephemeral instances).
BP_INFRA_BENCHMARKING_PLATFORM_BRANCH: "augusto/dd-trace-dotnet-micro-bp-ui"

# Where benchmarking results will be stored
BP_INFRA_ARTIFACTS_BUCKET_NAME: "windows-benchmarking-results-us-east-1"

# Whether to cleanup ephemeral instances after benchmarks are run
# TODO: Revert to true before merging
CLEANUP: "false"

# TODO: Remove before merging
BP_INFRA_TEST: "false"
before_script:
- !reference [.dd-octo-sts-setup, before_script]
script:
- git clone --branch dd-trace-dotnet/micro https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
- AWS_REGION=${AWS_REGION} ./platform/steps/launch-instance.sh
- git clone --branch $BP_INFRA_BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
- ./platform/steps/run-windows-benchmarks.sh
after_script:
# TODO: Ideally, should be in a script.
- |
bp-infra cleanup --provision ./platform/ephemeral-infra/ephemeral-instance-main.yaml \
--region "${AWS_REGION}" \
--bypass-stack-destroy
if [ "$CLEANUP" == "true" ]; then
bp-infra cleanup --provision ./platform/ephemeral-infra/instance.yaml \
--region "${AWS_REGION}" \
--bypass-stack-destroy
else
echo "'CLEANUP' is set to 'false'. Will not cleanup."
fi
- ./platform/steps/post-pr-comment.sh
# Temporarily commented out pending issue resolution with sending files to backend
# - ./platform/steps/upload-to-bp-ui.sh

rules:
- when: on_success
variables:
AWS_REGION: "us-east-1"

# TODO: Remove if unnecessary
upload-to-bp-ui:
stage: benchmarks
tags: ["arch:amd64"]
timeout: 1h
# Image created in the following job https://gitlab.ddbuild.io/DataDog/benchmarking-platform-tools/-/jobs/869830045
image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dotnet-microbenchmarks

script:
- git clone --branch fayssal/test-micro-delivery https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
# - ./platform/steps/launch-instance.sh
# - ./platform/steps/post-pr-comment.sh
# Temporarely commented out pending issue resolution with sending files to backend
- ./platform/steps/upload-to-bp-ui.sh

image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dd-trace-dotnet-micro
when: manual
artifacts:
name: "artifacts"
when: always
paths:
- candidate-results/
expire_in: 3 months

rules:
- when: manual
variables:
AWS_REGION: "us-east-1"
CLEANUP: "false"
AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER: "ci.dd-trace-dotnet.ephemeral-infra-ci.dd-trace-dotnet-profile"
AWS_EPHEMERAL_INFRA_PROFILE_NAME: "ephemeral-infra-ci"
AWS_EPHEMERAL_INFRA_ARTIFACTS_BUCKET_URI: "s3://windows-benchmarking-results/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_JOB_ID"
AWS_EPHEMERAL_INFRA_REGION: "us-east-1"

# Here, we don't include BP_INFRA since we don't use BP_INFRA in this job.
# TODO: Change to dd-trace-dotnet/micro before merging
BENCHMARKING_PLATFORM_BRANCH: "augusto/dd-trace-dotnet-micro-bp-ui"

# Where to fetch results from
BP_INFRA_ARTIFACTS_BUCKET_NAME: "windows-benchmarking-results-us-east-1"
script:
- git clone --branch $BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform
- ./platform/steps/upload-to-bp-ui.sh
Loading