Skip to content

Create Traffic Generator for Calling Sample App Endpoints #2

Create Traffic Generator for Calling Sample App Endpoints

Create Traffic Generator for Calling Sample App Endpoints #2

# This workflow will build and the traffic generator image to each region whenever there is an update made to the traffic-generator folder.
# This image will be used by EKS and K8s test to call sample app endpoints
name: Create and Push Traffic Generator Image
on:
workflow_dispatch:
push:
# branches:
# - main
# paths:
# - 'traffic-generator/**'
permissions:
id-token: write
contents: read
jobs:
build-and-push-image:
runs-on: ubuntu-latest
strategy:
matrix:
aws-region: [ 'us-east-1' ]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.E2E_SECRET_TEST_ROLE_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.APPLICATION_SIGNALS_E2E_TEST_ROLE_NAME }}
aws-region: ${{ matrix.aws-region }}
- name: Login to Amazon ECR
id: login-ecr-public
uses: aws-actions/amazon-ecr-login@v2
with:
region: ${{ matrix.aws-region }}
- name: Build, tag, and push image to Amazon ECR
working-directory: traffic-generator
env:
REGISTRY: ${{ steps.login-ecr-public.outputs.registry }}
REPOSITORY: traffic-generator
IMAGE_TAG: latest
run: |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG