mirror of
https://github.com/floci-io/floci.git
synced 2026-11-26 23:29:28 -05:00
* perf(docker): move the native image to ubi9-micro The binary needs only libc, and since #3037 the entrypoint needs only bash and coreutils. ubi9-micro has both at 7 MB compressed instead of ubi9-minimal's 40 MB. Measured on arm64 with the nightly-09042026 binary: 109 MB to about 78 MB compressed, 313 MB to 229 MB uncompressed. ubi9-micro has no useradd and no curl, so the user is one /etc/passwd line and the healthcheck is a bash /dev/tcp probe. Dockerfile.native gets the same runtime stage and loses its unused gosu tools stage. Dockerfile.compat needs microdnf, so it now starts from ubi9-minimal and copies /app out of the native image. * chore(docker): share the health probe and split the compat tools stage The bash health probe is now docker/healthcheck.sh, used by all three Dockerfiles. Dockerfile.compat gets a version independent tools stage; the aws CLI shim test and the cache warm job build target: tools, so they pull no floci image and their cached layers stay stable. ARG VERSION and the native RUN steps move so only the binary copy changes between builds. * fix(docker): copy healthcheck.sh into the compat image from the build context * ci(compat): build the whole compat image on pull requests and check it starts healthy
129 lines
6.0 KiB
YAML
129 lines
6.0 KiB
YAML
# Populates the buildx layer caches that `compatibility.yml`'s test legs read.
|
|
#
|
|
# Why this exists: GitHub Actions caches are ref-scoped. A pull_request run can
|
|
# READ the base branch's caches but its WRITES land in refs/pull/N/merge, private
|
|
# to that PR. `compatibility.yml` is pull_request-only, so before this workflow
|
|
# `main` produced no buildx cache at all: every PR built all eight test images
|
|
# cold and wrote its own ~3 GB copy that no other PR could ever read. Four
|
|
# concurrent PRs pushed the repo to 13.2 GB against GitHub's 10 GB limit, so
|
|
# entries were evicted between a PR's own runs and the sdk-test-java image build
|
|
# swung between 29s (warm) and 211s (cold) at random, on the compat critical path.
|
|
#
|
|
# Producing the caches here, on main, means every PR gets a warm read on its
|
|
# FIRST run, and the legs no longer write (see compatibility.yml). Keep this
|
|
# workflow's scope names identical to the ones the legs read from.
|
|
name: Warm Compat Caches
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
# The dependency-bearing inputs only — the files an image's *expensive* layer
|
|
# is keyed on. Test sources deliberately do not trigger a re-warm where they
|
|
# sit in a later layer than the dependency install, so a PR still gets the
|
|
# costly layers from a source-stale cache. Narrow on purpose: 182 commits
|
|
# touched compatibility-tests/ in the last 90 days but only 31 touched a
|
|
# dependency manifest, and each warm costs eight arm jobs.
|
|
paths:
|
|
- 'compatibility-tests/*/Dockerfile'
|
|
- 'compatibility-tests/*/pom.xml' # sdk-test-java
|
|
- 'compatibility-tests/*/requirements.txt' # sdk-test-python
|
|
- 'compatibility-tests/*/package*.json' # sdk-test-node, compat-cdk
|
|
# sdk-test-go is the exception: its Dockerfile does `COPY . .` *before*
|
|
# `go mod init && go mod tidy && go mod download`, so its dependency layer
|
|
# is invalidated by any source change and no manifest filter can track it.
|
|
# (go.sum is gitignored, so filtering on it would match nothing.) Only 8
|
|
# commits in 90 days touch this directory, so watching all of it is cheap.
|
|
- 'compatibility-tests/sdk-test-go/**'
|
|
# compat-shim's inputs (see the `shim` job below)
|
|
- 'docker/Dockerfile.compat'
|
|
- 'bin/awslocal'
|
|
# No *.tf entry: compat-terraform and compat-opentofu resolve nothing at
|
|
# build time — `COPY . .` is their final layer, after the yum install and
|
|
# bats clones — so .tf changes invalidate no cached work.
|
|
- '.github/workflows/warm-compat-caches.yml'
|
|
schedule:
|
|
# Safety net. Actions evicts caches at 7 days idle and LRU-evicts over the
|
|
# 10 GB budget; without a periodic producer an evicted main cache would
|
|
# leave every PR cold indefinitely, and silently.
|
|
- cron: '0 6 * * 1'
|
|
workflow_dispatch: # Allow a manual re-warm after a cache eviction
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
# A newer main commit supersedes an in-flight warm; never run two at once.
|
|
# A cancelled run can leave scopes warmed from mixed commits, which is harmless
|
|
# — each scope is an independently valid cache, and the next warm reconciles it.
|
|
group: warm-compat-caches
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
warm:
|
|
name: warm / ${{ matrix.test }}
|
|
# Must match the legs' runner: the legs run on arm64, and an x64 build would
|
|
# write useless x64 layers into the arm64 cache scope they read.
|
|
runs-on: ubuntu-24.04-arm
|
|
timeout-minutes: 20
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
test:
|
|
- sdk-test-node
|
|
- sdk-test-python
|
|
- sdk-test-java
|
|
- sdk-test-go
|
|
- sdk-test-awscli
|
|
- compat-cdk
|
|
- compat-terraform
|
|
- compat-opentofu
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
# SHA-pinned rather than @v7.0.1: this workflow runs on main and writes
|
|
# the caches every PR build consumes, so a moved upstream tag would change
|
|
# trusted code with no diff in this repo. Matches compatibility.yml:29.
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
sparse-checkout: compatibility-tests
|
|
|
|
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
|
|
|
|
- name: Build and cache test image
|
|
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
|
with:
|
|
context: compatibility-tests/${{ matrix.test }}
|
|
# No `load:` — the image itself is discarded; only the cache is wanted.
|
|
cache-from: type=gha,scope=${{ matrix.test }}
|
|
cache-to: type=gha,scope=${{ matrix.test }},mode=max
|
|
|
|
shim:
|
|
name: warm / compat-shim
|
|
# Produces the scope that compatibility.yml's compat-aws-cli-shim job reads.
|
|
# Worth warming, unlike floci-native: the tools stage of Dockerfile.compat is a
|
|
# microdnf install of python3/pip/unzip plus the aws CLI, and it depends only on
|
|
# ubi9-minimal and the Dockerfile. Genuinely stable layers. The final stage,
|
|
# which copies the binary out of a published floci/floci tag, is left out.
|
|
runs-on: ubuntu-24.04-arm
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
|
|
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
|
|
|
|
- name: Build and cache compat shim image
|
|
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
|
|
with:
|
|
context: .
|
|
file: docker/Dockerfile.compat
|
|
# Must match the consumer's build-args, or the layers key differently
|
|
# and the warm is silently useless (compatibility.yml:38). The consumer
|
|
# builds the whole image; its tools layers key the same as this target.
|
|
build-args: VERSION=latest
|
|
target: tools
|
|
# No `load:` — the image is discarded; only the cache is wanted.
|
|
cache-from: type=gha,scope=compat-shim
|
|
cache-to: type=gha,scope=compat-shim,mode=max
|