Skip to content

Commit

Permalink
pipeline implemetation
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheetal-ayanworks committed Apr 16, 2024
1 parent 02824c1 commit c1c1181
Show file tree
Hide file tree
Showing 11 changed files with 77 additions and 106 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev-api-gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 9 additions & 12 deletions .github/workflows/dev-connection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/dev-ecosystem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/dev-issuance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/dev-ledger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/dev-notification-webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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: |
Expand All @@ -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
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/dev-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/dev-organization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/dev-utility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
Loading

0 comments on commit c1c1181

Please sign in to comment.