feat: updated the pipeline for ldap image #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
pull_request: | |
branches: [ main ] | |
name: AWS ECR push | |
jobs: | |
deploy: | |
name: Deploy | |
runs-on: self-hosted | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- 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: us-east-1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push the image to Amazon ECR | |
id: build-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: ${{ secrets.REPO_NAME }} | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
# Build a docker container and push it to ECR | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
echo "Pushing image to ECR..." | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | |
- name: Tagging the latest image | |
id: tag-image | |
env: | |
LATEST_TAG: latest | |
IMAGE_TAG: ${{ github.sha }} | |
run: | | |
docker tag 730335644419.dkr.ecr.us-east-1.amazonaws.com/openldap:$IMAGE_TAG 730335644419.dkr.ecr.us-east-1.amazonaws.com/openldap:latest | |
docker push 730335644419.dkr.ecr.us-east-1.amazonaws.com/openldap:latest | |
- name: Login to AWS | |
id : aws-login | |
run: | | |
aws eks update-kubeconfig --region us-east-1 --name TMF-INFRA-EKS | |
- name: Deploy the manifest files | |
id: deploy-app | |
run: | | |
kubectl apply -f kubernetes/deployment.yaml | |
kubectl apply -f kubernetes/secret.yaml | |
kubectl apply -f kubernetes/service.yaml |