@@ -324,6 +324,49 @@ signed layer bundle:
324324 - mkdir -p datadog_extension-signed-bundle-$ {CI_JOB_ID}
325325 - cp .layers /datadog_extension-*.zip datadog_extension-signed-bundle-$ {CI_JOB_ID}
326326
327+ # Integration Tests - Build Java Lambda function
328+ build java lambda:
329+ stage: integration-tests
330+ image: registry.ddbuild.io /images/docker:27.3.1
331+ tags: [" docker-in-docker:arm64" ]
332+ rules:
333+ - when: on_success
334+ needs: []
335+ artifacts:
336+ expire_in: 1 hour
337+ paths:
338+ - integration-tests/lambda/base-java/target/
339+ script:
340+ - cd integration-tests/lambda/base-java
341+ - docker run --rm --platform linux/arm64
342+ -v " $(pwd)" :/workspace
343+ -w /workspace
344+ maven:3.9 -eclipse-temurin-21-alpine
345+ mvn clean package
346+
347+ # Integration Tests - Build .NET Lambda function
348+ build dotnet lambda:
349+ stage: integration-tests
350+ image: registry.ddbuild.io /images/docker:27.3.1
351+ tags: [" docker-in-docker:arm64" ]
352+ rules:
353+ - when: on_success
354+ needs: []
355+ artifacts:
356+ expire_in: 1 hour
357+ paths:
358+ - integration-tests/lambda/base-dotnet/bin/
359+ script:
360+ - cd integration-tests/lambda/base-dotnet
361+ - docker run --rm --platform linux/arm64
362+ -v " $(pwd)" :/workspace
363+ -w /workspace
364+ mcr.microsoft.com /dotnet/sdk:8.0 -alpine
365+ sh -c " apk add --no-cache zip &&
366+ dotnet tool install -g Amazon.Lambda.Tools || true &&
367+ export PATH=\" \$ PATH:/root/.dotnet/tools\" &&
368+ dotnet lambda package -o bin/function.zip --function-architecture arm64"
369+
327370# Integration Tests - Publish arm64 layer with integration test prefix
328371publish integration layer (arm64):
329372 stage: integration-tests
@@ -362,6 +405,11 @@ integration-deploy:
362405 - when: on_success
363406 needs:
364407 - publish integration layer (arm64)
408+ - build java lambda
409+ - build dotnet lambda
410+ dependencies:
411+ - build java lambda
412+ - build dotnet lambda
365413 variables:
366414 IDENTIFIER: $ {CI_COMMIT_SHORT_SHA}
367415 AWS_DEFAULT_REGION: us-east-1
@@ -418,35 +466,55 @@ integration-cleanup-stacks:
418466 stage: integration-tests
419467 tags: [" arch:amd64" ]
420468 image: $ {CI_DOCKER_TARGET_IMAGE}:$ {CI_DOCKER_TARGET_VERSION}
421- when: always
422469 rules:
423470 - when: always
424471 needs:
425- - integration-test
472+ - job: integration-test
473+ optional: false
426474 variables:
427475 IDENTIFIER: $ {CI_COMMIT_SHORT_SHA}
428476 {{ with $environment := (ds " environments" ).environments.sandbox }}
429477 before_script:
430478 - EXTERNAL_ID_NAME= {{ $environment .external_id }} ROLE_TO_ASSUME= {{ $environment .role_to_assume }} AWS_ACCOUNT= {{ $environment .account }} source .gitlab /scripts/get_secrets.sh
431- - curl -fsSL https://deb.nodesource.com /setup_20.x | bash -
432- - apt-get install -y nodejs
433- - cd integration-tests
434- - npm ci
435479 {{ end }}
436480 script:
437481 - echo " Destroying CDK stacks with identifier ${IDENTIFIER}..."
438- - npx cdk destroy " integ-$IDENTIFIER-*" --force || echo " Failed to destroy some stacks, but continuing..."
482+ - |
483+ # Find all stacks matching the pattern using CloudFormation API
484+ STACKS= $ (aws cloudformation list-stacks \
485+ --stack-status-filter CREATE_COMPLETE UPDATE_COMPLETE UPDATE_ROLLBACK_COMPLETE \
486+ --query " StackSummaries[?starts_with(StackName, 'integ-${IDENTIFIER}-')].StackName" \
487+ --output text --region us-east-1)
488+
489+ if [ -z " $STACKS" ]; then
490+ echo " No stacks found matching pattern integ-${IDENTIFIER}-*"
491+ else
492+ echo " Found stacks to delete: ${STACKS}"
493+ for STACK in $STACKS ; do
494+ echo " Deleting stack ${STACK}..."
495+ aws cloudformation delete-stack --stack-name " ${STACK}" --region us-east-1 || echo " Failed to delete ${STACK}, continuing..."
496+ done
497+
498+ # Wait for all deletions to complete
499+ echo " Waiting for stack deletions to complete..."
500+ for STACK in $STACKS ; do
501+ echo " Waiting for ${STACK}..."
502+ aws cloudformation wait stack-delete-complete --stack-name " ${STACK}" --region us-east-1 || echo " Stack ${STACK} deletion did not complete cleanly, continuing..."
503+ done
504+
505+ echo " All stacks deleted successfully"
506+ fi
439507
440508# Integration Tests - Cleanup layer
441509integration-cleanup-layer:
442510 stage: integration-tests
443511 tags: [" arch:amd64" ]
444512 image: $ {CI_DOCKER_TARGET_IMAGE}:$ {CI_DOCKER_TARGET_VERSION}
445- when: always
446513 rules:
447514 - when: always
448515 needs:
449- - integration-cleanup-stacks
516+ - job: integration-cleanup-stacks
517+ optional: false
450518 variables:
451519 IDENTIFIER: $ {CI_COMMIT_SHORT_SHA}
452520 {{ with $environment := (ds " environments" ).environments.sandbox }}
@@ -456,7 +524,7 @@ integration-cleanup-layer:
456524 script:
457525 - echo " Deleting integration test layer with identifier ${IDENTIFIER}..."
458526 - |
459- LAYER_NAME= " Datadog-Extension-${IDENTIFIER}"
527+ LAYER_NAME= " Datadog-Extension-ARM- ${IDENTIFIER}"
460528 echo " Looking for layer: ${LAYER_NAME}"
461529
462530 # Get all versions of the layer
0 commit comments