Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
20 changes: 9 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,25 @@ build_tools:
when: never
- changes:
- build-tools/**/*
tags: ["runner:docker"]
tags: ["arch:amd64"]
script:
- cd build-tools && docker buildx build --tag ${TARGET} --push .
- cd build-tools && docker buildx build --tag ${TARGET}:testing-new-ci-image --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"]
TARGET: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-lambda-extension:testing-new-ci-image
tags: ["arch:amd64"]
image: 486234852809.dkr.ecr.us-east-1.amazonaws.com/ci/datadog-lambda-extension:testing-new-ci-image
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
Expand All @@ -57,7 +55,7 @@ build_and_deploy_layer:
--out text)

# build
- ./build_tools
- build_tools
build
--version 1
--agent-version 1
Expand All @@ -68,7 +66,7 @@ build_and_deploy_layer:
--artifact-name "datadog_extension.zip"

# sign
- ./build_tools
- build_tools
sign
--layer-path tmp/serverless/datadog_extension.zip
--destination-path tmp/serverless/datadog_extension_signed.zip
Expand All @@ -80,7 +78,7 @@ build_and_deploy_layer:

# deploy to single region if needed
- if [ "${REGION_TO_DEPLOY}" = "all" ]; then exit 0; fi
- ./build_tools
- build_tools
deploy
--layer-path tmp/serverless/datadog_extension_signed.zip
--architecture amd64
Expand All @@ -92,7 +90,7 @@ build_and_deploy_layer:

prepare_multi_region:
stage: prepare_multi_region
tags: ["runner:docker"]
tags: ["arch:amd64"]
artifacts:
paths:
- trigger_region.yaml
Expand Down
5 changes: 2 additions & 3 deletions build-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ COPY Cargo.lock .
COPY src ./src
RUN cargo build --release

FROM scratch
COPY --from=builder /usr/src/app/target/release/build_tools /build_tools
ENTRYPOINT ["/build_tools"]
FROM 486234852809.dkr.ecr.us-east-1.amazonaws.com/docker:20.10-py3
COPY --from=builder /usr/src/app/target/release/build_tools /usr/local/bin/
8 changes: 4 additions & 4 deletions build-tools/src/commands/build_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ fn build_extension(cmd_path: &str, args: &BuildOptions) -> Result<()> {
let destination_path = &args.destination_path;
let dockerfile_path = &args.docker_path;
let image_name = build_image(args, cmd_path, dockerfile_path.as_str())?;
let docker_container_id = create_container(image_name.as_str())?;
std::fs::create_dir(destination_path)?;
copy_zip_file(args, docker_container_id.as_str(), destination_path)?;
remove_container(&docker_container_id)?;
// let docker_container_id = create_container(image_name.as_str())?;
// std::fs::create_dir(destination_path)?;
// copy_zip_file(args, docker_container_id.as_str(), destination_path)?;
// remove_container(&docker_container_id)?;
Ok(())
}

Expand Down
1 change: 1 addition & 0 deletions build-tools/to_remove
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
trigger build-tools gitlab to validate tag change