diff --git a/.gitea/workflows/build_publish-artifact.yml b/.gitea/workflows/build_publish-artifact.yml index 43db788..3248728 100644 --- a/.gitea/workflows/build_publish-artifact.yml +++ b/.gitea/workflows/build_publish-artifact.yml @@ -91,6 +91,7 @@ jobs: quality-gate: needs: [check] + if: needs.check.outputs.artifact_exists == 'false' uses: niko/gitea-ci-library/.gitea/workflows/quality-gate.yml@main secrets: inherit with: @@ -101,44 +102,23 @@ jobs: build: runs-on: ubuntu-latest needs: [check, quality-gate] - # PAKOTETAAN KÄYNTIIN: always() ohittaa Gitean dynaamisen skippausbugin - if: always() + # TIUKKA NATIIVI EHTO: Jos testit feilasivat, tämä EI käynnisty koskaan (koko putki punaiselle) + if: success() steps: - uses: actions/checkout@v4 - - name: DIAGNOSTICS - Inspect Gitea State and Variables - run: | - echo "==================================================" - echo " GITEA ACTIONS STATE INSPECTION " - echo "==================================================" - echo "needs.check.result: ${{ needs.check.result }}" - echo "needs.quality-gate.result: ${{ needs.quality-gate.result }}" - echo "job.status: ${{ job.status }}" - echo "==================================================" - - name: Download build env uses: actions/download-artifact@v3 with: name: build-context path: /tmp/build-ctx - # TÄMÄ STEPPI VARMISTAA LAADUN JA RÄJÄYTTÄÄ PUTKEN JOS LAATUTESTIT EIVÄT OLLEET SUCCESS - - name: Verify Quality Gate and Context + - name: Gatekeeper check id: gatekeeper run: | - QG_RESULT="${{ needs.quality-gate.result }}" source /tmp/build-ctx/build.env - - echo "gitea-ci-library - Quality gate tilaksi luettu: $QG_RESULT" echo "gitea-ci-library - Levyltä luettu ARTIFACT_EXISTS: $ARTIFACT_EXISTS" - # 1. RÄJÄYTETÄÄN PUTKI jos testit feilasivat tai ne peruttiin - if [ "$QG_RESULT" != "success" ]; then - echo "gitea-ci-library - ERROR: Quality gate pitää läpäistä! Tila oli: $QG_RESULT" >&2 - exit 1 - fi - - # 2. Päätetään skipataanko build koska kontti on jo tehty if [ "$ARTIFACT_EXISTS" = "true" ]; then echo "gitea-ci-library - Kontti valmiina. Ohitetaan build-vaiheet." echo "skip=true" >> "$GITHUB_OUTPUT" @@ -192,7 +172,7 @@ jobs: push: runs-on: ubuntu-latest needs: [check, build] - if: always() + if: success() steps: - uses: actions/checkout@v4 @@ -202,15 +182,10 @@ jobs: name: build-context path: /tmp/build-ctx - - name: Verify Build Status + - name: Gatekeeper check id: gatekeeper run: | - BUILD_RESULT="${{ needs.build.result }}" source /tmp/build-ctx/build.env - if [ "$BUILD_RESULT" != "success" ]; then - echo "gitea-ci-library - Edellinen vaihe epäonnistui. Keskeytetään." >&2 - exit 1 - fi if [ "${ARTIFACT_EXISTS}" = "true" ]; then echo "skip=true" >> "$GITHUB_OUTPUT" else @@ -259,7 +234,7 @@ jobs: tag-commit: runs-on: ubuntu-latest needs: [check, push] - if: always() + if: success() steps: - uses: actions/checkout@v4 @@ -269,15 +244,10 @@ jobs: name: build-context path: /tmp/build-ctx - - name: Verify Push Status + - name: Gatekeeper check id: gatekeeper run: | - PUSH_RESULT="${{ needs.push.result }}" source /tmp/build-ctx/build.env - if [ "$PUSH_RESULT" != "success" ]; then - echo "gitea-ci-library - Push vaihe epäonnistui. Keskeytetään." >&2 - exit 1 - fi if [ "${ARTIFACT_EXISTS}" = "true" ]; then echo "skip=true" >> "$GITHUB_OUTPUT" else