Skip to content

Bump the backend-python-runtime group in /backend with 6 updates #178

Bump the backend-python-runtime group in /backend with 6 updates

Bump the backend-python-runtime group in /backend with 6 updates #178

name: "CI: Validate Docker Image"
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
on:
push:
branches: [ main ]
paths:
- '.github/workflows/docker-image-validate.yml'
- '.github/workflows/docker-image-publish.yml'
- '.github/workflows/docker-image-preview-publish.yml'
- '.github/workflows/docker-image-backfill.yml'
- '.github/workflows/docker-image-cleanup.yml'
- '.github/actions/setup-crane/action.yml'
- '.github/actions/setup-oras/action.yml'
- '.github/scripts/install_crane.sh'
- '.github/scripts/install_oras.sh'
- '.github/tools/crane/go.mod'
- '.github/scripts/promote_container_image.sh'
- '.github/scripts/verify_candidate_image.sh'
- '.github/scripts/metadata_bundle_tag.sh'
- '.github/scripts/extract_metadata_bundle_from_oci.sh'
- '.github/scripts/publish_metadata_bundle.sh'
- '.github/scripts/verify_candidate_metadata_bundle.sh'
- '.github/scripts/cleanup_test_container_versions.py'
- '.github/scripts/cleanup_untagged_container_versions.py'
- '.github/scripts/cleanup_signature_container_versions.py'
- 'Dockerfile'
- '.dockerignore'
- 'VERSION'
- 'backend/**'
- 'frontend/**'
- 'scripts/install-system-deps'
pull_request:
branches: [ main ]
paths:
- '.github/workflows/docker-image-validate.yml'
- '.github/workflows/docker-image-publish.yml'
- '.github/workflows/docker-image-preview-publish.yml'
- '.github/workflows/docker-image-backfill.yml'
- '.github/workflows/docker-image-cleanup.yml'
- '.github/actions/setup-crane/action.yml'
- '.github/actions/setup-oras/action.yml'
- '.github/scripts/install_crane.sh'
- '.github/scripts/install_oras.sh'
- '.github/tools/crane/go.mod'
- '.github/scripts/promote_container_image.sh'
- '.github/scripts/verify_candidate_image.sh'
- '.github/scripts/metadata_bundle_tag.sh'
- '.github/scripts/extract_metadata_bundle_from_oci.sh'
- '.github/scripts/publish_metadata_bundle.sh'
- '.github/scripts/verify_candidate_metadata_bundle.sh'
- '.github/scripts/cleanup_test_container_versions.py'
- '.github/scripts/cleanup_untagged_container_versions.py'
- '.github/scripts/cleanup_signature_container_versions.py'
- 'Dockerfile'
- '.dockerignore'
- 'VERSION'
- 'backend/**'
- 'frontend/**'
- 'scripts/install-system-deps'
workflow_dispatch:
concurrency:
group: validate-docker-image-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
prepare:
runs-on: ubuntu-24.04
outputs:
created: ${{ steps.metadata.outputs.created }}
steps:
- name: Capture shared build timestamp
id: metadata
shell: bash
run: printf 'created=%s\n' "$(date -u +'%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
validate:
needs: prepare
runs-on: ${{ matrix.runner_label }}
strategy:
fail-fast: false
matrix:
include:
- docker_platform: linux/amd64
platform_id: amd64
runner_label: ubuntu-24.04
- docker_platform: linux/arm64
platform_id: arm64
runner_label: ubuntu-24.04-arm
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Set up QEMU
if: ${{ matrix.platform_id == 'amd64' }}
uses: docker/setup-qemu-action@06116385d9baf250c9f4dcb4858b16962ea869c3 # v4.1.0
- name: Sync and verify version metadata
uses: ./.github/actions/sync-version-check
- name: Write build metadata files
shell: bash
run: git rev-parse --short HEAD > GIT_COMMIT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1.0
- name: Build validation image
uses: docker/build-push-action@f9f3042f7e2789586610d6e8b85c8f03e5195baf # v7.2.0
with:
context: .
file: ./Dockerfile
load: true
platforms: ${{ matrix.docker_platform }}
build-args: |
BUILD_CREATED_AT=${{ needs.prepare.outputs.created }}
tags: sambee:validation-${{ matrix.platform_id }}
cache-from: type=gha,scope=docker-image-validate-${{ matrix.platform_id }}
cache-to: type=gha,mode=max,scope=docker-image-validate-${{ matrix.platform_id }}
- name: Start validation container
shell: bash
run: |
docker run -d \
--platform ${{ matrix.docker_platform }} \
--name sambee-smoke-${{ matrix.platform_id }} \
-p 8000:8000 \
-e SECRET_KEY=test-secret-key-for-ci-only-not-for-production-use \
-e ENCRYPTION_KEY=YYFPojCh_1WUExv5xXVEyFe0ITw_5dgZZ-fC-iZk3nU= \
sambee:validation-${{ matrix.platform_id }}
- name: Wait for health endpoint
shell: bash
run: |
for attempt in $(seq 1 60); do
if ! docker container inspect sambee-smoke-${{ matrix.platform_id }} >/dev/null 2>&1; then
echo "Validation container disappeared before health check completed" >&2
exit 1
fi
if [[ "$(docker inspect -f '{{.State.Running}}' sambee-smoke-${{ matrix.platform_id }})" != "true" ]]; then
echo "Validation container exited before /api/health became ready" >&2
docker logs sambee-smoke-${{ matrix.platform_id }} || true
exit 1
fi
if curl --fail --silent http://127.0.0.1:8000/api/health >/dev/null; then
exit 0
fi
sleep 2
done
echo "Timed out waiting for /api/health" >&2
docker logs sambee-smoke-${{ matrix.platform_id }} || true
exit 1
- name: Print container logs on failure
if: failure()
shell: bash
run: |
if docker container inspect sambee-smoke-${{ matrix.platform_id }} >/dev/null 2>&1; then
docker logs sambee-smoke-${{ matrix.platform_id }}
else
echo "Validation container is no longer available for log collection"
fi
- name: Clean up validation container
if: always()
shell: bash
run: docker rm -f sambee-smoke-${{ matrix.platform_id }} || true