From 75d9bca047c46ba224d852a3a3fe203cfc1c95ef Mon Sep 17 00:00:00 2001 From: Mohamed Asaker Date: Wed, 18 Dec 2024 10:26:37 -0800 Subject: [PATCH] Fixed lambda sample app upload workflow (#337) *Description of changes:* While doing some tests, found out that the lambda sample app workflow upload wasn't working as expected. I fixed it in this PR and tested it here: https://github.com/aws-observability/aws-application-signals-test-framework/actions/runs/12398929067/job/34612754042 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license. --- .../workflows/dotnet-sample-app-s3-deploy.yml | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/.github/workflows/dotnet-sample-app-s3-deploy.yml b/.github/workflows/dotnet-sample-app-s3-deploy.yml index 8e020907..c856b1a8 100644 --- a/.github/workflows/dotnet-sample-app-s3-deploy.yml +++ b/.github/workflows/dotnet-sample-app-s3-deploy.yml @@ -57,21 +57,54 @@ jobs: aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./dotnet-ec2-win-remote-setup.ps1 --key dotnet-ec2-win-remote-setup.ps1 aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./amazon-cloudwatch-agent.json --key amazon-cloudwatch-agent.json - - name: Build Lambda Sample App + build-and-upload-lambda-sample-app: + strategy: + fail-fast: false + matrix: + aws-region: [ 'af-south-1','ap-east-1','ap-northeast-1','ap-northeast-2','ap-northeast-3','ap-south-1','ap-south-2','ap-southeast-1', + 'ap-southeast-2','ap-southeast-3','ap-southeast-4','ca-central-1','eu-central-1','eu-central-2','eu-north-1', + 'eu-south-1','eu-south-2','eu-west-1','eu-west-2','eu-west-3','il-central-1','me-central-1','me-south-1', 'sa-east-1', + 'us-east-1','us-east-2', 'us-west-1', 'us-west-2' ] + runs-on: ubuntu-latest + steps: + - name: Checkout sample app repo uses: actions/checkout@v4 with: repository: 'aws-observability/aws-otel-dotnet-instrumentation' + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.E2E_IAD_TEST_ACCOUNT_ARN }} + aws-region: us-east-1 + + - name: Retrieve account + uses: aws-actions/aws-secretsmanager-get-secrets@v1 + with: + secret-ids: + ACCOUNT_ID, region-account/${{ matrix.aws-region }} + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::${{ env.ACCOUNT_ID }}:role/${{ secrets.E2E_TEST_ROLE_ARN }} + aws-region: ${{ matrix.aws-region }} + - name: Setup .NET uses: actions/setup-dotnet@v2 with: dotnet-version: '8.0.x' + + - name: Setup .NET Lambda Tools + shell: bash + run: dotnet tool install -g Amazon.Lambda.Tools + working-directory: sample-applications/lambda-test-apps/SimpleLambdaFunction + - name: Build Lambda Sample App shell: bash run: dotnet lambda package -pl ./src/SimpleLambdaFunction working-directory: sample-applications/lambda-test-apps/SimpleLambdaFunction - - - name: Upload to Lambda Sample App to S3 + + - name: Upload Lambda Sample App to S3 working-directory: sample-applications/lambda-test-apps/SimpleLambdaFunction - run: aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./src/SimpleLambdaFunction/bin/Release/net8.0/SimpleLambdaFunction.zip --key dotnet-function.zip - - + run: aws s3api put-object --bucket aws-appsignals-sample-app-prod-${{ matrix.aws-region }} --body ./src/SimpleLambdaFunction/bin/Release/net8.0/SimpleLambdaFunction.zip --key dotnet-function.zip \ No newline at end of file