Skip to content

Commit 477996f

Browse files
committed
Add conditional check to skip deployment if no image tags are available
1 parent bf40ad0 commit 477996f

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

.github/workflows/gitops-staging.yaml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,14 @@ jobs:
212212
- build-and-deploy-server
213213
- build-and-deploy-dashboard
214214
steps:
215+
- name: Skip if no image tags are available
216+
run: |
217+
if [[ -z "${{ needs.build-and-deploy-server.outputs.server-image-tag }}" && -z "${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}" ]]; then
218+
echo "No image tags available — skipping deployment."
219+
exit 0
220+
fi
221+
echo "Image tags available, proceeding with deployment."
222+
215223
- name: Checkout GitOps Repository
216224
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
217225
with:
@@ -232,24 +240,20 @@ jobs:
232240
233241
- name: Update Helm Values for Staging
234242
run: |
235-
# Update server image tag only if it's not empty
243+
# Update server image tag if available
236244
if [[ -n "${{ needs.build-and-deploy-server.outputs.server-image-tag }}" ]]; then
237245
echo "Updating server image tag to: ${{ needs.build-and-deploy-server.outputs.server-image-tag }}"
238246
yq eval ".image.tag = \"${{ needs.build-and-deploy-server.outputs.server-image-tag }}\"" \
239247
-i gitops-repo/infra/helm/gram/values-dev.yaml
240-
else
241-
echo "Server image tag is empty, skipping server image update"
242248
fi
243249
244-
# Update dashboard image tag only if it's not empty
250+
# Update dashboard image tag if available
245251
if [[ -n "${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}" ]]; then
246252
echo "Updating dashboard image tag to: ${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}"
247253
if grep -q "dashboard:" gitops-repo/infra/helm/gram/values-dev.yaml; then
248254
yq eval ".dashboard.tag = \"${{ needs.build-and-deploy-dashboard.outputs.dashboard-image-tag }}\"" \
249255
-i gitops-repo/infra/helm/gram/values-dev.yaml
250256
fi
251-
else
252-
echo "Dashboard image tag is empty, skipping dashboard image update"
253257
fi
254258
255259
- name: Commit and Push Changes

0 commit comments

Comments
 (0)