Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/buildkitd.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# GC config for the shared persistent builder (deft-shared) on the
# self-hosted runners. Mirrors BuildKit's default policy structure with two
# changes: cache-mount/local-context records survive 7 days of disuse instead
# of 48h (api-ecs is path-filtered and can idle past 48h), and total builder
# storage is capped at 150GB with a 100GB free-space floor.
#
# The authoritative copy is installed on the host by kernel/infra
# (roles/dev_shared_buildx_builder); this copy is the fallback if a job ever
# recreates the builder. Keep the two in sync. BuildKit reads this only at
# builder creation; applying a change requires `docker buildx rm deft-shared`.
[worker.oci]
gc = true

[[worker.oci.gcpolicy]]
filters = ["type==source.local", "type==exec.cachemount", "type==source.git.checkout"]
keepDuration = "168h"
maxUsedSpace = "40GB"

[[worker.oci.gcpolicy]]
keepDuration = "1440h"
reservedSpace = "10GB"
minFreeSpace = "100GB"
maxUsedSpace = "150GB"

[[worker.oci.gcpolicy]]
reservedSpace = "10GB"
minFreeSpace = "100GB"
maxUsedSpace = "150GB"

[[worker.oci.gcpolicy]]
all = true
reservedSpace = "10GB"
minFreeSpace = "100GB"
maxUsedSpace = "150GB"
35 changes: 32 additions & 3 deletions .github/workflows/chromium-headful-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
# Fork PRs get no secrets and now must not reach the self-hosted pool
# either: skipping here (rather than failing at registry login, as
# before) also skips the dependent e2e job via its needs chain.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: [self-hosted, linux]
Comment thread
cursor[bot] marked this conversation as resolved.
permissions:
contents: read
steps:
Expand All @@ -17,6 +21,28 @@ jobs:
shell: bash
run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"

# The docker build context must match the git tree exactly, including
# file modes: BuildKit's COPY cache key covers permission bits, and the
# runners' persistent _work checkouts carry modes frozen from whatever
# umask was active when each file was first written, which differs per
# runner and busts the layer cache on the shared builder.
- name: Reset workspace to a pristine build context
run: |
git checkout -- .
git clean -xdf
find . -path ./.git -prune -o -type f -perm -u+x -print0 | xargs -0 -r chmod 755
find . -path ./.git -prune -o -type f ! -perm -u+x -print0 | xargs -0 -r chmod 644

- name: Create isolated Docker config
run: |
DOCKER_CONFIG="$(mktemp -d "${RUNNER_TEMP}/docker-config.XXXXXX")"
echo "DOCKER_CONFIG=${DOCKER_CONFIG}" >> "$GITHUB_ENV"
# BUILDX_CONFIG defaults to $DOCKER_CONFIG/buildx; without this the
# isolated DOCKER_CONFIG above would hide the shared builder. The
# buildx-ci path (not the default ~/.docker/buildx) avoids the tree
# that root-run CI from other repos clobbers to root-owned.
echo "BUILDX_CONFIG=${HOME}/.docker/buildx-ci" >> "$GITHUB_ENV"

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
Expand All @@ -25,13 +51,16 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
name: deft-shared
cleanup: false
buildkitd-config: .github/buildkitd.toml

- name: Build and push
uses: docker/build-push-action@v6
with:
builder: deft-shared
context: .
file: images/chromium-headful/Dockerfile
push: true
tags: onkernel/chromium-headful:${{ steps.vars.outputs.short_sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
35 changes: 32 additions & 3 deletions .github/workflows/chromium-headless-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ on:

jobs:
docker:
runs-on: ubuntu-latest
# Fork PRs get no secrets and now must not reach the self-hosted pool
# either: skipping here (rather than failing at registry login, as
# before) also skips the dependent e2e job via its needs chain.
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
runs-on: [self-hosted, linux]
permissions:
contents: read
steps:
Expand All @@ -17,6 +21,28 @@ jobs:
shell: bash
run: echo "short_sha=${GITHUB_SHA::7}" >> "$GITHUB_OUTPUT"

# The docker build context must match the git tree exactly, including
# file modes: BuildKit's COPY cache key covers permission bits, and the
# runners' persistent _work checkouts carry modes frozen from whatever
# umask was active when each file was first written, which differs per
# runner and busts the layer cache on the shared builder.
- name: Reset workspace to a pristine build context
run: |
git checkout -- .
git clean -xdf
find . -path ./.git -prune -o -type f -perm -u+x -print0 | xargs -0 -r chmod 755
find . -path ./.git -prune -o -type f ! -perm -u+x -print0 | xargs -0 -r chmod 644

- name: Create isolated Docker config
run: |
DOCKER_CONFIG="$(mktemp -d "${RUNNER_TEMP}/docker-config.XXXXXX")"
echo "DOCKER_CONFIG=${DOCKER_CONFIG}" >> "$GITHUB_ENV"
# BUILDX_CONFIG defaults to $DOCKER_CONFIG/buildx; without this the
# isolated DOCKER_CONFIG above would hide the shared builder. The
# buildx-ci path (not the default ~/.docker/buildx) avoids the tree
# that root-run CI from other repos clobbers to root-owned.
echo "BUILDX_CONFIG=${HOME}/.docker/buildx-ci" >> "$GITHUB_ENV"

- name: Login to Docker Hub
uses: docker/login-action@v3
with:
Expand All @@ -25,13 +51,16 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
name: deft-shared
cleanup: false
buildkitd-config: .github/buildkitd.toml

- name: Build and push
uses: docker/build-push-action@v6
with:
builder: deft-shared
context: .
file: images/chromium-headless/image/Dockerfile
push: true
tags: onkernel/chromium-headless:${{ steps.vars.outputs.short_sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
Loading