-
Notifications
You must be signed in to change notification settings - Fork 21
Move from github-actions to gitlab to publish layers #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
123 commits
Select commit
Hold shift + click to select a range
b929010
test ci
maxday 06c868b
add tags
maxday 7820a17
get role
maxday 452399a
install aws-cli
maxday 0893b5f
update image
maxday fcef159
assume role
maxday 6bd7a36
test aws permission
maxday 4694acb
test aws permission
maxday 518b003
test aws permission
maxday c5e772d
assume role
maxday 44fd852
update session name
maxday e072016
use git depth = 0
maxday e479267
assume role
maxday 0628ae0
assume role
maxday e52f582
test build
maxday f53b2c4
ci
maxday 90804e2
ci
maxday 680f5b4
ci
maxday 56f225b
ci
maxday d28fed2
ci
maxday 035c38b
ci
maxday ccc1db3
ci
maxday 9bf26bd
ci
maxday 9948675
ci
maxday 1617914
ci
maxday 53a37ab
ci
maxday f548b3f
ci
maxday 85df29a
ci
maxday 05c7811
ci
maxday 3b37be7
ci
maxday 5988d78
ci
maxday a5d43f5
ci
maxday 8006c81
ci
maxday de247d8
ci
maxday df6bb99
ci
maxday 82f5d33
ci
maxday 3d37ef0
ci
maxday 49df9af
ci
maxday b3abac1
ci
maxday cf651ef
ci
maxday f376e02
ci
maxday 98841c3
ci
maxday 009f09e
ci
maxday 099358b
ci
maxday b4e7767
ci
maxday 03b9ff4
ci
maxday 11d001d
ci
maxday 0b65171
ci
maxday 4175338
ci
maxday 9edd7ae
ci
maxday e5d2514
ci
maxday 2f20558
ci
maxday efb5c85
ci
maxday 6c57df7
ci
maxday f528487
fix gitlab
maxday bcc5a1a
cleanup
maxday 30069b3
ci
maxday 4333759
ci
maxday 9091c6d
ci
maxday 0eda25b
ci
maxday a71aec7
ci
maxday bf2ec2b
ci
maxday 9e022e4
ci
maxday f95a255
ci
maxday 8fbadc7
ci
maxday 05d0e60
ci
maxday 74b45bd
ci
maxday e7dfd9c
refacto auth
maxday d097193
clippy
maxday 020028f
refacto
maxday d02396b
ci
maxday a07888a
ci
maxday 757e208
test artifact
maxday 0c8f9fe
add multi region support child pipeline
maxday 70ca9f1
add multi region support child pipeline
maxday 284b278
add multi region support child pipeline
maxday 4fc43cb
add multi region support child pipeline
maxday 071b251
add multi region support child pipeline
maxday 9089758
add multi region support child pipeline
maxday 76852eb
add multi region support child pipeline
maxday c283c9e
add multi region support child pipeline
maxday ce6e361
add multi region support child pipeline
maxday 753e34c
add multi region support child pipeline
maxday 05b54d1
add multi region support child pipeline
maxday 7ea888d
add multi region support child pipeline
maxday 92025dd
add multi region support child pipeline
maxday 4469e03
add multi region support child pipeline
maxday cf4ff52
add multi region support child pipeline
maxday 5b4e24a
add multi region support child pipeline
maxday 7c30922
add multi region support child pipeline
maxday 2cf52bc
add multi region support child pipeline
maxday fcc0835
add multi region support child pipeline
maxday 065e228
add multi region support child pipeline
maxday 3ea07c8
add multi region support child pipeline
maxday 7f362ca
add multi region support child pipeline
maxday 2c48be5
add multi region support child pipeline
maxday df24c10
add multi region support child pipeline
maxday 05f8a02
add multi region support child pipeline
maxday 295efc1
add multi region support child pipeline
maxday ed958ae
add multi region support child pipeline
maxday 0ba5510
add multi region support child pipeline
maxday fea0dd8
add multi region support child pipeline
maxday 6b004f4
add multi region support child pipeline
maxday 6251c1b
add multi region support child pipeline
maxday 870a410
add multi region support child pipeline
maxday 6dcaa9a
add multi region support child pipeline
maxday d4829f3
add multi region support child pipeline
maxday 511295b
add multi region support child pipeline
maxday c1b1bc4
add multi region support child pipeline
maxday d01b6fe
add multi region support child pipeline
maxday 65151ee
add multi region support child pipeline
maxday c7abaf3
add multi region support child pipeline
maxday 2107ed7
add multi region support child pipeline
maxday 1266325
add multi region support child pipeline
maxday 3fe0944
add multi region support child pipeline
maxday c5c0cbd
add multi region support child pipeline
maxday dc22fa5
add multi region support child pipeline
maxday 97c68b5
add multi region support child pipeline
maxday b41dbed
add multi region support child pipeline
maxday 43c56c4
add multi region support child pipeline
maxday fab8775
add multi region support child pipeline
maxday c549eaf
add multi region support child pipeline
maxday e64050b
fix conflicts
maxday File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,134 @@ | ||
| variables: | ||
| GIT_DEPTH: 1 | ||
| REGION_TO_DEPLOY: | ||
| description: "use sa-east-1 for dev, us-east-1 for RC, all for all regions" | ||
| value: sa-east-1 | ||
| AGENT_BRANCH: | ||
| description: "datadog-agent branch you want to release" | ||
| value: main | ||
| LAYER_SUFFIX: | ||
| description: "Suffix to be appended to the layer name (default empty)" | ||
| value: "" | ||
|
|
||
| image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:20.10-py3 | ||
|
|
||
| stages: | ||
| - build_tools_if_needed | ||
| - build_layer | ||
| - prepare_multi_region | ||
| - trigger | ||
|
|
||
| build_tools: | ||
| stage: build_tools_if_needed | ||
| variables: | ||
| CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" | ||
| TARGET: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-lambda-extension | ||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == "web" | ||
| when: never | ||
| - changes: | ||
| - build-tools/**/* | ||
| tags: ["runner:docker"] | ||
| script: | ||
| - cd build-tools && docker buildx build --tag ${TARGET} --push . | ||
|
|
||
| build_and_deploy_layer: | ||
| stage: build_layer | ||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == "web" | ||
| variables: | ||
| CI_ENABLE_CONTAINER_IMAGE_BUILDS: "true" | ||
| ROLE_TO_ASSUME: arn:aws:iam::425362996713:role/sandbox-layer-deployer | ||
| TARGET: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-lambda-extension | ||
| tags: ["runner:docker"] | ||
| artifacts: | ||
| paths: | ||
| - tmp/serverless/datadog_extension_signed.zip | ||
| script: | ||
| - mkdir tmp | ||
| - git clone --branch ${AGENT_BRANCH} --depth=1 https://github.com/DataDog/datadog-agent.git | ||
| - dockerId=$(docker create --platform linux/amd64 ${TARGET}) | ||
| - docker cp $dockerId:/build_tools . | ||
| - EXTERNAL_ID=$(aws ssm get-parameter | ||
| --region us-east-1 | ||
| --name ci.datadog-lambda-extension.externalid | ||
| --with-decryption | ||
| --query "Parameter.Value" | ||
| --out text) | ||
|
|
||
| # build | ||
| - ./build_tools | ||
| build | ||
| --version 1 | ||
| --agent-version 1 | ||
| --architecture amd64 | ||
| --context-path . | ||
| --destination-path tmp/serverless | ||
| --docker-path "scripts_v2/Dockerfile.build" | ||
| --artifact-name "datadog_extension.zip" | ||
|
|
||
| # sign | ||
| - ./build_tools | ||
| sign | ||
| --layer-path tmp/serverless/datadog_extension.zip | ||
| --destination-path tmp/serverless/datadog_extension_signed.zip | ||
| --assume-role "$ROLE_TO_ASSUME" | ||
| --external-id "$EXTERNAL_ID" | ||
|
|
||
| # ls artifacts | ||
| - ls tmp/serverless | ||
|
|
||
| # deploy to single region if needed | ||
| - if [ "${REGION_TO_DEPLOY}" = "all" ]; then exit 0; fi | ||
| - ./build_tools | ||
| deploy | ||
| --layer-path tmp/serverless/datadog_extension_signed.zip | ||
| --architecture amd64 | ||
| --layer-name "Datadog-Extension" | ||
| --layer-suffix "$LAYER_SUFFIX" | ||
| --region "$REGION_TO_DEPLOY" | ||
| --assume-role "$ROLE_TO_ASSUME" | ||
| --external-id "$EXTERNAL_ID" | ||
|
|
||
| prepare_multi_region: | ||
| stage: prepare_multi_region | ||
| tags: ["runner:docker"] | ||
| artifacts: | ||
| paths: | ||
| - trigger_region.yaml | ||
| - tmp/serverless/datadog_extension_signed.zip | ||
| rules: | ||
| - if: $REGION_TO_DEPLOY != "all" | ||
| when: never | ||
| - if: $CI_PIPELINE_SOURCE == "web" | ||
| - if: $CI_PIPELINE_SOURCE == "external" | ||
| - if: $CI_PIPELINE_SOURCE == "trigger" | ||
| - if: $CI_PIPELINE_SOURCE == "pipeline" | ||
| - if: $CI_PIPELINE_SOURCE == "parent_pipeline" | ||
| variables: | ||
| TARGET: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-lambda-extension | ||
| ROLE_TO_ASSUME: arn:aws:iam::425362996713:role/sandbox-layer-deployer | ||
| script: | ||
| - echo $CI_PIPELINE_SOURCE | ||
| - if [ "${REGION_TO_DEPLOY}" != "all" ]; then exit 0; fi | ||
| - EXTERNAL_ID=$(aws ssm get-parameter | ||
| --region us-east-1 | ||
| --name ci.datadog-lambda-extension.externalid | ||
| --with-decryption | ||
| --query "Parameter.Value" | ||
| --out text) | ||
| - dockerId=$(docker create --platform linux/amd64 ${TARGET}) | ||
| - docker cp $dockerId:/build_tools . | ||
| - regions=$(./build_tools list_region --assume-role "$ROLE_TO_ASSUME" --external-id "$EXTERNAL_ID") | ||
| - sed "s/xxx_layer_sufix_xxx/${LAYER_SUFFIX}/" trigger_region.orig.yaml > trigger_region.tmp.yaml | ||
| - sed "s/xxx_aws_regions_xxx/${regions}/" trigger_region.tmp.yaml > trigger_region.yaml | ||
| - cat trigger_region.yaml | ||
|
|
||
| multi_region: | ||
| rules: | ||
| - if: $REGION_TO_DEPLOY == "all" | ||
| stage: trigger | ||
| trigger: | ||
| include: | ||
| - artifact: trigger_region.yaml | ||
| job: prepare_multi_region | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to add build tags here as well, so we don't have to keep reverting PRs when we want to change the build tags.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not, maybe in an other PR as this one is already quite big, WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea. It's also less important now that we're solidly in the otlp build tag world as opposed to previously where we were going back and forth regularly.