From a8be65234cbba584ac07ab6dfbabfd81b76bd699 Mon Sep 17 00:00:00 2001 From: Simeranjeet Sandhu Date: Wed, 8 Nov 2023 21:07:51 -0800 Subject: [PATCH] Added image:tag to build stage to test for ecr --- .github/workflows/cd-workflows.yml | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/cd-workflows.yml b/.github/workflows/cd-workflows.yml index aec5423..ed57679 100644 --- a/.github/workflows/cd-workflows.yml +++ b/.github/workflows/cd-workflows.yml @@ -5,6 +5,7 @@ on: branches: - main - dev + - actions-ecr pull_request: branches: - main @@ -19,14 +20,12 @@ jobs: env: OS: ubuntu-latest PYTHON: '3.9' - steps: - uses: actions/checkout@v2 - name: Setup Python uses: actions/setup-python@v2 with: python-version: 3.9 - # Install dependencies required for tests - name: Install Dependencies run: | @@ -34,7 +33,6 @@ jobs: sudo apt-get install libxml2-dev libxmlsec1-dev -y --no-install-recommends python -m pip install --upgrade pip pip install -r ./requirements.txt - # Start running test scripts and generate the coverage report - name: Generate Coverage Report env: @@ -71,24 +69,20 @@ jobs: needs: code-test name: Build Docker Image runs-on: ubuntu-latest - steps: - name: Checkout Code uses: actions/checkout@v2 - - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@v1 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: ${{ secrets.AWS_REGION }} - - name: Login to Amazon ECR id: login-ecr uses: aws-actions/amazon-ecr-login@v1 with: mask-password: 'true' - - name: Build, tag, and push image to Amazon ECR env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} @@ -98,4 +92,5 @@ jobs: echo "Starting docker build" docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . echo "Pushing image to ECR..." - docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG \ No newline at end of file + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG:latest + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG:${{ github.sha }} \ No newline at end of file