Skip to content

Commit 5eb834f

Browse files
authored
fix(devcontainer-base): validate base updates before publishing (#825)
## Summary - revert the devcontainer base from Fedora 45 to Fedora 44 - make every regular CI job build and load the checked-out devcontainer base locally - preserve the existing `build`, `check-format`, `lint`, and kustomization-test check contexts - preserve devcontainer registry cache export through Docker's containerd image store - validate base-image updates through the full downstream pipeline before publishing - publish the exact tested candidate as `latest` only after validation succeeds - keep pull-request builds non-publishing and serialize base-image builds for the same ref ## Root cause The Fedora 45 update moved the devcontainer to Python 3.15. `aiohttp` did not provide a CPython 3.15 wheel, so the devcontainer build fell back to a source build and failed because no compiler was installed. The base-image workflow previously published `latest` as soon as the base itself built. Its pull-request run did not exercise the downstream devcontainer, so the incompatible image reached `latest` despite green PR checks. ## CI behavior Regular CI assigns the checked-out base a commit-specific tag, builds and loads it on each isolated runner, and passes that tag into the devcontainer build. The required checks therefore validate repository source rather than depending on the already-published `latest`. The regular `build` job enables Docker's containerd image store. That keeps the default daemon-backed builder able to consume the locally loaded candidate while also exporting the shared devcontainer registry cache. The base-image workflow separately builds one candidate, runs `check-format`, `lint`, and the complete kustomization test suite against it, then retags and pushes that exact local image on main and scheduled runs. Pull-request runs never publish. ## Validation - formatted `.github/workflows/checks.yml` with the repository's Prettier version - parsed the workflow with `yq` - passed `git diff --check` - verified all four job definitions build a local base and still invoke `devcontainers/ci` - verified the [regular build log](https://github.com/marinatedconcrete/config/actions/runs/30874694197/job/91883694229) contains both the commit-specific `DEVCONTAINER_BASE_TAG` and `--cache-to ghcr.io/marinatedconcrete/config-devcontainer` - [all nine regular checks](https://github.com/marinatedconcrete/config/actions/runs/30874694197) passed: build, formatting, lint, and all six kustomization tests - [candidate-image validation](https://github.com/marinatedconcrete/config/actions/runs/30874696854) passed the full downstream pipeline; the PR publish step was skipped
1 parent b179040 commit 5eb834f

5 files changed

Lines changed: 77 additions & 14 deletions

File tree

.devcontainer/Containerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
ARG DEVCONTAINER_BASE_TAG=latest
2+
13
FROM ghcr.io/hadolint/hadolint:v2.14.0@sha256:27086352fd5e1907ea2b934eb1023f217c5ae087992eb59fde121dce9c9ff21e AS hadolint
24
FROM registry.k8s.io/kustomize/kustomize:v5.8.1@sha256:899fcd3bc898160e62bcaf82932b0cb29ba38d16272353db2e7acbba82129429 AS kustomize
35

@@ -6,7 +8,7 @@ COPY .devcontainer/build_files /
68
COPY ansible/requirements.txt /requirements.txt
79

810
# hadolint ignore=DL3007
9-
FROM ghcr.io/marinatedconcrete/devcontainer-base:latest
11+
FROM ghcr.io/marinatedconcrete/devcontainer-base:${DEVCONTAINER_BASE_TAG}
1012

1113
USER root
1214

.devcontainer/devcontainer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
22
"name": "config",
33
"build": {
4+
"args": {
5+
"DEVCONTAINER_BASE_TAG": "${localEnv:DEVCONTAINER_BASE_TAG:latest}"
6+
},
47
"cacheFrom": "ghcr.io/marinatedconcrete/config-devcontainer",
58
"context": "..",
69
"dockerfile": "Containerfile"

.github/workflows/checks.yml

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Run checks
33
on:
44
push:
55

6+
env:
7+
DEVCONTAINER_BASE_TAG: candidate-${{ github.sha }}
8+
69
jobs:
710
build:
811
permissions:
@@ -12,16 +15,29 @@ jobs:
1215
steps:
1316
- name: Checkout Repo
1417
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
18+
- name: Set up Docker
19+
uses: docker/setup-docker-action@77e84dbf09b47d1e29270283c22f16145aa85ca1 # v5
20+
with:
21+
daemon-config: |
22+
{
23+
"features": {
24+
"containerd-snapshotter": true
25+
}
26+
}
1527
- name: Login to GitHub Container Registry
1628
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
1729
with:
1830
registry: ghcr.io
1931
username: ${{ github.repository_owner }}
2032
password: ${{ secrets.GITHUB_TOKEN }}
21-
- name: Set up Buildx
22-
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
33+
- name: Build Candidate Base Image
34+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
2335
with:
24-
driver: docker-container
36+
context: images/devcontainer-base
37+
file: images/devcontainer-base/Containerfile
38+
load: true
39+
push: false
40+
tags: ghcr.io/${{ github.repository_owner }}/devcontainer-base:${{ env.DEVCONTAINER_BASE_TAG }}
2541
- name: Build devcontainer image
2642
uses: devcontainers/ci@513af61f4de4f75d37e4438f184ba4358f0fc1ca # v0.3.1900000450
2743
with:
@@ -38,6 +54,14 @@ jobs:
3854
steps:
3955
- name: Checkout Repo
4056
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
57+
- name: Build Candidate Base Image
58+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
59+
with:
60+
context: images/devcontainer-base
61+
file: images/devcontainer-base/Containerfile
62+
load: true
63+
push: false
64+
tags: ghcr.io/${{ github.repository_owner }}/devcontainer-base:${{ env.DEVCONTAINER_BASE_TAG }}
4165
- name: Check formatting
4266
uses: devcontainers/ci@513af61f4de4f75d37e4438f184ba4358f0fc1ca # v0.3.1900000450
4367
with:
@@ -53,6 +77,14 @@ jobs:
5377
steps:
5478
- name: Checkout Repo
5579
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
80+
- name: Build Candidate Base Image
81+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
82+
with:
83+
context: images/devcontainer-base
84+
file: images/devcontainer-base/Containerfile
85+
load: true
86+
push: false
87+
tags: ghcr.io/${{ github.repository_owner }}/devcontainer-base:${{ env.DEVCONTAINER_BASE_TAG }}
5688
- name: Validate configs
5789
uses: devcontainers/ci@513af61f4de4f75d37e4438f184ba4358f0fc1ca # v0.3.1900000450
5890
with:
@@ -77,6 +109,14 @@ jobs:
77109
steps:
78110
- name: Checkout Repo
79111
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
112+
- name: Build Candidate Base Image
113+
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
114+
with:
115+
context: images/devcontainer-base
116+
file: images/devcontainer-base/Containerfile
117+
load: true
118+
push: false
119+
tags: ghcr.io/${{ github.repository_owner }}/devcontainer-base:${{ env.DEVCONTAINER_BASE_TAG }}
80120
- name: Validate configs
81121
uses: devcontainers/ci@513af61f4de4f75d37e4438f184ba4358f0fc1ca # v0.3.1900000450
82122
with:

.github/workflows/image-devcontainer-base.yml

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,20 @@ on: # yamllint disable-line rule:truthy
1515
- .github/workflows/image-devcontainer-base.yml
1616
- images/devcontainer-base/**
1717
schedule:
18-
- cron: '0 0 * * 0' # Triggers every Sunday at midnight UTC
18+
- cron: "0 0 * * 0" # Triggers every Sunday at midnight UTC
19+
20+
concurrency:
21+
cancel-in-progress: true
22+
group: devcontainer-base-${{ github.ref }}
1923

2024
jobs:
2125
build-container:
2226
runs-on: ubuntu-latest
2327
permissions:
2428
contents: read
2529
packages: write
30+
env:
31+
DEVCONTAINER_BASE_TAG: candidate-${{ github.sha }}
2632

2733
steps:
2834
- name: Checkout Repo
@@ -33,15 +39,27 @@ jobs:
3339
registry: ghcr.io
3440
username: ${{ github.actor }}
3541
password: ${{ secrets.GITHUB_TOKEN }}
36-
- name: Generate Metadata
37-
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
38-
id: metadata
39-
with:
40-
images: ghcr.io/${{ github.repository_owner }}/devcontainer-base
41-
- name: Build Image
42+
- name: Build Candidate Image
4243
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
4344
with:
4445
context: images/devcontainer-base
4546
file: images/devcontainer-base/Containerfile
46-
push: ${{ github.event_name != 'pull_request' }}
47-
tags: ghcr.io/${{ github.repository_owner }}/devcontainer-base:latest
47+
load: true
48+
push: false
49+
tags: ghcr.io/${{ github.repository_owner }}/devcontainer-base:${{ env.DEVCONTAINER_BASE_TAG }}
50+
- name: Validate Full CI Pipeline
51+
uses: devcontainers/ci@513af61f4de4f75d37e4438f184ba4358f0fc1ca # v0.3.1900000450
52+
with:
53+
cacheFrom: ghcr.io/marinatedconcrete/config-devcontainer
54+
env: |
55+
CI=1
56+
imageName: config-devcontainer-candidate
57+
push: never
58+
runCmd: just check-format && just lint && just test
59+
- name: Push Tested Image
60+
if: github.event_name != 'pull_request'
61+
run: |
62+
docker tag \
63+
"ghcr.io/${{ github.repository_owner }}/devcontainer-base:${DEVCONTAINER_BASE_TAG}" \
64+
ghcr.io/${{ github.repository_owner }}/devcontainer-base:latest
65+
docker push ghcr.io/${{ github.repository_owner }}/devcontainer-base:latest

images/devcontainer-base/Containerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM scratch AS ctx
22
COPY build_files /
33

4-
FROM quay.io/fedora/fedora-minimal:45
4+
FROM quay.io/fedora/fedora-minimal:44
55

66
ARG USERNAME=vscode
77
ARG USERID=1000

0 commit comments

Comments
 (0)