feat: enhance silva AI compatibility #4153
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR | |
| on: | |
| pull_request: | |
| concurrency: | |
| # PR open and close use the same group, allowing only one at a time | |
| group: pr-${{ github.workflow }}-${{ github.event.number }} | |
| cancel-in-progress: true | |
| permissions: {} | |
| jobs: | |
| builds: | |
| name: Builds | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| attestations: write | |
| id-token: write | |
| packages: write | |
| strategy: | |
| matrix: | |
| package: [backend, backend-postgres, frontend] | |
| include: | |
| - package: backend | |
| build_context: backend | |
| extra_build_arg: PRIMARY_DB=oracle | |
| triggers: ('backend/') | |
| - package: backend-postgres | |
| build_context: backend | |
| extra_build_arg: PRIMARY_DB=postgres | |
| triggers: ('backend/') | |
| - package: frontend | |
| build_context: frontend | |
| extra_build_arg: '' | |
| triggers: ('frontend/') | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: bcgov/action-builder-ghcr@cb2629351c87dd1c2130073e4ebb7233a9653a63 # v4.4.1 | |
| with: | |
| package: ${{ matrix.package }} | |
| build_context: ${{ matrix.build_context }} | |
| build_file: ${{ matrix.build_context }}/Dockerfile | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| triggers: ${{ matrix.triggers }} | |
| tags: ${{ github.event.number }} | |
| tag_fallback: latest | |
| build_args: | | |
| BUILDKIT_INLINE_CACHE=1 | |
| ${{ matrix.extra_build_arg }} | |
| fam_routes: | |
| name: Allocate FAM Routes | |
| concurrency: | |
| group: fam-routes-global | |
| cancel-in-progress: false | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| hybrid_route_number: ${{ steps.allocate.outputs.route_hybrid }} | |
| postgres_route_number: ${{ steps.allocate.outputs.route_postgres }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Allocate FAM routes | |
| id: allocate | |
| uses: ./.github/actions/allocate-fam-routes | |
| with: | |
| oc_token: ${{ secrets.OC_TOKEN }} | |
| oc_namespace: ${{ vars.OC_NAMESPACE }} | |
| oc_server: ${{ vars.OC_SERVER }} | |
| pr_number: ${{ github.event.number }} | |
| deploys: | |
| name: Deploys (${{ github.event.number }}) | |
| needs: [builds, fam_routes] | |
| strategy: | |
| matrix: | |
| primary_db: [oracle, postgres] | |
| include: | |
| - primary_db: oracle | |
| fam_route: ${{ needs.fam_routes.outputs.hybrid_route_number }} | |
| deployment_model: hybrid | |
| - primary_db: postgres | |
| fam_route: ${{ needs.fam_routes.outputs.postgres_route_number }} | |
| deployment_model: postgres | |
| secrets: inherit | |
| uses: ./.github/workflows/.deploy.yml | |
| with: | |
| backend_cpu_request: "30m" | |
| backend_min_replicas: "1" | |
| backend_max_replicas: "1" | |
| backend_primary_db: "${{ matrix.primary_db }}" | |
| fam_route: "${{ matrix.fam_route }}" | |
| target: "${{ github.event.number }}-${{ matrix.deployment_model }}" | |
| deployment_model: ${{ matrix.deployment_model }} | |
| triggers: '' | |
| cleanup_configmap: | |
| name: Cleanup ConfigMap After Deployment (${{ github.event.number }}) | |
| needs: [fam_routes, deploys] | |
| if: success() | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Remove route reservations from ConfigMap | |
| uses: bcgov/action-oc-runner@v1.7.0 | |
| env: | |
| PR_NUMBER: ${{ github.event.number }} | |
| HYBRID_ROUTE: ${{ needs.fam_routes.outputs.hybrid_route_number }} | |
| POSTGRES_ROUTE: ${{ needs.fam_routes.outputs.postgres_route_number }} | |
| with: | |
| oc_namespace: ${{ vars.OC_NAMESPACE }} | |
| oc_server: ${{ vars.OC_SERVER }} | |
| oc_token: ${{ secrets.OC_TOKEN }} | |
| commands: | | |
| echo "Deployment successful - removing route reservations from ConfigMap" | |
| echo "PR: $PR_NUMBER, Hybrid route: $HYBRID_ROUTE, Postgres route: $POSTGRES_ROUTE" | |
| # Check if ConfigMap exists | |
| if ! oc get configmap fam-route-allocations &>/dev/null; then | |
| echo "ConfigMap fam-route-allocations does not exist, nothing to clean up" | |
| exit 0 | |
| fi | |
| # Remove hybrid route reservation | |
| if [[ -n "$HYBRID_ROUTE" ]]; then | |
| oc patch configmap fam-route-allocations --type merge \ | |
| -p "{\"data\": {\"hybrid_${HYBRID_ROUTE}\": null}}" || true | |
| echo "Removed hybrid route $HYBRID_ROUTE reservation" | |
| fi | |
| # Remove postgres route reservation | |
| if [[ -n "$POSTGRES_ROUTE" ]]; then | |
| oc patch configmap fam-route-allocations --type merge \ | |
| -p "{\"data\": {\"postgres_${POSTGRES_ROUTE}\": null}}" || true | |
| echo "Removed postgres route $POSTGRES_ROUTE reservation" | |
| fi | |
| # ========================================================================== | |
| # WARNING: This job acts as the required merge gate for this workflow. | |
| # If you add a new job to this workflow, you MUST add its ID to the 'needs' | |
| # array below, otherwise its failure or cancellation will not block the PR! | |
| # ========================================================================== | |
| results: | |
| name: PR Results | |
| needs: [builds, fam_routes, deploys] | |
| if: always() | |
| runs-on: ubuntu-24.04 | |
| timeout-minutes: 1 | |
| steps: | |
| - name: Log Job Results Context | |
| run: | | |
| echo "=== Upstream Job Statuses ===" | |
| echo '${{ toJson(needs) }}' | |
| - name: Evaluate Overall Status | |
| if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') | |
| run: | | |
| echo "❌ Critical Check Failure: At least one required job has failed or was cancelled." | |
| exit 1 | |
| - name: Success Message | |
| run: echo "✅ All critical checks passed or were intentionally skipped!" |