From ebbb089805eb0ed13d82bbd3be3c3690a7fa1fe1 Mon Sep 17 00:00:00 2001 From: Carol Br Date: Sun, 8 Dec 2024 00:55:07 -0300 Subject: [PATCH] fix: correct image version variable usage in deployment workflows --- .github/workflows/deploy-dev.yml | 10 ++++------ .github/workflows/release.yml | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/deploy-dev.yml b/.github/workflows/deploy-dev.yml index 4fee0668..7fe9eb5c 100644 --- a/.github/workflows/deploy-dev.yml +++ b/.github/workflows/deploy-dev.yml @@ -53,21 +53,19 @@ jobs: run: aws eks --region $AWS_REGION update-kubeconfig --name $EKS_CLUSTER_NAME - name: Deploy to EKS cluster in development namespace - env: - IMAGE_VERSION: ${{ env.image-version }} run: | source $GITHUB_ENV ENVIRONMENT=development KUSTOMIZE_DIR=$(pwd)/infra/kubernetes/$ENVIRONMENT - + cd $KUSTOMIZE_DIR + # Check if namespace exists, if not create it kubectl get namespace $ENVIRONMENT || kubectl create namespace $ENVIRONMENT - kustomize edit set image web=$ECR_REGISTRY/$ECR_REPOSITORY:${{ env.IMAGE_VERSION }} + kustomize edit set image web=$ECR_REGISTRY/$ECR_REPOSITORY:${{ env.image-version }} echo "Deploying resource in $ENVIRONMENT namespace." - cd $KUSTOMIZE_DIR - echo "Using image version: $IMAGE_VERSION" + echo "Using image version: ${{ env.image-version }}" kubectl apply -k $KUSTOMIZE_DIR -n $ENVIRONMENT && echo "Resources deployed successfully!" || {echo "Failed to deploy resources! Check the logs"; kubectl describe pods -n $ENVIRONMENT; exit 1; } \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b53ea02a..9f9dbcb7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -104,6 +104,7 @@ jobs: ENVIRONMENT=production KUSTOMIZE_DIR=$(pwd)/infra/kubernetes/production + cd $KUSTOMIZE_DIR # Check if namespace exists, if not create it kubectl get namespace $ENVIRONMENT || kubectl create namespace $ENVIRONMENT @@ -112,7 +113,6 @@ jobs: kustomize edit set image web=$ECR_REGISTRY/$ECR_REPOSITORY:${{ env.NEW_VERSION }} echo "Deploying resources in $ENVIRONMENT environment" - cd $KUSTOMIZE_DIR echo "Using image version: ${{ env.NEW_VERSION }}" kubectl apply -k $KUSTOMIZE_DIR -n $ENVIRONMENT && echo "Resources deployed successfully!" || {echo "Failed to deploy resources! Check the logs"; kubectl describe pods -n $ENVIRONMENT; exit 1; }