Skip to content

Producer consumer

Producer consumer #69

name: sidecar-build-deploy
# Builds and tests the single, provider-agnostic Fluence quantum sidecar image.
# The fluence Python package (python/) is baked into the image; the sidecar
# resolves its vendor provider at runtime, so there is one image, not one per
# vendor. The same image also serves as the init container that stages the
# package into user pods (Model C).
on:
push:
branches: [main]
tags: ["v*"]
paths:
- "python/**"
- ".github/workflows/sidecar-build-deploy.yaml"
pull_request:
branches: [main]
paths:
- "python/**"
- ".github/workflows/sidecar-build-deploy.yaml"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
REGISTRY: ghcr.io
jobs:
# Test the fluence package before building the image. These tests need no
# vendor SDK — they cover registration, provider resolution, fail-soft
# interceptor behavior, and the staging mechanism end to end.
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install package
working-directory: python
run: pip install -e .
- name: Run tests
working-directory: python
run: python tests/test_fluence.py
build-deploy:
runs-on: ubuntu-latest
needs: test
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Image metadata
id: meta
uses: docker/metadata-action@v5
with:
# One image: ghcr.io/<owner>/fluence-sidecar (matches the SidecarImage
# constant the webhook injects).
images: ${{ env.REGISTRY }}/${{ github.repository }}-sidecar
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
- name: Build and push sidecar image
uses: docker/build-push-action@v6
with:
context: ./python
file: ./python/Dockerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max