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 15ddac4 commit c6a72ac
Show file tree
Hide file tree
Showing 15 changed files with 83 additions and 53 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/dev-agent.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
push:
branches:
- pipeline-implementation
# paths:
# - 'apps/agent-service/**'
# workflow_dispatch:
paths:
- 'apps/agent-service/**'
workflow_dispatch:

env:
ECR_IMAGE_TAG: "USER_v_${{ github.run_number }}"
Expand Down
19 changes: 11 additions & 8 deletions .github/workflows/dev-api-gateway.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Build and deploy Node.js app to ECSsdc
on:
push:
branches:
- main
paths:
- 'apps/api-gateway/**'
workflow_dispatch:
- pipeline-implementation
# paths:
# - 'apps/api-gateway/**'
# workflow_dispatch:

env:
ECR_IMAGE_TAG: "API-GATEWAY_V_${{ github.run_number }}"
Expand Down Expand Up @@ -71,12 +71,13 @@ jobs:
- name: Update Task Definition and service
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)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/api-gateway-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/agent-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 @@ -94,6 +95,8 @@ 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
11 changes: 7 additions & 4 deletions .github/workflows/dev-connection.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ jobs:
- name: Update Task Definition and service
run: |
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/connection-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/connection-service.json)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/connection-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/agent-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 @@ -94,6 +95,8 @@ 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
11 changes: 7 additions & 4 deletions .github/workflows/dev-ecosystem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ jobs:
- name: Update Task Definition and service
run: |
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/ecosystem-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/ecosystem-service.json)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/ecosystem-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/agent-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 @@ -94,6 +95,8 @@ 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
11 changes: 7 additions & 4 deletions .github/workflows/dev-issuance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ jobs:
- name: Update Task Definition and service
run: |
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/issuance-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/issuance-service.json)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/issuance-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/agent-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,6 +96,8 @@ 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
11 changes: 7 additions & 4 deletions .github/workflows/dev-ledger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,13 @@ jobs:
- name: Update Task Definition and service
run: |
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/ledger-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/ledger-service.json)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/ledger-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/agent-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,6 +96,8 @@ 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
11 changes: 7 additions & 4 deletions .github/workflows/dev-notification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ jobs:
- name: Update Task Definition and service
run: |
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/notification-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/notification-service.json)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/notification-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/agent-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 @@ -94,6 +95,8 @@ 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
13 changes: 8 additions & 5 deletions .github/workflows/dev-organization.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ 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/organization-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/organization-service.json)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/organization-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/agent-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 @@ -94,6 +95,8 @@ 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
11 changes: 7 additions & 4 deletions .github/workflows/dev-utility.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ jobs:
- name: Update Task Definition and service
run: |
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/utility-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/utility-service.json)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/utility-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/agent-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 @@ -94,6 +95,8 @@ 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
11 changes: 7 additions & 4 deletions .github/workflows/dev-verification.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,13 @@ jobs:
- name: Update Task Definition and service
run: |
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/verification-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/verification-service.json)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/verification-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/agent-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 @@ -94,6 +95,8 @@ 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
13 changes: 8 additions & 5 deletions .github/workflows/dev-webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,14 +69,15 @@ 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/webhook-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/webhook-service.json)
FAMILY=$(sed -n 's/.*"family": "\(.*\)",/\1/p' taskdef/agent-service.json)
NAME=$(sed -n 's/.*"name": "\(.*\)",/\1/p' taskdef/agent-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/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/agent-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 @@ -94,6 +95,8 @@ 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
2 changes: 1 addition & 1 deletion taskdef/notification-webhook-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"family": "DEV_NOTIFICATION-WEBHOOK_SERVICE_TASKDEFINITION",
"containerDefinitions": [
{
"name": "NOTIFICATION-WEBHOOK",
"name": "notification-webhook",
"image": "%REPOSITORY_URI%:NOTIFICATION-WEBHOOK_V_%BUILD_NUMBER%",
"cpu": 1024,
"memory": 2048,
Expand Down
2 changes: 1 addition & 1 deletion taskdef/utility-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"family": "DEV_UTILITY_SERVICE_TASKDEFINITION",
"containerDefinitions": [
{
"name": "UTILITY",
"name": "utility",
"image": "%REPOSITORY_URI%:UTILITY_V_%BUILD_NUMBER%",
"cpu": 1024,
"memory": 2048,
Expand Down
2 changes: 1 addition & 1 deletion taskdef/verification-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"family": "DEV_VERIFICATION_SERVICE_TASKDEFINITION",
"containerDefinitions": [
{
"name": "VERIFICATION",
"name": "verification",
"image": "%REPOSITORY_URI%:VERIFICATION_V_%BUILD_NUMBER%",
"cpu": 1024,
"memory": 2048,
Expand Down
2 changes: 1 addition & 1 deletion taskdef/webhook-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"family": "DEV_WEBHOOK_SERVICE_TASKDEFINITION",
"containerDefinitions": [
{
"name": "WEBHOOK",
"name": "webhook",
"image": "%REPOSITORY_URI%:WEBHOOK_v_%BUILD_NUMBER%",
"cpu": 1024,
"memory": 2048,
Expand Down

0 comments on commit c6a72ac

Please sign in to comment.