Skip to content

refactor(api): replace RedHat UBI with Debian-Slim (#946) #3111

refactor(api): replace RedHat UBI with Debian-Slim (#946)

refactor(api): replace RedHat UBI with Debian-Slim (#946) #3111

Workflow file for this run

name: PR
on:
pull_request:
concurrency:
group: ${{ github.event.number }}
cancel-in-progress: true
permissions: {}
jobs:
build:
name: Build
runs-on: ubuntu-24.04
permissions:
packages: write
id-token: write
attestations: write
strategy:
matrix:
package: [admin, api, db, public]
include:
- package: admin
build_context: ./
build_file: admin/Dockerfile
triggers: ('admin/' 'libs/')
- package: api
build_context: ./
build_file: api/Dockerfile
triggers: ('api/' 'libs/')
- package: db
triggers: ('db')
- package: public
build_context: ./
build_file: public/Dockerfile
triggers: ('public/' 'libs/')
steps:
- uses: actions/checkout@v7
- uses: bcgov/action-builder-ghcr@v4.4.1
with:
package: ${{ matrix.package }}
build_context: ${{ matrix.build_context }}
build_file: ${{ matrix.build_file }}
tags: ${{ github.event.number }}
tag_fallback: latest
token: ${{ secrets.GITHUB_TOKEN }}
triggers: ${{ matrix.triggers }}
deploy:
name: Deploy (${{ github.event.number }})
needs: [build]
permissions:
contents: read
issues: write
secrets: inherit
uses: ./.github/workflows/.deploy.yml
with:
db_testdata: true
email_notify: nonexistent@gov.bc.ca # lower environment fake email address to send
replica_count: 1
triggers: ('db/' 'libs/' 'api/' 'admin/' 'public/')
smoke:
name: Smoke Test
needs: [deploy]
if: needs.deploy.outputs.triggered == 'true'
runs-on: ubuntu-24.04
steps:
- name: Wait for App to respond
run: |
URL_HOST="${{ needs.deploy.outputs.url }}"
if [ -z "$URL_HOST" ]; then
PR_NUM=${{ github.event.number }}
MOD_TAG=$(( PR_NUM % 50 ))
URL_HOST="fom-$MOD_TAG.apps.silver.devops.gov.bc.ca"
fi
URL="https://$URL_HOST/api"
echo "Smoke testing endpoint: $URL"
for i in {1..30}; do
HTTP_STATUS=$(curl -sL -k -o /dev/null -w "%{http_code}" "$URL" || true)
if [ "$HTTP_STATUS" = "200" ] || [ "$HTTP_STATUS" = "302" ] || [ "$HTTP_STATUS" = "404" ]; then
echo "✅ App is alive! Status: $HTTP_STATUS"
exit 0
fi
echo "Waiting for app to start (Status: $HTTP_STATUS)... attempt $i/30"
sleep 10
done
echo "❌ Smoke test failed! App returned status: $HTTP_STATUS"
exit 1
# ==========================================================================
# 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: [build, deploy, smoke]
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!"