-
Notifications
You must be signed in to change notification settings - Fork 15
chore: Automate Releases #295
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
78 commits
Select commit
Hold shift + click to select a range
5a3b1c9
update image registry
duncanista 07266c7
remove `prepare_multi_region` jobs
duncanista e97dd72
refactor pipeline
duncanista 40ea5b1
Merge branch 'main' of ssh://github.com/DataDog/datadog-lambda-extens…
duncanista 5a4860e
update `build_bottlecap_layer.sh`
duncanista c2eafda
first iteration
duncanista 6dce2fd
add path to build repo image and build in container
duncanista 774d69e
update image to build
duncanista ed4d3c1
update `.gitlab-ci.yml`
duncanista c8a65c6
update `.gitlab/Dockerfile
duncanista bf73b79
change layer builder tag
duncanista 67c2dfb
forgot `buildx`
duncanista 22f0b94
update `.gitlab/Dockerfile`
duncanista 1482b69
make `cargo` available
duncanista d090eab
make `cargo` available again
duncanista 442e3d0
`cd bottlecap`
duncanista eb56cbf
in `Dockerfile` install `gcc, make, openssl, ...`
duncanista 8912293
update how `c++` is installed
duncanista 5db9140
remove installing `openssl-devel`
duncanista cae1e57
make `cargo` available
duncanista 6825ce0
install protobuf in `.gitlab/Dockerfile`
duncanista 1e9a02d
update `.gitlab/Dockerfile`
duncanista 3784240
typo
duncanista 004e81e
update arch on `check` job
duncanista 36c0cef
make `protoc` available
duncanista acc9a1e
make most jobs to run on `amd64`
duncanista b9f4c68
use script to install `protoc`
duncanista 4dd52b7
dont specify platform for nightly
duncanista c605d2f
Merge branch 'main' of ssh://github.com/DataDog/datadog-lambda-extens…
duncanista 0b0aacf
make pipeline dynamic
duncanista 015b954
update layer size numbers
duncanista 3a74716
update layer size numbers
duncanista 39c9a6b
Merge branch 'main' of ssh://github.com/DataDog/datadog-lambda-extens…
duncanista d674797
add `regions.yaml`
duncanista 00fdc26
update `.gitlab/Dockerfile` for a dependency
duncanista c45b929
allow build for `go agent`
duncanista 46da8b7
pass any path starting with `pipeline-`
duncanista 130974b
specify paths for pipelines
duncanista f08d645
set to include artifact for `go-agent`
duncanista d3071b5
typo on pipeline to use
duncanista ba7aef3
try different cloning strategy
duncanista 761e321
typo on scrip to use to build
duncanista c936caa
fix script to copy stuff from `datadog-agent`
duncanista 91950ad
typo
duncanista bbda3ee
update where the get secrets script comes from
duncanista 341f0f2
add `sign_layers.sh`
duncanista 893657a
allow signing layers for both environments
duncanista 8a191e6
abstract scripts to use `LAYER_FILE`
duncanista 2a48426
add `awscli` to `Dockerfile`
duncanista 915ec2b
update templates to use publishing script properly
duncanista 46cba36
revert image to be built always
duncanista 9c29bb8
update go template for signing only in prod
duncanista 1d724f8
allow suffix to be used when publishing
duncanista a2188a8
move when we add suffix
duncanista ac3f5c1
eol
duncanista 312e465
Merge branch 'main' of ssh://github.com/DataDog/datadog-lambda-extens…
duncanista 9d65a1b
allow a new pipeline for combined go+rust extension
duncanista 34863fb
add pipeline in `.gitlab.yml`
duncanista c349181
update `go-agent.yaml.tpl`
duncanista d69aacc
make bottlecap dev use another dockerfile
duncanista 6d61f4d
update `build_go_agent.sh`
duncanista 0a97c64
build bottlecap for gitlab
duncanista b09df3c
add extension with bottlecap pipeline
duncanista 17c778a
typo in `config.yaml`
duncanista 2f9b849
clone `datadog-agent` before building the go agent
duncanista cdb29bf
see if agent branch is defaulted to main
duncanista c0b5e05
its not printing, try again
duncanista c57706a
disallow specific runtime pipelines to publish to prod
duncanista c5cb5a7
`lambda-extension` to only be triggered through web
duncanista f06c67c
fix how version is set for `build_go_agent.sh`
duncanista bfb9c25
maybe copy isnt finding the right file?
duncanista fff10a4
debug ls
duncanista 190a6ec
forgot to add path to directory including the binaries
duncanista 18d294b
update layer size
duncanista 7a19dd5
remove all regions but `sa-east-1` temporarily
duncanista ac5d22b
increase layer size again
duncanista 2440892
add all regions back
duncanista 446a25b
only add permissions on prod
duncanista 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
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 |
|---|---|---|
| @@ -1,134 +1,82 @@ | ||
| 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 | ||
| DOCKER_TARGET_IMAGE: registry.ddbuild.io/ci/datadog-lambda-extension | ||
| DOCKER_TARGET_VERSION: latest | ||
| # Manual trigger variables | ||
| AGENT_BRANCH: | ||
| description: "datadog-agent branch you want to release" | ||
| description: "Branch of the datadog-agent repository to use." | ||
| value: main | ||
| LAYER_SUFFIX: | ||
| description: "Suffix to be appended to the layer name (default empty)" | ||
| 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 | ||
| - generate | ||
| - build | ||
|
|
||
| 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 | ||
| ci image: | ||
| stage: build | ||
| image: registry.ddbuild.io/images/docker:20.10 | ||
| tags: ["arch:arm64"] | ||
| 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" | ||
| - if: '$CI_COMMIT_BRANCH == "main" && $CI_PIPELINE_SOURCE == "push"' | ||
| changes: | ||
| - .gitlab/Dockerfile | ||
| when: on_success | ||
| 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 | ||
| DOCKER_TARGET: ${DOCKER_TARGET_IMAGE}:${DOCKER_TARGET_VERSION} | ||
| 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" | ||
| - docker buildx build --platform linux/amd64,linux/arm64 --no-cache --pull --push --tag ${DOCKER_TARGET} -f .gitlab/Dockerfile . | ||
|
|
||
| # 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" | ||
| .go-cache: &go-cache | ||
| key: datadog-lambda-extension-go-cache | ||
| policy: pull | ||
|
|
||
| # 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"] | ||
| generator: | ||
| stage: generate | ||
| image: registry.ddbuild.io/images/mirror/golang:alpine | ||
| tags: ["arch:amd64"] | ||
| cache: *go-cache | ||
| script: | ||
| - apk add --no-cache gomplate | ||
| - gomplate --config .gitlab/config.yaml | ||
| artifacts: | ||
| paths: | ||
| - trigger_region.yaml | ||
| - tmp/serverless/datadog_extension_signed.zip | ||
| - .gitlab/pipeline-bottlecap.yaml | ||
| - .gitlab/pipeline-go-agent.yaml | ||
| - .gitlab/pipeline-lambda-extension.yaml | ||
|
|
||
| bottlecap-only: | ||
| stage: build | ||
| trigger: | ||
| include: | ||
| - artifact: .gitlab/pipeline-bottlecap.yaml | ||
| job: generator | ||
| strategy: depend | ||
| rules: | ||
| - when: on_success | ||
|
|
||
| go-agent-only: | ||
| stage: build | ||
| trigger: | ||
| include: | ||
| - artifact: .gitlab/pipeline-go-agent.yaml | ||
| job: generator | ||
| strategy: depend | ||
| 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 | ||
| AGENT_BRANCH: $AGENT_BRANCH | ||
| LAYER_SUFFIX: $LAYER_SUFFIX | ||
|
|
||
| multi_region: | ||
| rules: | ||
| - if: $REGION_TO_DEPLOY == "all" | ||
| stage: trigger | ||
| lambda-extension: | ||
| stage: build | ||
| trigger: | ||
| include: | ||
| - artifact: trigger_region.yaml | ||
| job: prepare_multi_region | ||
| - artifact: .gitlab/pipeline-lambda-extension.yaml | ||
| job: generator | ||
| strategy: depend | ||
| rules: | ||
| - if: $CI_PIPELINE_SOURCE == "web" | ||
| variables: | ||
| AGENT_BRANCH: $AGENT_BRANCH | ||
| LAYER_SUFFIX: $LAYER_SUFFIX |
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,23 @@ | ||
| FROM registry.ddbuild.io/images/docker:24.0.5 | ||
|
|
||
| RUN apt-get update && apt-get install -y --fix-missing --no-install-recommends \ | ||
| curl gcc gnupg g++ make cmake unzip openssl g++ uuid-runtime | ||
|
|
||
| # Install AWS CLI | ||
| RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | ||
| RUN unzip awscliv2.zip && ./aws/install | ||
|
|
||
| # Install Protocol Buffers compiler by hand | ||
| COPY ./scripts/install-protoc.sh / | ||
| RUN chmod +x /install-protoc.sh && /install-protoc.sh | ||
|
|
||
| # Install Rust | ||
| RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \ | ||
| sh -s -- --profile minimal --default-toolchain nightly -y | ||
|
|
||
| RUN source $HOME/.cargo/env | ||
| ENV PATH /root/.cargo/bin/:$PATH | ||
|
|
||
| RUN rustup component add rust-src --toolchain nightly | ||
|
|
||
|
|
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,21 @@ | ||
| # gomplate template generation pipeline | ||
|
|
||
| inputFiles: | ||
| - .gitlab/templates/bottlecap.yaml.tpl | ||
| - .gitlab/templates/go-agent.yaml.tpl | ||
| - .gitlab/templates/lambda-extension.yaml.tpl | ||
|
|
||
| outputFiles: | ||
| - .gitlab/pipeline-bottlecap.yaml | ||
| - .gitlab/pipeline-go-agent.yaml | ||
| - .gitlab/pipeline-lambda-extension.yaml | ||
|
|
||
| datasources: | ||
| architectures: | ||
| url: .gitlab/datasources/architectures.yaml | ||
|
|
||
| environments: | ||
| url: .gitlab/datasources/environments.yaml | ||
|
|
||
| regions: | ||
| url: .gitlab/datasources/regions.yaml |
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,3 @@ | ||
| architectures: | ||
| - name: amd64 | ||
| - name: arm64 |
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,9 @@ | ||
| environments: | ||
| - name: sandbox | ||
| external_id: sandbox-publish-externalid | ||
| role_to_assume: sandbox-layer-deployer | ||
| account: 425362996713 | ||
| - name: prod | ||
| external_id: prod-publish-externalid | ||
| role_to_assume: dd-serverless-layer-deployer-role | ||
| account: 464622532012 |
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,30 @@ | ||
| regions: | ||
| - code: "us-east-1" | ||
| - code: "us-east-2" | ||
| - code: "us-west-1" | ||
| - code: "us-west-2" | ||
| - code: "af-south-1" | ||
| - code: "ap-east-1" | ||
| - code: "ap-south-1" | ||
| - code: "ap-south-2" | ||
| - code: "ap-southeast-1" | ||
| - code: "ap-southeast-2" | ||
| - code: "ap-southeast-3" | ||
| - code: "ap-southeast-4" | ||
| - code: "ap-northeast-1" | ||
| - code: "ap-northeast-2" | ||
| - code: "ap-northeast-3" | ||
| - code: "ca-central-1" | ||
| - code: "ca-west-1" | ||
| - code: "eu-central-1" | ||
| - code: "eu-central-2" | ||
| - code: "eu-north-1" | ||
| - code: "eu-west-1" | ||
| - code: "eu-west-2" | ||
| - code: "eu-west-3" | ||
| - code: "eu-south-1" | ||
| - code: "eu-south-2" | ||
| - code: "il-central-1" | ||
| - code: "me-south-1" | ||
| - code: "me-central-1" | ||
| - code: "sa-east-1" | ||
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,64 @@ | ||
| #!/bin/bash | ||
|
|
||
| # Unless explicitly stated otherwise all files in this repository are licensed | ||
| # under the Apache License Version 2.0. | ||
| # This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
| # Copyright 2024 Datadog, Inc. | ||
|
|
||
| set -e | ||
|
|
||
| if [ -z "$ARCHITECTURE" ]; then | ||
| printf "[ERROR]: ARCHITECTURE not specified\n" | ||
| exit 1 | ||
| fi | ||
|
|
||
| if [ -z "$ALPINE" ]; then | ||
| printf "Building bottlecap" | ||
| else | ||
| echo "Building bottlecap for alpine" | ||
| BUILD_SUFFIX="-alpine" | ||
| fi | ||
|
|
||
| prepare_folders() { | ||
| # Move into the root directory, so this script can be called from any directory | ||
| SCRIPTS_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" | ||
| ROOT_DIR=$SCRIPTS_DIR/../.. | ||
| cd $ROOT_DIR | ||
|
|
||
| echo $ROOT_DIR | ||
|
|
||
| EXTENSION_DIR=".layers" | ||
| TARGET_DIR=$(pwd)/$EXTENSION_DIR | ||
|
|
||
| rm -rf $EXTENSION_DIR/datadog_bottlecap-${ARCHITECTURE}${BUILD_SUFFIX} 2>/dev/null | ||
| rm -rf $EXTENSION_DIR/datadog_bottlecap-${ARCHITECTURE}${BUILD_SUFFIX}.zip 2>/dev/null | ||
|
|
||
| cd $ROOT_DIR | ||
| } | ||
|
|
||
|
|
||
| docker_build() { | ||
| local arch=$1 | ||
| if [ "$arch" == "amd64" ]; then | ||
| PLATFORM="x86_64" | ||
| else | ||
| PLATFORM="aarch64" | ||
| fi | ||
|
|
||
| docker buildx build --platform linux/${arch} \ | ||
| -t datadog/build-bottlecap-${arch} \ | ||
| -f ./scripts/Dockerfile.bottlecap.build \ | ||
| --build-arg PLATFORM=$PLATFORM \ | ||
| --build-arg GO_AGENT_PATH="datadog_extension-${arch}${BUILD_SUFFIX}" \ | ||
| . -o $TARGET_DIR/datadog_bottlecap-${arch}${BUILD_SUFFIX} | ||
|
|
||
| cp $TARGET_DIR/datadog_bottlecap-${arch}${BUILD_SUFFIX}/datadog_extension.zip $TARGET_DIR/datadog_bottlecap-${arch}${BUILD_SUFFIX}.zip | ||
|
|
||
| unzip $TARGET_DIR/datadog_bottlecap-${arch}${BUILD_SUFFIX}/datadog_extension.zip -d $TARGET_DIR/datadog_bottlecap-${arch}${BUILD_SUFFIX} | ||
| rm -rf $TARGET_DIR/datadog_bottlecap-${arch}${BUILD_SUFFIX}/datadog_extension.zip | ||
| rm -rf $TARGET_DIR/datadog_extension-${arch}${BUILD_SUFFIX} | ||
| rm -rf $TARGET_DIR/datadog_extension-${arch}${BUILD_SUFFIX}.zip | ||
| } | ||
|
|
||
| prepare_folders | ||
| docker_build $ARCHITECTURE |
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.
Uh oh!
There was an error while loading. Please reload this page.