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:
@@ -3,7 +3,13 @@ name: Central CI
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
ci_steps:
|
||||
run_build:
|
||||
type: string
|
||||
required: true
|
||||
run_quality:
|
||||
type: string
|
||||
required: true
|
||||
run_deploy:
|
||||
type: string
|
||||
required: true
|
||||
wait_for_quality_gate:
|
||||
@@ -70,31 +76,17 @@ on:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
if: ${{ contains(format(',{0},', inputs.ci_steps), ',build,') }}
|
||||
if: ${{ inputs.run_build == 'true' }}
|
||||
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:
|
||||
- id: capture
|
||||
name: Capture ci_steps
|
||||
run: echo "cs=${{ inputs.ci_steps }}" >> "$GITHUB_OUTPUT"
|
||||
- id: flags
|
||||
name: Compute stage flags
|
||||
shell: bash
|
||||
#region agent log
|
||||
- name: Debug input forwarding for build
|
||||
run: |
|
||||
cs=",${{ inputs.ci_steps }},"
|
||||
if [[ "$cs" == *",sonar,"* ]]; then
|
||||
echo "run_sonar=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "run_sonar=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
if [[ "$cs" == *",deploy,"* ]]; then
|
||||
echo "run_deploy=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "run_deploy=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
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\":\"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
|
||||
#endregion
|
||||
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v3
|
||||
@@ -119,8 +111,7 @@ jobs:
|
||||
fi
|
||||
|
||||
sonar:
|
||||
if: ${{ needs.build.outputs.run_sonar == 'true' }}
|
||||
needs: [build]
|
||||
if: ${{ inputs.run_quality == 'true' }}
|
||||
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/quality.yml@d604440af823c664b2c828a3d6a2cc5d23b79141
|
||||
with:
|
||||
project_key: ${{ github.event.repository.name }}
|
||||
@@ -130,8 +121,7 @@ jobs:
|
||||
SONARQUBE_TOKEN: ${{ secrets.SONARQUBE_TOKEN }}
|
||||
|
||||
deploy:
|
||||
if: ${{ always() && needs.build.outputs.run_deploy == 'true' && needs.build.result == 'success' && needs.sonar.result != 'failure' }}
|
||||
needs: [build, sonar]
|
||||
if: ${{ inputs.run_deploy == 'true' }}
|
||||
uses: Rajendra.Reddy/wdipl-actions/.gitea/workflows/deploy.yml@main
|
||||
with:
|
||||
tech_stack: ${{ inputs.tech_stack }}
|
||||
@@ -158,3 +148,31 @@ jobs:
|
||||
PROD_SERVER_USERNAME: ${{ secrets.PROD_SERVER_USERNAME }}
|
||||
PROD_SERVER_PASSWORD: ${{ secrets.PROD_SERVER_PASSWORD }}
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user