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