Skip to content

Commit

Permalink
feat: prettier on pipeline files
Browse files Browse the repository at this point in the history
  • Loading branch information
simone-amadio-acn authored and tensor5 committed Sep 1, 2023
1 parent 4d173ab commit c3bbae5
Show file tree
Hide file tree
Showing 4 changed files with 275 additions and 275 deletions.
136 changes: 68 additions & 68 deletions .github/workflows/deployColl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,79 +13,79 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Print GITHUB_REF
run: echo "GITHUB_REF=${GITHUB_REF}"
- name: Set output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" | sed 's/coll-v//' >> "${GITHUB_OUTPUT}"
- name: Check output
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
echo $RELEASE_VERSION
echo ${{ steps.vars.outputs.tag }}
- name: Checkout
uses: actions/checkout@v2
- name: Print GITHUB_REF
run: echo "GITHUB_REF=${GITHUB_REF}"
- name: Set output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" | sed 's/coll-v//' >> "${GITHUB_OUTPUT}"
- name: Check output
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
echo $RELEASE_VERSION
echo ${{ steps.vars.outputs.tag }}
- 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: eu-south-1
- 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: eu-south-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- 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: ${{ steps.vars.outputs.tag }}
run: |
# Build a docker container and push it to ECR
docker build --build-arg GEOIP_LICENSE=${{ secrets.GEOIP_LICENSE }} -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
echo "Pushing image to COLL ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
echo "Pushed image to COLL ECR "
- 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: ${{ steps.vars.outputs.tag }}
run: |
# Build a docker container and push it to ECR
docker build --build-arg GEOIP_LICENSE=${{ secrets.GEOIP_LICENSE }} -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG .
echo "Pushing image to COLL ECR..."
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
echo "Pushed image to COLL ECR "
- name: Update kube config for coll EKS
id: update-kube-config-coll
run: aws eks update-kubeconfig --name ${{ secrets.EKS_CLUSTER_NAME }}
- name: Update kube config for coll EKS
id: update-kube-config-coll
run: aws eks update-kubeconfig --name ${{ secrets.EKS_CLUSTER_NAME }}

- name: Apply the deployment to EKS
id: deploy
env:
IMAGE_TAG: ${{ steps.build-image.outputs.image }}
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.REPO_NAME }}
run: |
echo "Image tag: $IMAGE_TAG"
tag=$(echo ${IMAGE_TAG##*:})
echo "coll ecr: $ECR_REGISTRY/$ECR_REPOSITORY:$tag"
echo "Deploying to test EKS..."
cat git-deployment-coll.yml | sed "s|ImagePlaceholder|$ECR_REGISTRY/$ECR_REPOSITORY:$tag|g" | kubectl apply -f -
- name: Apply the deployment to EKS
id: deploy
env:
IMAGE_TAG: ${{ steps.build-image.outputs.image }}
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.REPO_NAME }}
run: |
echo "Image tag: $IMAGE_TAG"
tag=$(echo ${IMAGE_TAG##*:})
echo "coll ecr: $ECR_REGISTRY/$ECR_REPOSITORY:$tag"
echo "Deploying to test EKS..."
cat git-deployment-coll.yml | sed "s|ImagePlaceholder|$ECR_REGISTRY/$ECR_REPOSITORY:$tag|g" | kubectl apply -f -
- name: Check the deploy to EKS COLL
id: deploy-eks-coll
env:
IMAGE_TAG: ${{ steps.vars.outputs.tag }}
run: |
kubectl get cronjobs -n dtd-crawler-coll
tag=$(echo ${IMAGE_TAG##*:})
for cronjob in $(kubectl get cronjobs | awk '{print $1}' | grep -iv name); do kubectl get cronjob ${cronjob} -o json | jq -r '.spec.jobTemplate.spec.template.spec.containers[].image' | cut -d ':' -f2 | while read result; do { [[ ${result} == ${tag} ]] && echo "Deployment ${cronjob} ok"; } || { echo "Deployment ${cronjob} ko" && exit 1; }; done ; done
- name: Check the deploy to EKS COLL
id: deploy-eks-coll
env:
IMAGE_TAG: ${{ steps.vars.outputs.tag }}
run: |
kubectl get cronjobs -n dtd-crawler-coll
tag=$(echo ${IMAGE_TAG##*:})
for cronjob in $(kubectl get cronjobs | awk '{print $1}' | grep -iv name); do kubectl get cronjob ${cronjob} -o json | jq -r '.spec.jobTemplate.spec.template.spec.containers[].image' | cut -d ':' -f2 | while read result; do { [[ ${result} == ${tag} ]] && echo "Deployment ${cronjob} ok"; } || { echo "Deployment ${cronjob} ko" && exit 1; }; done ; done
- name: Send SNS notification when the deploy completes in collaudo
id: sns-success
if: success()
run: |
aws sns publish --topic-arn ${{ secrets.SNS_TOPIC_ARN }} --subject "[PCM DTD CRAWLER COLL] Deployment della versione ${{ steps.vars.outputs.tag }} avvenuto con successo" --message "Il deployment della versione ${{ steps.vars.outputs.tag }} è avvenuto con successo su EKS COLL"
- name: Send SNS notification when the deploy completes in collaudo
id: sns-success
if: success()
run: |
aws sns publish --topic-arn ${{ secrets.SNS_TOPIC_ARN }} --subject "[PCM DTD CRAWLER COLL] Deployment della versione ${{ steps.vars.outputs.tag }} avvenuto con successo" --message "Il deployment della versione ${{ steps.vars.outputs.tag }} è avvenuto con successo su EKS COLL"
- name: Send SNS notification when the deploy fails in collaudo
id: sns-failure
if: failure()
run: |
aws sns publish --topic-arn ${{ secrets.SNS_TOPIC_ARN }} --subject "[PCM DTD CRAWLER COLL] Deployment della versione ${{ steps.vars.outputs.tag }} fallito" --message "Il deployment della versione ${{ steps.vars.outputs.tag }} è fallito su EKS COLL"
- name: Send SNS notification when the deploy fails in collaudo
id: sns-failure
if: failure()
run: |
aws sns publish --topic-arn ${{ secrets.SNS_TOPIC_ARN }} --subject "[PCM DTD CRAWLER COLL] Deployment della versione ${{ steps.vars.outputs.tag }} fallito" --message "Il deployment della versione ${{ steps.vars.outputs.tag }} è fallito su EKS COLL"
130 changes: 65 additions & 65 deletions .github/workflows/deployProd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,77 +13,77 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" | sed 's/prod-v//' >> "${GITHUB_OUTPUT}"
- name: Check output
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
echo $RELEASE_VERSION
echo ${{ steps.vars.outputs.tag }}
- name: Checkout
uses: actions/checkout@v2
- name: Set output
id: vars
run: echo "tag=${GITHUB_REF#refs/*/}" | sed 's/prod-v//' >> "${GITHUB_OUTPUT}"
- name: Check output
env:
RELEASE_VERSION: ${{ steps.vars.outputs.tag }}
run: |
echo $RELEASE_VERSION
echo ${{ steps.vars.outputs.tag }}
- 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: eu-south-1
- 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: eu-south-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- 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: ${{ steps.vars.outputs.tag }}
ECR_REPOSITORY_PROD: ${{ secrets.REPO_NAME_PROD }}
- 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: ${{ steps.vars.outputs.tag }}
ECR_REPOSITORY_PROD: ${{ secrets.REPO_NAME_PROD }}

run: |
docker pull $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY_PROD:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY_PROD:$IMAGE_TAG
run: |
docker pull $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY_PROD:$IMAGE_TAG
docker push $ECR_REGISTRY/$ECR_REPOSITORY_PROD:$IMAGE_TAG
- name: Update kube config for prod EKS
id: update-kube-config-prod
run: aws eks update-kubeconfig --name ${{ secrets.EKS_CLUSTER_NAME_PROD }}
- name: Update kube config for prod EKS
id: update-kube-config-prod
run: aws eks update-kubeconfig --name ${{ secrets.EKS_CLUSTER_NAME_PROD }}

- name: Apply the deployment to EKS
id: deploy
env:
IMAGE_TAG: ${{ steps.build-image.outputs.image }}
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.REPO_NAME }}
ECR_REPOSITORY_PROD: ${{ secrets.REPO_NAME_PROD }}
run: |
echo "Image tag: $IMAGE_TAG"
tag=$(echo ${IMAGE_TAG##*:})
echo "prod ecr: $ECR_REGISTRY/$ECR_REPOSITORY_PROD:$tag"
echo "Deploying to prod EKS..."
cat git-deployment-prod.yml | sed "s|ImagePlaceholder|$ECR_REGISTRY/$ECR_REPOSITORY_PROD:$tag|g" | kubectl apply -f -
- name: Apply the deployment to EKS
id: deploy
env:
IMAGE_TAG: ${{ steps.build-image.outputs.image }}
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: ${{ secrets.REPO_NAME }}
ECR_REPOSITORY_PROD: ${{ secrets.REPO_NAME_PROD }}
run: |
echo "Image tag: $IMAGE_TAG"
tag=$(echo ${IMAGE_TAG##*:})
echo "prod ecr: $ECR_REGISTRY/$ECR_REPOSITORY_PROD:$tag"
echo "Deploying to prod EKS..."
cat git-deployment-prod.yml | sed "s|ImagePlaceholder|$ECR_REGISTRY/$ECR_REPOSITORY_PROD:$tag|g" | kubectl apply -f -
- name: Check the deploy to EKS PROD
id: deploy-eks-prod
env:
IMAGE_TAG: ${{ steps.vars.outputs.tag }}
run: |
kubectl get cronjobs -n dtd-crawler-prod
tag=$(echo ${IMAGE_TAG##*:})
for cronjob in $(kubectl get cronjobs | awk '{print $1}' | grep -iv name); do kubectl get cronjob ${cronjob} -o json | jq -r '.spec.jobTemplate.spec.template.spec.containers[].image' | cut -d ':' -f2 | while read result; do { [[ ${result} == ${tag} ]] && echo "Deployment ${cronjob} ok"; } || { echo "Deployment ${cronjob} ko" && exit 1; }; done ; done
- name: Check the deploy to EKS PROD
id: deploy-eks-prod
env:
IMAGE_TAG: ${{ steps.vars.outputs.tag }}
run: |
kubectl get cronjobs -n dtd-crawler-prod
tag=$(echo ${IMAGE_TAG##*:})
for cronjob in $(kubectl get cronjobs | awk '{print $1}' | grep -iv name); do kubectl get cronjob ${cronjob} -o json | jq -r '.spec.jobTemplate.spec.template.spec.containers[].image' | cut -d ':' -f2 | while read result; do { [[ ${result} == ${tag} ]] && echo "Deployment ${cronjob} ok"; } || { echo "Deployment ${cronjob} ko" && exit 1; }; done ; done
- name: Send SNS notification when the deploy completes in production
id: sns-success
if: success()
run: |
aws sns publish --topic-arn ${{ secrets.SNS_TOPIC_ARN }} --subject "[PCM DTD CRAWLER PROD] Deployment della versione ${{ steps.vars.outputs.tag }} avvenuto con successo" --message "Il deployment della versione ${{ steps.vars.outputs.tag }} è avvenuto con successo su EKS PROD"
- name: Send SNS notification when the deploy completes in production
id: sns-success
if: success()
run: |
aws sns publish --topic-arn ${{ secrets.SNS_TOPIC_ARN }} --subject "[PCM DTD CRAWLER PROD] Deployment della versione ${{ steps.vars.outputs.tag }} avvenuto con successo" --message "Il deployment della versione ${{ steps.vars.outputs.tag }} è avvenuto con successo su EKS PROD"
- name: Send SNS notification when the deploy fails in production
id: sns-failure
if: failure()
run: |
aws sns publish --topic-arn ${{ secrets.SNS_TOPIC_ARN }} --subject "[PCM DTD CRAWLER PROD] Deployment della versione ${{ steps.vars.outputs.tag }} fallito" --message "Il deployment della versione ${{ steps.vars.outputs.tag }} è fallito su EKS PROD"
- name: Send SNS notification when the deploy fails in production
id: sns-failure
if: failure()
run: |
aws sns publish --topic-arn ${{ secrets.SNS_TOPIC_ARN }} --subject "[PCM DTD CRAWLER PROD] Deployment della versione ${{ steps.vars.outputs.tag }} fallito" --message "Il deployment della versione ${{ steps.vars.outputs.tag }} è fallito su EKS PROD"
Loading

0 comments on commit c3bbae5

Please sign in to comment.