Skip to content

Commit 79c36fe

Browse files
committed
Fix deployment script and image tags in Kubernetes manifests
1 parent 846c75f commit 79c36fe

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

.github/workflows/cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,4 @@ jobs:
9595
uses: azure/setup-helm@v1
9696

9797
- name: Deploy to Kubernetes [PRODUCTION ENVIRONMENT]
98-
run: ./deploy.sh "${{ inputs.image_tag }}" "${{ inputs.debug}}"
98+
run: ./deploy.sh ${{ inputs.image_tag }} ${{ inputs.debug}}

deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ IMAGE_TAG=$(echo "${1}" | cut -d ":" -f 2)
1010
DEBUG=${2:-0}
1111

1212
# Check if the app deployment exists
13-
if kubectl get deployments app-release-my-chart-v1 && kubectl get deployments app-release-my-chart-v2; then
13+
if kubectl get deployments app-release-my-chart-v1 2>/dev/null && kubectl get deployments app-release-my-chart-v2 2>/dev/null; then
1414
# Get the current v1 and v2 image tags from the app deployment in the cluster
1515
CURRENT_V1_IMAGE_TAG=$(kubectl get pods -l app=spring-app -o json | jq -r '.items[] | select(.metadata.name | contains("v1")) | .spec.containers[0].image' | cut -d ":" -f 2 | head -n 1)
1616
CURRENT_V2_IMAGE_TAG=$(kubectl get pods -l app=spring-app -o json | jq -r '.items[] | select(.metadata.name | contains("v2")) | .spec.containers[0].image' | cut -d ":" -f 2 | head -n 1)

my-chart/templates/spring-app-deployment-v1.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ spec:
3131
value: {{ .Values.v1.springAppContainer.env.redisHost }}
3232
- name: KUBERNETES_CLUSTER_DOMAIN
3333
value: {{ .Values.kubernetesClusterDomain }}
34-
image: {{ .Values.v1.springAppContainer.image.repository }}:{{ .Values.v1.springAppContainer.image.tag
35-
| default .Chart.AppVersion }}
34+
image: {{ .Values.v1.springAppContainer.image.repository }}:{{ .Values.v1.springAppContainer.image.tag }}
3635
imagePullPolicy: Always
3736
name: spring-app-container
3837
ports:

my-chart/templates/spring-app-deployment-v2.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ spec:
2929
value: {{ .Values.v2.springAppContainer.env.changelogVersion }}
3030
- name: REDIS_HOST
3131
value: {{ .Values.v2.springAppContainer.env.redisHost }}
32-
image: {{ .Values.v2.springAppContainer.image.repository }}:{{ .Values.v2.springAppContainer.image.tag
33-
| default .Chart.AppVersion }}
32+
image: {{ .Values.v2.springAppContainer.image.repository }}:{{ .Values.v2.springAppContainer.image.tag }}
3433
imagePullPolicy: Always
3534
name: spring-app-container
3635
ports:

0 commit comments

Comments
 (0)