Skip to content

feat(storage): configure minimum durable copies (#10) #54

feat(storage): configure minimum durable copies (#10)

feat(storage): configure minimum durable copies (#10) #54

Workflow file for this run

name: Docker
on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
workflow_dispatch:
inputs:
mode:
description: Manual run mode
type: choice
required: true
default: build-only
options:
- build-only
- publish-test
permissions:
contents: read
env:
DOCKER_BUILD_RECORD_UPLOAD: 'false'
concurrency:
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
deployment:
name: deployment
runs-on: ${{ vars.RUNS_ON_AMD64 || vars.RUNS_ON || 'ubuntu-latest' }}
timeout-minutes: 10
steps:
- &checkout
name: Checkout
uses: actions/checkout@v6
- name: Validate Docker deployment
env:
SYNAPS3_REQUIRE_DOCKER_DAEMON: '1'
run: make test-docker-deployment
image_pr:
name: image-pr
if: github.event_name == 'pull_request'
runs-on: ${{ vars.RUNS_ON_AMD64 || vars.RUNS_ON || 'ubuntu-latest' }}
timeout-minutes: 10
steps:
- *checkout
- &setup-buildx
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- &resolve-build-date
name: Resolve build date
id: build-date
run: echo "build_date=$(date -u '+%Y-%m-%dT%H:%M:%SZ')" >> "$GITHUB_OUTPUT"
- &resolve-image-name
name: Resolve image name
id: image
shell: bash
run: printf 'name=ghcr.io/%s\n' "${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
- &docker-metadata
name: Docker metadata
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ steps.image.outputs.name }}
tags: |
type=raw,value=edge,enable=${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
type=raw,value=ci-manual-test,enable=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.mode == 'publish-test' }}
type=ref,event=tag,enable=${{ github.event_name == 'push' }}
type=ref,event=pr,enable=${{ github.event_name == 'pull_request' }}
- name: Build image
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha,scope=synaps3-image-amd64
build-args: |
VERSION=${{ github.ref_type == 'tag' && github.ref_name || 'edge' }}
COMMIT=${{ github.sha }}
BUILD_DATE=${{ steps.build-date.outputs.build_date }}
image_amd64:
name: image-amd64
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ${{ vars.RUNS_ON_AMD64 || vars.RUNS_ON || 'ubuntu-latest' }}
timeout-minutes: 10
permissions:
contents: read
packages: write
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- *checkout
- *setup-buildx
- &login-ghcr
name: Log in to GHCR
if: github.event_name == 'push' || github.event.inputs.mode == 'publish-test'
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- *resolve-build-date
- *resolve-image-name
- *docker-metadata
- name: Build image
id: build
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/amd64
labels: ${{ steps.meta.outputs.labels }}
outputs: ${{ (github.event_name == 'push' || github.event.inputs.mode == 'publish-test') && format('type=image,name={0},push-by-digest=true,name-canonical=true,push=true', steps.image.outputs.name) || '' }}
cache-from: type=gha,scope=synaps3-image-amd64
cache-to: ${{ (github.event_name == 'push' || github.event.inputs.mode == 'publish-test') && 'type=gha,scope=synaps3-image-amd64,mode=max,ignore-error=true' || '' }}
build-args: |
VERSION=${{ github.event_name == 'workflow_dispatch' && 'ci-manual-test' || github.ref_type == 'tag' && github.ref_name || 'edge' }}
COMMIT=${{ github.sha }}
BUILD_DATE=${{ steps.build-date.outputs.build_date }}
image_arm64:
name: image-arm64
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
runs-on: ${{ vars.RUNS_ON_ARM64 || 'ubuntu-24.04-arm' }}
timeout-minutes: 10
permissions:
contents: read
packages: write
outputs:
digest: ${{ steps.build.outputs.digest }}
steps:
- *checkout
- *setup-buildx
- *login-ghcr
- *resolve-build-date
- *resolve-image-name
- *docker-metadata
- name: Build image
id: build
uses: docker/build-push-action@v7
with:
context: .
platforms: linux/arm64
labels: ${{ steps.meta.outputs.labels }}
outputs: ${{ (github.event_name == 'push' || github.event.inputs.mode == 'publish-test') && format('type=image,name={0},push-by-digest=true,name-canonical=true,push=true', steps.image.outputs.name) || '' }}
cache-from: type=gha,scope=synaps3-image-arm64
cache-to: ${{ (github.event_name == 'push' || github.event.inputs.mode == 'publish-test') && 'type=gha,scope=synaps3-image-arm64,mode=max,ignore-error=true' || '' }}
build-args: |
VERSION=${{ github.event_name == 'workflow_dispatch' && 'ci-manual-test' || github.ref_type == 'tag' && github.ref_name || 'edge' }}
COMMIT=${{ github.sha }}
BUILD_DATE=${{ steps.build-date.outputs.build_date }}
image_manifest:
name: image-manifest
if: github.event_name == 'push' || github.event.inputs.mode == 'publish-test'
needs:
- image_amd64
- image_arm64
runs-on: ${{ vars.RUNS_ON_AMD64 || vars.RUNS_ON || 'ubuntu-latest' }}
timeout-minutes: 10
permissions:
contents: read
packages: write
steps:
- *setup-buildx
- *login-ghcr
- *resolve-image-name
- *docker-metadata
- name: Create manifest
shell: bash
env:
DOCKER_METADATA_TAGS: ${{ steps.meta.outputs.tags }}
run: |
tag_args=()
while IFS= read -r tag; do
[ -n "$tag" ] && tag_args+=("-t" "$tag")
done <<< "$DOCKER_METADATA_TAGS"
if [ "${#tag_args[@]}" -eq 0 ]; then
echo "No Docker tags resolved"
exit 1
fi
docker buildx imagetools create "${tag_args[@]}" \
"${{ steps.image.outputs.name }}@${{ needs.image_amd64.outputs.digest }}" \
"${{ steps.image.outputs.name }}@${{ needs.image_arm64.outputs.digest }}"
- name: Inspect manifest
run: docker buildx imagetools inspect ${{ steps.image.outputs.name }}:${{ steps.meta.outputs.version }}