fix(ci): Fix workflow job dependencies and execution flow
- Removed runtime-base from build job dependencies (build now only depends on changes) - runtime-base now only runs when needed (if needs_runtime_build or needs_build is true) - build job now handles missing runtime-base outputs gracefully - deploy-staging and deploy-production now only depend on build (not runtime-base) - Added always() conditions to ensure jobs run even if previous jobs are skipped - Fixes issue where workflow stopped after runtime-base job when build was skipped
This commit is contained in:
@@ -187,6 +187,7 @@ jobs:
|
|||||||
runtime-base:
|
runtime-base:
|
||||||
name: Build Runtime Base Image
|
name: Build Runtime Base Image
|
||||||
needs: changes
|
needs: changes
|
||||||
|
if: always()
|
||||||
runs-on: docker-build
|
runs-on: docker-build
|
||||||
outputs:
|
outputs:
|
||||||
image_ref: ${{ steps.set-result.outputs.image_ref }}
|
image_ref: ${{ steps.set-result.outputs.image_ref }}
|
||||||
@@ -470,7 +471,7 @@ jobs:
|
|||||||
# Job 2: Build & Push Docker Image
|
# Job 2: Build & Push Docker Image
|
||||||
build:
|
build:
|
||||||
name: Build Docker Image
|
name: Build Docker Image
|
||||||
needs: [changes, runtime-base]
|
needs: [changes]
|
||||||
if: needs.changes.outputs.needs_build == 'true'
|
if: needs.changes.outputs.needs_build == 'true'
|
||||||
runs-on: docker-build
|
runs-on: docker-build
|
||||||
outputs:
|
outputs:
|
||||||
@@ -647,8 +648,9 @@ jobs:
|
|||||||
DEFAULT_IMAGE="${{ env.REGISTRY }}/${{ env.RUNTIME_IMAGE_NAME }}:latest"
|
DEFAULT_IMAGE="${{ env.REGISTRY }}/${{ env.RUNTIME_IMAGE_NAME }}:latest"
|
||||||
SELECTED_IMAGE="$DEFAULT_IMAGE"
|
SELECTED_IMAGE="$DEFAULT_IMAGE"
|
||||||
|
|
||||||
if [ -n "${{ needs.runtime-base.outputs.image_ref }}" ]; then
|
RUNTIME_BASE_REF="${{ needs.runtime-base.outputs.image_ref || '' }}"
|
||||||
SELECTED_IMAGE="${{ needs.runtime-base.outputs.image_ref }}"
|
if [ -n "$RUNTIME_BASE_REF" ] && [ "$RUNTIME_BASE_REF" != "" ]; then
|
||||||
|
SELECTED_IMAGE="$RUNTIME_BASE_REF"
|
||||||
else
|
else
|
||||||
if ! docker pull "$DEFAULT_IMAGE" >/dev/null 2>&1; then
|
if ! docker pull "$DEFAULT_IMAGE" >/dev/null 2>&1; then
|
||||||
ALT_REGISTRY="${{ env.REGISTRY_URL }}"
|
ALT_REGISTRY="${{ env.REGISTRY_URL }}"
|
||||||
@@ -929,8 +931,8 @@ jobs:
|
|||||||
# Job 4: Auto-deploy to Production (only for main branch)
|
# Job 4: Auto-deploy to Production (only for main branch)
|
||||||
deploy-production:
|
deploy-production:
|
||||||
name: Auto-deploy to Production
|
name: Auto-deploy to Production
|
||||||
needs: [changes, build, runtime-base]
|
needs: [changes, build]
|
||||||
if: (github.ref_name == 'main' || github.head_ref == 'main' || (github.ref_name == '' && contains(github.ref, 'main'))) && needs.changes.outputs.needs_build == 'true'
|
if: always() && (github.ref_name == 'main' || github.head_ref == 'main' || (github.ref_name == '' && contains(github.ref, 'main'))) && needs.changes.outputs.needs_build == 'true'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
environment:
|
environment:
|
||||||
name: production
|
name: production
|
||||||
|
|||||||
Reference in New Issue
Block a user