refactor(ci): restore simple boolean stage switches with debug instrumentation

Switch central CI to run_build/run_quality/run_deploy workflow_call inputs and simplify job if conditions. Add temporary runtime debug logs for gate verification.

Made-with: Cursor
This commit is contained in:
WDI-Ideas
2026-04-08 17:24:06 +05:30
parent 308671e69c
commit 91dccaa32a

View File

@@ -3,7 +3,13 @@ name: Central CI
on: on:
workflow_call: workflow_call:
inputs: inputs:
ci_steps: run_build:
type: string
required: true
run_quality:
type: string
required: true
run_deploy:
type: string type: string
required: true required: true
wait_for_quality_gate: wait_for_quality_gate:
@@ -70,31 +76,17 @@ on:
jobs: jobs:
build: build:
if: ${{ contains(format(',{0},', inputs.ci_steps), ',build,') }} if: ${{ inputs.run_build == 'true' }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
cs: ${{ steps.capture.outputs.cs }}
run_sonar: ${{ steps.flags.outputs.run_sonar }}
run_deploy: ${{ steps.flags.outputs.run_deploy }}
steps: steps:
- id: capture #region agent log
name: Capture ci_steps - name: Debug input forwarding for build
run: echo "cs=${{ inputs.ci_steps }}" >> "$GITHUB_OUTPUT"
- id: flags
name: Compute stage flags
shell: bash
run: | run: |
cs=",${{ inputs.ci_steps }}," curl -sS -X POST "http://127.0.0.1:7352/ingest/24143b9f-f549-4429-832c-d0515ce6e2ac" \
if [[ "$cs" == *",sonar,"* ]]; then -H "Content-Type: application/json" \
echo "run_sonar=true" >> "$GITHUB_OUTPUT" -H "X-Debug-Session-Id: 0ae703" \
else -d "{\"sessionId\":\"0ae703\",\"runId\":\"${{ github.run_id }}\",\"hypothesisId\":\"H1\",\"location\":\"wdipl-actions/.gitea/workflows/ci.yml:build\",\"message\":\"workflow_call flags at build\",\"data\":{\"run_build\":\"${{ inputs.run_build }}\",\"run_quality\":\"${{ inputs.run_quality }}\",\"run_deploy\":\"${{ inputs.run_deploy }}\"},\"timestamp\":$(date +%s000)}" || true
echo "run_sonar=false" >> "$GITHUB_OUTPUT" #endregion
fi
if [[ "$cs" == *",deploy,"* ]]; then
echo "run_deploy=true" >> "$GITHUB_OUTPUT"
else
echo "run_deploy=false" >> "$GITHUB_OUTPUT"
fi
- name: Checkout Code - name: Checkout Code
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -119,8 +111,7 @@ jobs:
fi fi
sonar: sonar:
if: ${{ needs.build.outputs.run_sonar == 'true' }} if: ${{ inputs.run_quality == 'true' }}
needs: [build]
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/quality.yml@d604440af823c664b2c828a3d6a2cc5d23b79141 uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/quality.yml@d604440af823c664b2c828a3d6a2cc5d23b79141
with: with:
project_key: ${{ github.event.repository.name }} project_key: ${{ github.event.repository.name }}
@@ -130,8 +121,7 @@ jobs:
SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }} SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
deploy: deploy:
if: ${{ always() && needs.build.outputs.run_deploy == 'true' && needs.build.result == 'success' && needs.sonar.result != 'failure' }} if: ${{ inputs.run_deploy == 'true' }}
needs: [build, sonar]
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/deploy.yml@main uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/deploy.yml@main
with: with:
tech_stack: ${{ inputs.tech_stack }} tech_stack: ${{ inputs.tech_stack }}
@@ -158,3 +148,31 @@ jobs:
PROD_SERVER_USERNAME: ${{ secrets.PROD_SERVER_USERNAME }} PROD_SERVER_USERNAME: ${{ secrets.PROD_SERVER_USERNAME }}
PROD_SERVER_PASSWORD: ${{ secrets.PROD_SERVER_PASSWORD }} PROD_SERVER_PASSWORD: ${{ secrets.PROD_SERVER_PASSWORD }}
PROD_SERVER_KEY: ${{ secrets.PROD_SERVER_KEY }} PROD_SERVER_KEY: ${{ secrets.PROD_SERVER_KEY }}
quality_gate_debug:
if: ${{ always() }}
needs: [build, sonar]
runs-on: ubuntu-latest
steps:
#region agent log
- name: Debug quality decision result
run: |
curl -sS -X POST "http://127.0.0.1:7352/ingest/24143b9f-f549-4429-832c-d0515ce6e2ac" \
-H "Content-Type: application/json" \
-H "X-Debug-Session-Id: 0ae703" \
-d "{\"sessionId\":\"0ae703\",\"runId\":\"${{ github.run_id }}\",\"hypothesisId\":\"H2\",\"location\":\"wdipl-actions/.gitea/workflows/ci.yml:quality_gate_debug\",\"message\":\"quality job outcome\",\"data\":{\"run_quality\":\"${{ inputs.run_quality }}\",\"build_result\":\"${{ needs.build.result }}\",\"sonar_result\":\"${{ needs.sonar.result }}\"},\"timestamp\":$(date +%s000)}" || true
#endregion
deploy_gate_debug:
if: ${{ always() }}
needs: [build, sonar, deploy]
runs-on: ubuntu-latest
steps:
#region agent log
- name: Debug deploy decision result
run: |
curl -sS -X POST "http://127.0.0.1:7352/ingest/24143b9f-f549-4429-832c-d0515ce6e2ac" \
-H "Content-Type: application/json" \
-H "X-Debug-Session-Id: 0ae703" \
-d "{\"sessionId\":\"0ae703\",\"runId\":\"${{ github.run_id }}\",\"hypothesisId\":\"H3\",\"location\":\"wdipl-actions/.gitea/workflows/ci.yml:deploy_gate_debug\",\"message\":\"deploy job outcome\",\"data\":{\"run_deploy\":\"${{ inputs.run_deploy }}\",\"build_result\":\"${{ needs.build.result }}\",\"sonar_result\":\"${{ needs.sonar.result }}\",\"deploy_result\":\"${{ needs.deploy.result }}\"},\"timestamp\":$(date +%s000)}" || true
#endregion