diff --git a/.github/workflows/dev-agent-provisioning.yml b/.github/workflows/dev-agent-provisioning.yml index 625b53ec7..f7debd3a4 100644 --- a/.github/workflows/dev-agent-provisioning.yml +++ b/.github/workflows/dev-agent-provisioning.yml @@ -77,12 +77,12 @@ jobs: 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-provisioning.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/agent-provisioning.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 + cat ${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json - # Register the task definition using the modified JSON file + # Register the task definition using the modified JSON file aws ecs register-task-definition --family ${FAMILY} --cli-input-json file://${GITHUB_WORKSPACE}/${NAME}-v_${{ github.run_number }}.json --region ${{ env.AWS_REGION }} - name: Update Task Definition and service @@ -103,17 +103,17 @@ jobs: SERVICE_INFO=$(aws ecs describe-services --services ${SERVICE_NAME} --cluster ${CLUSTER} --region ap-southeast-1) # Check if the service exists - if [ -z "$SERVICE_INFO" ]; then + if [ -z "$SERVICE_INFO" ]; then echo "Service does not exist, creating new service..." # Your logic to create a new service goes here else - echo "Entered existing service" + echo "Entered existing service" # Extract desired count from the stored service info - DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') - if [ "$DESIRED_COUNT" = "0" ]; then - DESIRED_COUNT="1" + DESIRED_COUNT=$(echo "$SERVICE_INFO" | jq -r '.services[].desiredCount') + if [ "$DESIRED_COUNT" = "0" ]; then + DESIRED_COUNT="1" fi # Update the existing service - REVISION=$(aws ecs describe-task-definition --task-definition ${FAMILY} --region ap-southeast-1 | jq -r '.taskDefinition.revision') + REVISION=$(aws ecs describe-task-definition --task-definition ${FAMILY} --region ap-southeast-1 | jq -r '.taskDefinition.revision') aws ecs update-service --cluster ${CLUSTER} --region ap-southeast-1 --service ${SERVICE_NAME} --task-definition ${FAMILY}:${REVISION} --desired-count ${DESIRED_COUNT} - fi \ No newline at end of file + fi