@@ -232,14 +232,24 @@ jobs:
232232
233233 - name : Update Helm Values for Staging
234234 run : |
235- # Update server image tag
236- sed -i "s|tag: sha-[a-f0-9]*|tag: ${{ needs.build-and-deploy-server.outputs.server-image-tag }}|g" \
237- gitops-repo/infra/helm/gram/values-dev.yaml
235+ # Update server image tag only if it's not empty
236+ if [[ -n "${{ needs.build-and-deploy-server.outputs.server-image-tag }}" ]]; then
237+ echo "Updating server image tag to: ${{ needs.build-and-deploy-server.outputs.server-image-tag }}"
238+ yq eval ".image.tag = \"${{ needs.build-and-deploy-server.outputs.server-image-tag }}\"" \
239+ -i gitops-repo/infra/helm/gram/values-dev.yaml
240+ else
241+ echo "Server image tag is empty, skipping server image update"
242+ fi
238243
239- # Update dashboard image tag (if it exists in values)
240- if grep -q "dashboard:" gitops-repo/infra/helm/gram/values-dev.yaml; then
241- sed -i "s|tag: sha-[a-f0-9]*|tag: ${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}|g" \
242- gitops-repo/infra/helm/gram/values-dev.yaml
244+ # Update dashboard image tag only if it's not empty
245+ if [[ -n "${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}" ]]; then
246+ echo "Updating dashboard image tag to: ${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}"
247+ if grep -q "dashboard:" gitops-repo/infra/helm/gram/values-dev.yaml; then
248+ yq eval ".dashboard.tag = \"${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}\"" \
249+ -i gitops-repo/infra/helm/gram/values-dev.yaml
250+ fi
251+ else
252+ echo "Dashboard image tag is empty, skipping dashboard image update"
243253 fi
244254
245255 - name : Commit and Push Changes
0 commit comments