From c1c11814ddcb9e3a98b4564807131c193e6c025e Mon Sep 17 00:00:00 2001 From: Sheetal Date: Tue, 16 Apr 2024 20:36:07 +0530 Subject: [PATCH] pipeline implemetation --- .github/workflows/dev-api-gateway.yml | 2 +- .github/workflows/dev-connection.yml | 21 ++++++++----------- .github/workflows/dev-ecosystem.yml | 17 +++++++-------- .github/workflows/dev-issuance.yml | 16 ++++++-------- .github/workflows/dev-ledger.yml | 18 +++++++--------- .../workflows/dev-notification-webhook.yml | 20 +++++++++--------- .github/workflows/dev-notification.yml | 17 +++++++-------- .github/workflows/dev-organization.yml | 19 +++++++---------- .github/workflows/dev-utility.yml | 17 +++++++-------- .github/workflows/dev-verification.yml | 17 +++++++-------- .github/workflows/dev-webhook.yml | 19 +++++++---------- 11 files changed, 77 insertions(+), 106 deletions(-) diff --git a/.github/workflows/dev-api-gateway.yml b/.github/workflows/dev-api-gateway.yml index cf8b099e7..d5bafae04 100644 --- a/.github/workflows/dev-api-gateway.yml +++ b/.github/workflows/dev-api-gateway.yml @@ -73,7 +73,7 @@ jobs: run: | FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/api-gateway-service.json) NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/api-gateway-service.json) - SERVICE_NAME="${NAME}-service" + SERVICE_NAME="${NAME}_service" echo "SERVICE_NAME: $SERVICE_NAME" # Replace placeholders in the JSON file diff --git a/.github/workflows/dev-connection.yml b/.github/workflows/dev-connection.yml index 2c30d778d..8ce214ca0 100644 --- a/.github/workflows/dev-connection.yml +++ b/.github/workflows/dev-connection.yml @@ -3,11 +3,11 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main - paths: - - 'apps/connection/**' - workflow_dispatch: - + - pipeline-implementation + # paths: + # - 'apps/connection/**' + # workflow_dispatch: + env: ECR_IMAGE_TAG: "CONNECTION_V_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" @@ -71,13 +71,12 @@ jobs: - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/connection-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/connection-service.json) SERVICE_NAME="${NAME}-service" - echo "SERVICE_NAME: $SERVICE_NAME" - + # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/agent-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/connection-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json @@ -95,8 +94,6 @@ jobs: echo "Entered existing service" # Extract desired count from the stored service info DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - echo "DESIRED_COUNT: $DESIRED_COUNT" - if [ "$DESIRED_COUNT" = "0" ]; then DESIRED_COUNT="1" fi diff --git a/.github/workflows/dev-ecosystem.yml b/.github/workflows/dev-ecosystem.yml index bc486d74f..d89930974 100644 --- a/.github/workflows/dev-ecosystem.yml +++ b/.github/workflows/dev-ecosystem.yml @@ -3,13 +3,13 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main + - pipeline-implementation paths: - 'apps/ecosystem/**' workflow_dispatch: - + env: - ECR_IMAGE_TAG: "ECOSYSTEM_V_${{ github.run_number }}" + ECR_IMAGE_TAG: "ECOSYSTEM_V_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" AWS_REGION: "ap-southeast-1" CLUSTER: "DEV-NGOTAG-CLUSTER" @@ -71,13 +71,12 @@ jobs: - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/ecosystem-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/ecosystem-service.json) SERVICE_NAME="${NAME}-service" - echo "SERVICE_NAME: $SERVICE_NAME" - + # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/agent-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/ecosystem-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json @@ -95,8 +94,6 @@ jobs: echo "Entered existing service" # Extract desired count from the stored service info DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - echo "DESIRED_COUNT: $DESIRED_COUNT" - if [ "$DESIRED_COUNT" = "0" ]; then DESIRED_COUNT="1" fi diff --git a/.github/workflows/dev-issuance.yml b/.github/workflows/dev-issuance.yml index 6273be7b1..f4625aad0 100644 --- a/.github/workflows/dev-issuance.yml +++ b/.github/workflows/dev-issuance.yml @@ -3,12 +3,11 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main + - pipeline-implementation paths: - 'apps/issuance/**' workflow_dispatch: - - + env: ECR_IMAGE_TAG: "ISSUANCE_V_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" @@ -72,13 +71,12 @@ jobs: - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/issuance-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/issuance-service.json) SERVICE_NAME="${NAME}-service" - echo "SERVICE_NAME: $SERVICE_NAME" - + # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/agent-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/issuance-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json @@ -96,8 +94,6 @@ jobs: echo "Entered existing service" # Extract desired count from the stored service info DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - echo "DESIRED_COUNT: $DESIRED_COUNT" - if [ "$DESIRED_COUNT" = "0" ]; then DESIRED_COUNT="1" fi diff --git a/.github/workflows/dev-ledger.yml b/.github/workflows/dev-ledger.yml index 9afbeef92..9990b953d 100644 --- a/.github/workflows/dev-ledger.yml +++ b/.github/workflows/dev-ledger.yml @@ -3,12 +3,11 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main + - pipeline-implementation paths: - - 'apps/ledger/**' + - 'apps/user/**' workflow_dispatch: - - + env: ECR_IMAGE_TAG: "LEDGER_V_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" @@ -72,13 +71,12 @@ jobs: - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/ledger-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/ledger-service.json) SERVICE_NAME="${NAME}-service" - echo "SERVICE_NAME: $SERVICE_NAME" - + # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/agent-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/ledger-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json @@ -96,8 +94,6 @@ jobs: echo "Entered existing service" # Extract desired count from the stored service info DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - echo "DESIRED_COUNT: $DESIRED_COUNT" - if [ "$DESIRED_COUNT" = "0" ]; then DESIRED_COUNT="1" fi diff --git a/.github/workflows/dev-notification-webhook.yml b/.github/workflows/dev-notification-webhook.yml index caef72bf2..b3a4594e3 100644 --- a/.github/workflows/dev-notification-webhook.yml +++ b/.github/workflows/dev-notification-webhook.yml @@ -3,13 +3,13 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main + - pipeline-implementation paths: - - 'apps/notification-webhook/**' + - 'apps/user/**' workflow_dispatch: - + env: - ECR_IMAGE_TAG: "NOTIFICATION-WEBHOOK_V_${{ github.run_number }}" + ECR_IMAGE_TAG: "USER_v_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" AWS_REGION: "ap-southeast-1" CLUSTER: "DEV-NGOTAG-CLUSTER" @@ -42,7 +42,7 @@ jobs: env: ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} ECR_REPOSITORY: dev-services - IMAGE_TAG: "USER_v_${{ github.run_number }}" + IMAGE_TAG: "USER_V_${{ github.run_number }}" run: | docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfiles/Dockerfile.user . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG @@ -52,7 +52,7 @@ jobs: run: | echo "ECR_REGISTRY=${{ steps.login-ecr.outputs.registry }}" >> $GITHUB_ENV echo "ECR_REPOSITORY=dev-services" >> $GITHUB_ENV - echo "IMAGE_TAG=USER_v_${{ github.run_number }}" >> $GITHUB_ENV + echo "IMAGE_TAG=USER_V_${{ github.run_number }}" >> $GITHUB_ENV - name: Print environment variables run: | @@ -67,16 +67,16 @@ jobs: - name: Replace executionRoleArn in task definition run: | - sed -i "s#\"executionRoleArn\": \"arn:aws:iam::.*:role/ecsTaskExecutionRole\"#\"executionRoleArn\": \"arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ecsTaskExecutionRole\"#" taskdef/notification-webhook-service.json + sed -i "s#\"executionRoleArn\": \"arn:aws:iam::.*:role/ecsTaskExecutionRole\"#\"executionRoleArn\": \"arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ecsTaskExecutionRole\"#" taskdef/user-service.json - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/notification-webhook-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/notification-webhook-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/user-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/user-service.json) SERVICE_NAME="${NAME}-service" # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/notification-webhook-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/user-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json diff --git a/.github/workflows/dev-notification.yml b/.github/workflows/dev-notification.yml index 2da2aab80..414f858c6 100644 --- a/.github/workflows/dev-notification.yml +++ b/.github/workflows/dev-notification.yml @@ -3,11 +3,11 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main + - pipeline-implementation paths: - - 'apps/notification/**' + - 'apps/user/**' workflow_dispatch: - + env: ECR_IMAGE_TAG: "NOTIFICATION_V_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" @@ -71,13 +71,12 @@ jobs: - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/notification-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/notification-service.json) SERVICE_NAME="${NAME}-service" - echo "SERVICE_NAME: $SERVICE_NAME" - + # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/agent-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/notification-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json @@ -95,8 +94,6 @@ jobs: echo "Entered existing service" # Extract desired count from the stored service info DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - echo "DESIRED_COUNT: $DESIRED_COUNT" - if [ "$DESIRED_COUNT" = "0" ]; then DESIRED_COUNT="1" fi diff --git a/.github/workflows/dev-organization.yml b/.github/workflows/dev-organization.yml index 69211f3d3..4ceae3d57 100644 --- a/.github/workflows/dev-organization.yml +++ b/.github/workflows/dev-organization.yml @@ -3,11 +3,11 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main + - pipeline-implementation paths: - - 'apps/organization/**' + - 'apps/user/**' workflow_dispatch: - + env: ECR_IMAGE_TAG: "ORGANIZATION_V_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" @@ -69,15 +69,14 @@ jobs: run: | sed -i "s#\"executionRoleArn\": \"arn:aws:iam::.*:role/ecsTaskExecutionRole\"#\"executionRoleArn\": \"arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ecsTaskExecutionRole\"#" taskdef/organization-service.json - - name: Update Task Definition and service + - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/organization-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/organization-service.json) SERVICE_NAME="${NAME}-service" - echo "SERVICE_NAME: $SERVICE_NAME" - + # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/agent-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/organization-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json @@ -95,8 +94,6 @@ jobs: echo "Entered existing service" # Extract desired count from the stored service info DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - echo "DESIRED_COUNT: $DESIRED_COUNT" - if [ "$DESIRED_COUNT" = "0" ]; then DESIRED_COUNT="1" fi diff --git a/.github/workflows/dev-utility.yml b/.github/workflows/dev-utility.yml index 97051be20..056b0f1fc 100644 --- a/.github/workflows/dev-utility.yml +++ b/.github/workflows/dev-utility.yml @@ -3,11 +3,11 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main + - pipeline-implementation paths: - - 'apps/utility/**' + - 'apps/user/**' workflow_dispatch: - + env: ECR_IMAGE_TAG: "UTILITY_V_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" @@ -71,13 +71,12 @@ jobs: - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/utility-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/utility-service.json) SERVICE_NAME="${NAME}-service" - echo "SERVICE_NAME: $SERVICE_NAME" - + # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/agent-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/utility-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json @@ -95,8 +94,6 @@ jobs: echo "Entered existing service" # Extract desired count from the stored service info DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - echo "DESIRED_COUNT: $DESIRED_COUNT" - if [ "$DESIRED_COUNT" = "0" ]; then DESIRED_COUNT="1" fi diff --git a/.github/workflows/dev-verification.yml b/.github/workflows/dev-verification.yml index f84a10aff..5202e43be 100644 --- a/.github/workflows/dev-verification.yml +++ b/.github/workflows/dev-verification.yml @@ -3,11 +3,11 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main + - pipeline-implementation paths: - - 'apps/verification/**' + - 'apps/user/**' workflow_dispatch: - + env: ECR_IMAGE_TAG: "VERIFICATION_V_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" @@ -71,13 +71,12 @@ jobs: - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/verification-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/verification-service.json) SERVICE_NAME="${NAME}-service" - echo "SERVICE_NAME: $SERVICE_NAME" - + # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/agent-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/verification-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json @@ -95,8 +94,6 @@ jobs: echo "Entered existing service" # Extract desired count from the stored service info DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - echo "DESIRED_COUNT: $DESIRED_COUNT" - if [ "$DESIRED_COUNT" = "0" ]; then DESIRED_COUNT="1" fi diff --git a/.github/workflows/dev-webhook.yml b/.github/workflows/dev-webhook.yml index 2bebfb83c..7fd377458 100644 --- a/.github/workflows/dev-webhook.yml +++ b/.github/workflows/dev-webhook.yml @@ -3,11 +3,11 @@ name: Build and deploy Node.js app to ECSsdc on: push: branches: - - main + - pipeline-implementation paths: - - 'apps/webhook/**' + - 'apps/user/**' workflow_dispatch: - + env: ECR_IMAGE_TAG: "WEBHOOK_V_${{ github.run_number }}" ECR_REPOSITORY: "dev-services" @@ -69,15 +69,14 @@ jobs: run: | sed -i "s#\"executionRoleArn\": \"arn:aws:iam::.*:role/ecsTaskExecutionRole\"#\"executionRoleArn\": \"arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/ecsTaskExecutionRole\"#" taskdef/webhook-service.json - - name: Update Task Definition and service + - name: Update Task Definition and service run: | - FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json) - NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-service.json) + FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/webhook-service.json) + NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/webhook-service.json) SERVICE_NAME="${NAME}-service" - echo "SERVICE_NAME: $SERVICE_NAME" - + # Replace placeholders in the JSON file - sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/agent-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json + sed -e "s;%BUILD_NUMBER%;${{ github.run_number }};g" -e "s;%REPOSITORY_URI%;${REPOSITORY_URI};g" taskdef/webhook-service.json > ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json # Debug: Print the content of the modified JSON file cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json @@ -95,8 +94,6 @@ jobs: echo "Entered existing service" # Extract desired count from the stored service info DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - echo "DESIRED_COUNT: $DESIRED_COUNT" - if [ "$DESIRED_COUNT" = "0" ]; then DESIRED_COUNT="1" fi