|
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 |
8 | 14 |
|
9 | 15 | stages: |
10 | | - - infra-update |
| 16 | + - build |
11 | 17 | - benchmarks |
12 | 18 |
|
13 | | -update-bp-infra: |
14 | | - stage: infra-update |
| 19 | +build-dd-trace-dotnet-microbenchmarks-ami: |
| 20 | + stage: build |
| 21 | + tags: ["arch:amd64"] |
15 | 22 | timeout: 3h |
16 | | - tags: ["arch:amd64"] |
17 | 23 | allow_failure: true |
18 | | - # Image created in the following job https://gitlab.ddbuild.io/DataDog/benchmarking-platform-tools/-/jobs/869830045 |
| 24 | + when: manual |
19 | 25 | image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dd-trace-dotnet-micro |
| 26 | + id_tokens: |
| 27 | + DDOCTOSTS_ID_TOKEN: |
| 28 | + aud: dd-octo-sts |
| 29 | + 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 | + |
| 35 | + AWS_REGION: "us-east-1" |
| 36 | + |
| 37 | + # TODO: Point to dd-trace-dotnet/micro after the branch below is merged |
| 38 | + # to it |
| 39 | + # Branch containing a provision for building the AMI |
| 40 | + BP_INFRA_BENCHMARKING_PLATFORM_BRANCH: "augusto/dd-trace-dotnet-micro-bp-ui" |
| 41 | + |
| 42 | + PROVISION_FILE: "platform/ephemeral-infra/ami.yaml" |
| 43 | + |
| 44 | + # Where AMI creation artifacts will be stored |
| 45 | + BP_INFRA_ARTIFACTS_BUCKET_NAME: "windows-benchmarking-results-us-east-1" |
20 | 46 |
|
| 47 | + # Whether to cleanup instances after building the AMI, since the AMI is |
| 48 | + # based on an instance that is created in this job |
| 49 | + CLEANUP: "true" |
| 50 | + before_script: |
| 51 | + - !reference [.dd-octo-sts-setup, before_script] |
21 | 52 | script: |
22 | | - - git clone --branch dd-trace-dotnet/micro https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform |
23 | | - - mkdir -p ~/.aws |
24 | | - - /app/bp-infra/tools/fetch-ssm-parameter.sh $AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER >> ~/.aws/config || exit $? |
25 | | - - 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 |
26 | | - - 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 |
27 | | - - export AWS_PROFILE=ephemeral-infra-ci |
28 | | - - export BP_INFRA_KEY_PAIR_NAME=$(cat ~/.aws/key-pair-name.txt) |
29 | | - - export BP_INFRA_KEY_PAIR_PRIVATE_KEY_PATH=~/.aws/key-pair-private-key.pem |
30 | | - - bp-infra launch --provision ./platform/ephemeral-infra/base-instance.yaml --region "${AWS_REGION}" --bypass-stack-destroy |
| 53 | + - git clone --branch $BP_INFRA_BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform |
| 54 | + - echo "GITHUB_TOKEN=$(cat /tmp/github-token)" > .env |
| 55 | + - CLEANUP_ARG=$([[ "$CLEANUP" == "false" ]] && echo "--no-cleanup" || echo "") |
| 56 | + - | |
| 57 | + bp-infra launch --region "${AWS_REGION}" --os "windows" \ |
| 58 | + --provision "${PROVISION_FILE}" \ |
| 59 | + --bypass-stack-destroy \ |
| 60 | + --env .env \ |
| 61 | + $CLEANUP_ARG |
31 | 62 | after_script: |
32 | | - - !reference [.setup, script] |
| 63 | + # Makes sure the instance is cleaned up. |
| 64 | + # Note: This does not clean up the created AMI. |
33 | 65 | - | |
34 | | - bp-infra cleanup --provision ./platform/ephemeral-infra/base-instance.yaml \ |
35 | | - --region "${AWS_REGION}" \ |
36 | | - --bypass-stack-destroy |
37 | | - |
38 | | - rules: |
39 | | - - when: manual |
40 | | - variables: |
41 | | - AWS_REGION: "us-east-1" |
42 | | - CLEANUP: "false" |
43 | | - AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER: "ci.dd-trace-dotnet.ephemeral-infra-ci.dd-trace-dotnet-profile" |
44 | | - AWS_EPHEMERAL_INFRA_PROFILE_NAME: "ephemeral-infra-ci" |
45 | | - AWS_EPHEMERAL_INFRA_ARTIFACTS_BUCKET_URI: "s3://windows-benchmarking-results/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_JOB_ID" |
46 | | - AWS_EPHEMERAL_INFRA_REGION: "us-east-1" |
| 66 | + if [ "$CLEANUP" == "true" ]; then |
| 67 | + bp-infra cleanup --region "${AWS_REGION}" --os "windows" \ |
| 68 | + --provision "${PROVISION_FILE}" \ |
| 69 | + --bypass-stack-destroy |
| 70 | + else |
| 71 | + echo "'CLEANUP' is set to 'false'. Will not cleanup." |
| 72 | + fi |
47 | 73 |
|
48 | 74 | run-benchmarks: |
49 | 75 | stage: benchmarks |
50 | 76 | tags: ["arch:amd64"] |
51 | 77 | timeout: 2h |
52 | 78 | # Image created in the following job https://gitlab.ddbuild.io/DataDog/benchmarking-platform-tools/-/jobs/869830045 |
53 | 79 | image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dd-trace-dotnet-micro |
54 | | - |
55 | | - script: |
56 | | - - git clone --branch dd-trace-dotnet/micro https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform |
57 | | - - AWS_REGION=${AWS_REGION} ./platform/steps/launch-instance.sh |
58 | | - after_script: |
59 | | - - | |
60 | | - bp-infra cleanup --provision ./platform/ephemeral-infra/ephemeral-instance-main.yaml \ |
61 | | - --region "${AWS_REGION}" \ |
62 | | - --bypass-stack-destroy |
63 | | - - ./platform/steps/post-pr-comment.sh |
64 | | - # Temporarily commented out pending issue resolution with sending files to backend |
65 | | - # - ./platform/steps/upload-to-bp-ui.sh |
66 | | - |
| 80 | + id_tokens: |
| 81 | + DDOCTOSTS_ID_TOKEN: |
| 82 | + aud: dd-octo-sts |
67 | 83 | rules: |
68 | 84 | - when: on_success |
69 | | - variables: |
70 | | - AWS_REGION: "us-east-1" |
71 | | - |
72 | | -upload-to-bp-ui: |
73 | | - stage: benchmarks |
74 | | - tags: ["arch:amd64"] |
75 | | - timeout: 1h |
76 | | - # Image created in the following job https://gitlab.ddbuild.io/DataDog/benchmarking-platform-tools/-/jobs/869830045 |
77 | | - image: registry.ddbuild.io/images/benchmarking-platform-tools-ubuntu:dotnet-microbenchmarks |
78 | | - |
79 | | - script: |
80 | | - - git clone --branch fayssal/test-micro-delivery https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform |
81 | | - # - ./platform/steps/launch-instance.sh |
82 | | - # - ./platform/steps/post-pr-comment.sh |
83 | | - # Temporarely commented out pending issue resolution with sending files to backend |
84 | | - - ./platform/steps/upload-to-bp-ui.sh |
85 | | - |
86 | 85 | artifacts: |
87 | 86 | name: "artifacts" |
88 | 87 | when: always |
89 | 88 | paths: |
90 | | - - candidate-results/ |
| 89 | + - platform/artifacts |
91 | 90 | expire_in: 3 months |
92 | | - |
93 | | - rules: |
94 | | - - when: manual |
95 | 91 | variables: |
| 92 | + # Allows ephemeral instances to read content from benchmarking-platform |
| 93 | + DDOCTOSTS_SCOPE: "DataDog/benchmarking-platform" |
| 94 | + DDOCTOSTS_POLICY: "gitlab.github-access.read-contents" |
| 95 | + |
96 | 96 | AWS_REGION: "us-east-1" |
97 | | - CLEANUP: "false" |
98 | | - AWS_EPHEMERAL_INFRA_PROFILE_SSM_PARAMETER: "ci.dd-trace-dotnet.ephemeral-infra-ci.dd-trace-dotnet-profile" |
99 | | - AWS_EPHEMERAL_INFRA_PROFILE_NAME: "ephemeral-infra-ci" |
100 | | - AWS_EPHEMERAL_INFRA_ARTIFACTS_BUCKET_URI: "s3://windows-benchmarking-results/$CI_PROJECT_NAME/$CI_COMMIT_REF_NAME/$CI_JOB_ID" |
101 | | - AWS_EPHEMERAL_INFRA_REGION: "us-east-1" |
| 97 | + |
| 98 | + # TODO: Point to dd-trace-dotnet/micro after the branch below is merged |
| 99 | + # to it |
| 100 | + # Branch containing 1. scripts to launch Windows benchmarks on ephemeral |
| 101 | + # instances (to be used by GitLab CI runners) and 2. scripts to run Windows |
| 102 | + # benchmarks (to be used by the ephemeral instances). |
| 103 | + BP_INFRA_BENCHMARKING_PLATFORM_BRANCH: "augusto/dd-trace-dotnet-micro-bp-ui" |
| 104 | + |
| 105 | + # Where benchmarking results will be stored |
| 106 | + BP_INFRA_ARTIFACTS_BUCKET_NAME: "windows-benchmarking-results-us-east-1" |
| 107 | + |
| 108 | + # Whether to cleanup ephemeral instances after benchmarks are run |
| 109 | + CLEANUP: "true" |
| 110 | + |
| 111 | + # Where to look for benchmarking artifacts for uploading to the BP UI |
| 112 | + ARTIFACTS_DIR: "platform/artifacts" |
| 113 | + before_script: |
| 114 | + - !reference [.dd-octo-sts-setup, before_script] |
| 115 | + script: |
| 116 | + - export GITHUB_TOKEN=$(cat /tmp/github-token) |
| 117 | + - git clone --branch $BP_INFRA_BENCHMARKING_PLATFORM_BRANCH https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ddbuild.io/DataDog/benchmarking-platform platform |
| 118 | + - ./platform/steps/run-windows-benchmarks.sh |
| 119 | + after_script: |
| 120 | + - | |
| 121 | + if [ "$CLEANUP" == "true" ]; then |
| 122 | + bp-infra cleanup --provision ./platform/ephemeral-infra/instance.yaml \ |
| 123 | + --region "${AWS_REGION}" \ |
| 124 | + --bypass-stack-destroy |
| 125 | + else |
| 126 | + echo "'CLEANUP' is set to 'false'. Will not cleanup." |
| 127 | + fi |
| 128 | + - ./platform/steps/post-pr-comment.sh |
| 129 | + - ./platform/steps/upload-to-bp-ui.sh |
0 commit comments