Skip to content

Upgrade base images to Debian Trixie (DataBiosphere/azul#7383) #73

Upgrade base images to Debian Trixie (DataBiosphere/azul#7383)

Upgrade base images to Debian Trixie (DataBiosphere/azul#7383) #73

Workflow file for this run

name: build and push image
on:
pull_request:
push:
branches:
- azul
env:
# The fully qualified image name of the image to build. The first component is
# the host name of the registry that primarily hosts the image.
#
azul_docker_bigquery_emulator_image: docker.io/ucscgi/azul-bigquery-emulator
# An optional prefix for the image name if the image is to be pushed to an
# alternate registry instead of the one noted in the image name above.
#
azul_docker_registry: ""
# The tag of the image that's used as the base for this image. Because this
# value isn't reflected in the tag for this image, you also need to bump the
# internal version below when changing this variable.
#
azul_docker_bigquery_emulator_base_image_tag: trixie-20250908-slim
# The version where this repo diverges from the upstream repo.
#
azul_docker_bigquery_emulator_upstream_version: 0.4.4
# The version of this image. The image will be tagged with the version of the
# upstream image followed by the value of this variable. Increment this value
# to update the OS packages installed in the image.
#
# Both this value (internal_version) and the combined value (upstream_version
# + internal_version) will be passed as arguments to the Dockerfile.
#
azul_docker_bigquery_emulator_internal_version: 44
# The coordinates of the base image for the first build stage for this image
#
azul_docker_go_zetasql_image: docker.io/ucscgi/azul-go-zetasql
azul_docker_go_zetasql_upstream_version: 0.5.5
azul_docker_go_zetasql_internal_version: 6
jobs:
build-image:
strategy:
matrix:
platform: [ amd64, arm64 ]
include:
- { platform: amd64, os: ubuntu-24.04 }
- { platform: arm64, os: ubuntu-24.04-arm }
runs-on: ${{ matrix.os }}
permissions:
contents: read
packages: write
steps:
# By setting an env variable using the shell, we can use the value of
# existing env variables in the new variable's value.
- run: >
echo azul_docker_bigquery_emulator_version=${{ format(
'{0}-{1}',
env.azul_docker_bigquery_emulator_upstream_version,
env.azul_docker_bigquery_emulator_internal_version
) }} >> "$GITHUB_ENV"
- run: >
echo azul_docker_bigquery_emulator_tagged_image=${{ format(
'{0}{1}:{2}-{3}',
env.azul_docker_registry,
env.azul_docker_bigquery_emulator_image,
env.azul_docker_bigquery_emulator_version,
matrix.platform
) }} >> "$GITHUB_ENV"
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
platforms: ${{ matrix.platform }}
- name: Cache for linux
uses: actions/cache@v3
if: runner.os == 'Linux'
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Log into registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ vars.AZUL_DOCKER_REGISTRY_USER }}
password: ${{ secrets.AZUL_DOCKER_REGISTRY_PASSWORD }}
- name: Build and conditionally push Docker image
uses: docker/build-push-action@v5
with:
build-args: |
azul_docker_bigquery_emulator_base_image_tag=${{ env.azul_docker_bigquery_emulator_base_image_tag }}
azul_docker_bigquery_emulator_upstream_version=${{ env.azul_docker_bigquery_emulator_upstream_version }}
azul_docker_bigquery_emulator_internal_version=${{ env.azul_docker_bigquery_emulator_internal_version }}
azul_docker_go_zetasql_image=${{ env.azul_docker_go_zetasql_image }}
azul_docker_go_zetasql_upstream_version=${{ env.azul_docker_go_zetasql_upstream_version }}
azul_docker_go_zetasql_internal_version=${{ env.azul_docker_go_zetasql_internal_version }}
# We have to disable provenance for each single platform build, due to
# https://github.com/docker/build-push-action/issues/755
provenance: false
platforms: linux/${{ matrix.platform }}
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.azul_docker_bigquery_emulator_tagged_image }}
cache-from: |
type=local,src=~/.cache/go-build
${{ format(
'type=registry,ref={0}{1}_{2}_buildcache',
env.azul_docker_registry,
env.azul_docker_bigquery_emulator_image,
matrix.platform
) }}
# The value after '&&' in a ternary operator must be truthy, and since
# an empty string is falsy, we use ' ' instead.
cache-to: "${{ github.event_name == 'pull_request' && ' ' || format(
'type=registry,ref={0}{1}_{2}_buildcache,mode=max',
env.azul_docker_registry,
env.azul_docker_bigquery_emulator_image,
matrix.platform
) }}"
make-manifest:
needs: build-image
runs-on: ubuntu-24.04-arm
steps:
- name: Log into registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ vars.AZUL_DOCKER_REGISTRY_USER }}
password: ${{ secrets.AZUL_DOCKER_REGISTRY_PASSWORD }}
# By setting an env variable using the shell, we can use the value of
# existing env variables in the new variable's value.
- run: >
echo azul_docker_bigquery_emulator_version=${{ format(
'{0}-{1}',
env.azul_docker_bigquery_emulator_upstream_version,
env.azul_docker_bigquery_emulator_internal_version
) }} >> "$GITHUB_ENV"
- run: >
echo azul_docker_bigquery_emulator_tagged_image=${{ format(
'{0}{1}:{2}',
env.azul_docker_registry,
env.azul_docker_bigquery_emulator_image,
env.azul_docker_bigquery_emulator_version
) }} >> "$GITHUB_ENV"
# https://github.com/Noelware/docker-manifest-action
- name: Assemble and conditionally push Docker image index
uses: Noelware/docker-manifest-action@0.4.3
with:
images: |
${{ env.azul_docker_bigquery_emulator_tagged_image }}-arm64,
${{ env.azul_docker_bigquery_emulator_tagged_image }}-amd64
inputs: ${{ env.azul_docker_bigquery_emulator_tagged_image }}
push: ${{ github.event_name != 'pull_request' }}