Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
123 commits
Select commit Hold shift + click to select a range
b929010
test ci
maxday Mar 7, 2023
06c868b
add tags
maxday Mar 7, 2023
7820a17
get role
maxday Mar 7, 2023
452399a
install aws-cli
maxday Mar 7, 2023
0893b5f
update image
maxday Mar 7, 2023
fcef159
assume role
maxday Mar 7, 2023
6bd7a36
test aws permission
maxday Mar 7, 2023
4694acb
test aws permission
maxday Mar 7, 2023
518b003
test aws permission
maxday Mar 7, 2023
c5e772d
assume role
maxday Mar 7, 2023
44fd852
update session name
maxday Mar 7, 2023
e072016
use git depth = 0
maxday Mar 7, 2023
e479267
assume role
maxday Mar 7, 2023
0628ae0
assume role
maxday Mar 7, 2023
e52f582
test build
maxday Mar 7, 2023
f53b2c4
ci
maxday Mar 7, 2023
90804e2
ci
maxday Mar 7, 2023
680f5b4
ci
maxday Mar 7, 2023
56f225b
ci
maxday Mar 7, 2023
d28fed2
ci
maxday Mar 7, 2023
035c38b
ci
maxday Mar 7, 2023
ccc1db3
ci
maxday Mar 7, 2023
9bf26bd
ci
maxday Mar 7, 2023
9948675
ci
maxday Mar 7, 2023
1617914
ci
maxday Mar 7, 2023
53a37ab
ci
maxday Mar 7, 2023
f548b3f
ci
maxday Mar 7, 2023
85df29a
ci
maxday Mar 7, 2023
05c7811
ci
maxday Mar 7, 2023
3b37be7
ci
maxday Mar 7, 2023
5988d78
ci
maxday Mar 7, 2023
a5d43f5
ci
maxday Mar 7, 2023
8006c81
ci
maxday Mar 7, 2023
de247d8
ci
maxday Mar 7, 2023
df6bb99
ci
maxday Mar 7, 2023
82f5d33
ci
maxday Mar 7, 2023
3d37ef0
ci
maxday Mar 7, 2023
49df9af
ci
maxday Mar 7, 2023
b3abac1
ci
maxday Mar 7, 2023
cf651ef
ci
maxday Mar 7, 2023
f376e02
ci
maxday Mar 7, 2023
98841c3
ci
maxday Mar 7, 2023
009f09e
ci
maxday Mar 7, 2023
099358b
ci
maxday Mar 7, 2023
b4e7767
ci
maxday Mar 7, 2023
03b9ff4
ci
maxday Mar 7, 2023
11d001d
ci
maxday Mar 7, 2023
0b65171
ci
maxday Mar 7, 2023
4175338
ci
maxday Mar 7, 2023
9edd7ae
ci
maxday Mar 7, 2023
e5d2514
ci
maxday Mar 7, 2023
2f20558
ci
maxday Mar 7, 2023
efb5c85
ci
maxday Mar 7, 2023
6c57df7
ci
maxday Mar 7, 2023
f528487
fix gitlab
maxday Mar 7, 2023
bcc5a1a
cleanup
maxday Mar 7, 2023
30069b3
ci
maxday Mar 7, 2023
4333759
ci
maxday Mar 7, 2023
9091c6d
ci
maxday Mar 7, 2023
0eda25b
ci
maxday Mar 7, 2023
a71aec7
ci
maxday Mar 7, 2023
bf2ec2b
ci
maxday Mar 7, 2023
9e022e4
ci
maxday Mar 7, 2023
f95a255
ci
maxday Mar 7, 2023
8fbadc7
ci
maxday Mar 7, 2023
05d0e60
ci
maxday Mar 7, 2023
74b45bd
ci
maxday Mar 7, 2023
e7dfd9c
refacto auth
maxday Mar 8, 2023
d097193
clippy
maxday Mar 8, 2023
020028f
refacto
maxday Mar 8, 2023
d02396b
ci
maxday Mar 8, 2023
a07888a
ci
maxday Mar 8, 2023
757e208
test artifact
maxday Mar 8, 2023
0c8f9fe
add multi region support child pipeline
maxday Mar 17, 2023
70ca9f1
add multi region support child pipeline
maxday Mar 17, 2023
284b278
add multi region support child pipeline
maxday Mar 17, 2023
4fc43cb
add multi region support child pipeline
maxday Mar 17, 2023
071b251
add multi region support child pipeline
maxday Mar 17, 2023
9089758
add multi region support child pipeline
maxday Mar 17, 2023
76852eb
add multi region support child pipeline
maxday Mar 17, 2023
c283c9e
add multi region support child pipeline
maxday Mar 17, 2023
ce6e361
add multi region support child pipeline
maxday Mar 17, 2023
753e34c
add multi region support child pipeline
maxday Mar 17, 2023
05b54d1
add multi region support child pipeline
maxday Mar 17, 2023
7ea888d
add multi region support child pipeline
maxday Mar 17, 2023
92025dd
add multi region support child pipeline
maxday Mar 17, 2023
4469e03
add multi region support child pipeline
maxday Mar 17, 2023
cf4ff52
add multi region support child pipeline
maxday Mar 17, 2023
5b4e24a
add multi region support child pipeline
maxday Mar 17, 2023
7c30922
add multi region support child pipeline
maxday Mar 17, 2023
2cf52bc
add multi region support child pipeline
maxday Mar 17, 2023
fcc0835
add multi region support child pipeline
maxday Mar 17, 2023
065e228
add multi region support child pipeline
maxday Mar 17, 2023
3ea07c8
add multi region support child pipeline
maxday Mar 17, 2023
7f362ca
add multi region support child pipeline
maxday Mar 17, 2023
2c48be5
add multi region support child pipeline
maxday Mar 17, 2023
df24c10
add multi region support child pipeline
maxday Mar 17, 2023
05f8a02
add multi region support child pipeline
maxday Mar 17, 2023
295efc1
add multi region support child pipeline
maxday Mar 17, 2023
ed958ae
add multi region support child pipeline
maxday Mar 17, 2023
0ba5510
add multi region support child pipeline
maxday Mar 17, 2023
fea0dd8
add multi region support child pipeline
maxday Mar 17, 2023
6b004f4
add multi region support child pipeline
maxday Mar 17, 2023
6251c1b
add multi region support child pipeline
maxday Mar 17, 2023
870a410
add multi region support child pipeline
maxday Mar 17, 2023
6dcaa9a
add multi region support child pipeline
maxday Mar 17, 2023
d4829f3
add multi region support child pipeline
maxday Mar 17, 2023
511295b
add multi region support child pipeline
maxday Mar 17, 2023
c1b1bc4
add multi region support child pipeline
maxday Mar 17, 2023
d01b6fe
add multi region support child pipeline
maxday Mar 17, 2023
65151ee
add multi region support child pipeline
maxday Mar 17, 2023
c7abaf3
add multi region support child pipeline
maxday Mar 17, 2023
2107ed7
add multi region support child pipeline
maxday Mar 17, 2023
1266325
add multi region support child pipeline
maxday Mar 17, 2023
3fe0944
add multi region support child pipeline
maxday Mar 17, 2023
c5c0cbd
add multi region support child pipeline
maxday Mar 17, 2023
dc22fa5
add multi region support child pipeline
maxday Mar 17, 2023
97c68b5
add multi region support child pipeline
maxday Mar 17, 2023
b41dbed
add multi region support child pipeline
maxday Mar 17, 2023
43c56c4
add multi region support child pipeline
maxday Mar 17, 2023
fab8775
add multi region support child pipeline
maxday Mar 17, 2023
c549eaf
add multi region support child pipeline
maxday Mar 17, 2023
e64050b
fix conflicts
maxday Apr 3, 2023
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
134 changes: 134 additions & 0 deletions .gitlab-ci.yml
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: ""

Copy link
Copy Markdown
Contributor

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.

Copy link
Copy Markdown
Contributor Author

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?

Copy link
Copy Markdown
Contributor

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.


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
103 changes: 0 additions & 103 deletions build-tools/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion build-tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.1.0"
edition = "2021"

[dependencies]
aes-gcm = "0.10.1"
aws-config = "0.53.0"
aws-sdk-ec2 = "0.23.0"
aws-sdk-lambda = "0.23.0"
Expand Down
17 changes: 2 additions & 15 deletions build-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,9 @@ FROM rust as builder
WORKDIR /usr/src/app
COPY Cargo.toml .
COPY Cargo.lock .
RUN mkdir ./src && echo 'fn main() { println!("Dummy!"); }' > ./src/main.rs
RUN cargo build --release
RUN rm -rf ./src
COPY src ./src
RUN touch -a -m ./src/main.rs
RUN cargo build --release

FROM ubuntu:jammy as compresser
RUN apt-get update
RUN apt-get install -y zip
RUN mkdir -p /bin
WORKDIR /bin
COPY --from=builder /usr/src/app/target/release/build_tools /bin/build_tools
RUN zip -r build_tools.zip /bin/build_tools

#keep the smallest possible docker image
FROM scratch
COPY --from=compresser /bin/build_tools.zip /
ENTRYPOINT ["/build_tools.zip"]
COPY --from=builder /usr/src/app/target/release/build_tools /build_tools
ENTRYPOINT ["/build_tools"]
Binary file removed build-tools/bin/build_tools
Binary file not shown.
6 changes: 0 additions & 6 deletions build-tools/build.sh

This file was deleted.

41 changes: 0 additions & 41 deletions build-tools/src/commands/auth_command.rs

This file was deleted.

Loading