fix(pricing): separate CDK build scripts with external dd-trace #200
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
| name: Deploy Pricing Service | |
| on: | |
| push: | |
| paths: | |
| - src/pricing-service/** | |
| branches: | |
| - "main" | |
| pull_request: | |
| paths: | |
| - src/pricing-service/** | |
| branches: | |
| - "main" | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| id-token: write | |
| contents: read | |
| jobs: | |
| verify-workshop-build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "22" | |
| - name: Verify workshop stubs compile | |
| shell: bash | |
| run: | | |
| cd src/pricing-service | |
| make workshop-build | |
| deploy-tf: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: tf-pricing-service | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Terraform | |
| uses: hashicorp/setup-terraform@v2 | |
| - name: Set up Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "22" | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
| role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
| aws-region: "eu-west-2" | |
| - name: Set Commit Hash Environment Variables | |
| shell: bash | |
| run: | | |
| echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
| - name: Build | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "dev" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-central-1" | |
| run: | | |
| cd src/pricing-service | |
| make build | |
| - name: Deploy to ephermal environment | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "tf-${{ env.sha_short }}" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-west-2" | |
| TF_STATE_BUCKET_NAME: ${{secrets.TF_STATE_BUCKET_NAME}} | |
| run: | | |
| cd src/pricing-service | |
| make tf-apply | |
| - name: Integration test ephermal environment | |
| shell: bash | |
| env: | |
| ENV: "tf-${{ env.sha_short }}" | |
| AWS_REGION: "eu-west-2" | |
| run: | | |
| cd src/pricing-service | |
| make integration-test | |
| - name: Destroy ephermal environment | |
| shell: bash | |
| if: always() | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "tf-${{ env.sha_short }}" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-west-2" | |
| TF_STATE_BUCKET_NAME: ${{secrets.TF_STATE_BUCKET_NAME}} | |
| run: | | |
| cd src/pricing-service | |
| make tf-destroy | |
| - name: Deploy to dev | |
| if: github.event_name == 'push' | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "dev" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-west-2" | |
| TF_STATE_BUCKET_NAME: ${{secrets.TF_STATE_BUCKET_NAME}} | |
| run: | | |
| cd src/pricing-service | |
| make tf-apply | |
| - name: Integration test dev | |
| if: github.event_name == 'push' | |
| shell: bash | |
| env: | |
| ENV: "dev" | |
| AWS_REGION: "eu-west-2" | |
| run: | | |
| cd src/pricing-service | |
| make integration-test | |
| - name: Destroy dev | |
| shell: bash | |
| if: always() | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "dev" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-west-2" | |
| TF_STATE_BUCKET_NAME: ${{secrets.TF_STATE_BUCKET_NAME}} | |
| run: | | |
| cd src/pricing-service | |
| make tf-destroy | |
| deploy-cdk: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: cdk-pricing-service | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "22" | |
| - name: Install CDK | |
| run: | | |
| npm install -g aws-cdk | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
| role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
| aws-region: "eu-west-1" | |
| - name: Set Commit Hash Environment Variables | |
| shell: bash | |
| run: | | |
| echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
| - name: Build | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "dev" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-central-1" | |
| run: | | |
| cd src/pricing-service | |
| make build | |
| - name: Deploy to ephermal environment | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "cdk-${{ env.sha_short }}" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| run: | | |
| cd src/pricing-service | |
| make cdk-deploy | |
| - name: Integration test ephermal environment | |
| shell: bash | |
| env: | |
| ENV: "cdk-${{ env.sha_short }}" | |
| AWS_REGION: "eu-west-1" | |
| run: | | |
| cd src/pricing-service | |
| make integration-test | |
| - name: Destroy ephermal environment | |
| shell: bash | |
| if: always() | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "cdk-${{ env.sha_short }}" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| run: | | |
| cd src/pricing-service | |
| make cdk-destroy | |
| - name: Deploy to dev | |
| if: github.event_name == 'push' | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "dev" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| run: | | |
| cd src/pricing-service | |
| make cdk-deploy | |
| - name: Integration test dev | |
| if: github.event_name == 'push' | |
| shell: bash | |
| env: | |
| ENV: "dev" | |
| AWS_REGION: "eu-west-1" | |
| run: | | |
| cd src/pricing-service | |
| make integration-test | |
| - name: Destroy dev | |
| shell: bash | |
| if: always() | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "dev" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| run: | | |
| cd src/pricing-service | |
| make cdk-destroy | |
| deploy-cdk-prod: | |
| runs-on: ubuntu-latest | |
| needs: deploy-cdk | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "22" | |
| - name: Install CDK | |
| run: | | |
| npm install -g aws-cdk | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df | |
| with: | |
| role-to-assume: ${{ secrets.PRODUCTION_AWS_ROLE_ARN }} | |
| role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
| aws-region: "eu-west-2" | |
| - name: Set Commit Hash Environment Variables | |
| shell: bash | |
| run: | | |
| echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
| - name: Build | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "prod" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-west-2" | |
| run: | | |
| cd src/pricing-service | |
| make build | |
| - name: Deploy to ephermal environment | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "prod" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| run: | | |
| cd src/pricing-service | |
| make cdk-deploy | |
| - name: Integration test ephermal environment | |
| shell: bash | |
| env: | |
| ENV: "prod" | |
| AWS_REGION: "eu-west-2" | |
| run: | | |
| cd src/pricing-service | |
| make integration-test | |
| deploy-sam: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: sam-pricing-service | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: "22" | |
| - uses: aws-actions/setup-sam@v1 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@b47578312673ae6fa5b5096b330d9fbac3d116df | |
| with: | |
| role-to-assume: ${{ secrets.AWS_ROLE_ARN }} | |
| role-session-name: GitHub_to_AWS_via_FederatedOIDC | |
| aws-region: "eu-central-1" | |
| - name: Set Commit Hash Environment Variables | |
| shell: bash | |
| run: | | |
| echo "sha_short=$(git rev-parse --short "$GITHUB_SHA")" >> "$GITHUB_ENV" | |
| - name: Build | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "dev" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-central-1" | |
| run: | | |
| cd src/pricing-service | |
| make build | |
| - name: Deploy to ephermal environment | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "sam-${{ env.sha_short }}" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-central-1" | |
| run: | | |
| cd src/pricing-service | |
| make sam | |
| - name: Integration test ephermal environment | |
| shell: bash | |
| env: | |
| ENV: "sam-${{ env.sha_short }}" | |
| AWS_REGION: "eu-central-1" | |
| run: | | |
| cd src/pricing-service | |
| make integration-test | |
| - name: Destroy ephermeral environment | |
| shell: bash | |
| if: always() | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "sam-${{ env.sha_short }}" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-central-1" | |
| run: | | |
| cd src/pricing-service | |
| make sam-destroy | |
| - name: Deploy to dev | |
| if: github.event_name == 'push' | |
| shell: bash | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "dev" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-central-1" | |
| run: | | |
| cd src/pricing-service | |
| make sam | |
| - name: Integration test dev | |
| if: github.event_name == 'push' | |
| shell: bash | |
| env: | |
| ENV: "dev" | |
| AWS_REGION: "eu-central-1" | |
| run: | | |
| cd src/pricing-service | |
| make integration-test | |
| - name: Destroy dev` | |
| shell: bash | |
| if: always() | |
| env: | |
| COMMIT_HASH: ${{ env.sha_short }} | |
| ENV: "dev" | |
| DD_API_KEY: ${{secrets.DD_API_KEY}} | |
| DD_SITE: "datadoghq.eu" | |
| AWS_REGION: "eu-central-1" | |
| run: | | |
| cd src/pricing-service | |
| make sam-destroy |