Skip to content

Commit

Permalink
Update EKS-DEV-PRATHAM-DEPLOYMENT.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
muzafferjoya authored Jul 10, 2024
1 parent b033626 commit 2cb8a3f
Showing 1 changed file with 31 additions and 13 deletions.
44 changes: 31 additions & 13 deletions .github/workflows/EKS-DEV-PRATHAM-DEPLOYMENT.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
aws-region: ${{env.AWS_REGION}}
- name: Setup Node Env
uses: actions/setup-node@v3
with:
Expand All @@ -31,10 +31,26 @@ jobs:
env:
ENV_FILE_CONTENT: ${{ secrets.ENV_FILE_CONTENT_DEV }}
run: echo "$ENV_FILE_CONTENT" > manifest/configmap.yaml
- name: Show PWD and list content
run: |
echo "Current Working Directory: pwd"
pwd
ls -ltra
- name: Creating Dockerfile
env:
DOCKERFILE_FILE_CONTENT: ${{ secrets.DOCKERFILE_FILE_CONTENT }}
run: echo "$DOCKERFILE_FILE_CONTENT" > Dockerfile
- name: Show PWD and list content
run: |
echo "Current Working Directory: pwd"
pwd
ls -ltra manifest/
- 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: ${{ env.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
Expand All @@ -43,27 +59,29 @@ jobs:
ECR_REGISTRY: ${{ secrets.ECR_REPOSITORY }}
IMAGE_TAG: ${{ secrets.ECR_IMAGE_TAG }}
run: |
docker build -t $ECR_REGISTRY:$IMAGE_TAG .
docker push $ECR_REGISTRY:$IMAGE_TAG
docker build -t ${{ secrets.ECR_REPOSITORY }}:${{ secrets.ECR_IMAGE_TAG }} .
docker push ${{ secrets.ECR_REPOSITORY }}:${{ secrets.ECR_IMAGE_TAG }}
- name: Update kube config
run: aws eks update-kubeconfig --name ${{ secrets.EKS_CLUSTER_NAME }} --region ${{ secrets.AWS_REGION_NAME }}
- name: Deploy to EKS
env:
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
ECR_REGISTRY: ${{ secrets.ECR_REPOSITORY }}
IMAGE_TAG: ${{ secrets.ECR_IMAGE_TAG }}
ECR_REPOSITORY: ${{ secrets.ECR_REPOSITORY }}
ECR_IMAGE: ${{ secrets.ECR_IMAGE }}
run: |
# Print env variables for debugging
echo "ECR_REPOSITORY: $ECR_REPOSITORY"
echo "IMAGE_TAG: $IMAGE_TAG"
# Substitute env variables in the YAML
export ECR_REPOSITORY=${{ secrets.ECR_REPOSITORY }}
export IMAGE_TAG=${{ secrets.ECR_IMAGE_TAG }}
export ECR_IMAGE=${{ secrets.ECR_IMAGE }}
envsubst < manifest/notification-service.yaml > manifest/notification-service-updated.yaml
echo "Substituted YAML:"
cat manifest/notification-service-updated.yaml # Print the substituted file
echo "Validating YAML:"
python -c 'import yaml, sys; yaml.safe_load(sys.stdin)' < manifest/notification-service-updated.yaml # Validate YAML format
cat manifest/notification-service-updated.yaml
rm -rf manifest/notification-service.yaml
cat manifest/notification-service-updated.yaml
ls -ltra manifest/
kubectl apply -f manifest/configmap.yaml
kubectl apply -f manifest/notification-service-updated.yaml
sleep 10
kubectl get pods
kubectl get services
kubectl get deployment
kubectl get deployment

0 comments on commit 2cb8a3f

Please sign in to comment.