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
50 changes: 42 additions & 8 deletions .github/workflows/docker_images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,41 @@ on:
env:
USER_GIT_OWNER: ${{ inputs.GIT_OWNER }}
USER_GIT_BRANCH: ${{ inputs.GIT_BRANCH }}
BASE_IMAGE_REGISTRY: ghcr.io/kernelci/mirror

jobs:
mirror-base-images:
# Only selected people can publish images.
if: contains(fromJSON('["nuclearcat","JenySadadia","a-wai","broonie","laura-nao","bhcopeland"]'), github.actor)
runs-on: ubuntu-latest
environment: deploydocker
permissions:
packages: write
steps:
- name: Log in to Docker Hub and GHCR
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
printf '%s' "$DOCKERHUB_TOKEN" | skopeo login --username "$DOCKERHUB_USERNAME" --password-stdin docker.io
printf '%s' "$GH_TOKEN" | skopeo login --username "$GITHUB_ACTOR" --password-stdin ghcr.io
- name: Refresh base images from Docker Hub
run: |
for image in library/debian:trixie library/debian:forky library/python:3.12 godebos/debos:latest; do
source="docker://docker.io/$image"
mirror="docker://$BASE_IMAGE_REGISTRY/$image"
skopeo inspect --retry-times 3 --raw "$source" > upstream.json
if skopeo inspect --retry-times 3 --raw "$mirror" > mirror.json && cmp -s upstream.json mirror.json; then
echo "$image is up to date"
continue
fi
digest=$(skopeo manifest-digest upstream.json)
skopeo copy --retry-times 3 --all --preserve-digests "${source%:*}@$digest" "$mirror"
done

docker-compiler-build:
needs: mirror-base-images
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -61,8 +93,7 @@ jobs:
kcicmd: 'gcc-16 kselftest kernelci'
- kciarch: 'riscv64'
kcicmd: 'gcc-16 kselftest kernelci'
# only selected people can trigger this job
if: contains('["nuclearcat","JenySadadia","a-wai","broonie","laura-nao","bhcopeland"]', github.actor) && !inputs.SKIP_COMPILER_IMAGES
if: ${{ !inputs.SKIP_COMPILER_IMAGES }}
runs-on: ubuntu-latest
environment: deploydocker
steps:
Expand Down Expand Up @@ -105,7 +136,8 @@ jobs:
export core_rev=$(git rev-parse HEAD)
export core_url=$(git remote get-url origin)
kci_arg="--build-arg core_rev=$core_rev --prefix=ghcr.io/kernelci/ --build-arg core_url=$core_url"
./kci docker build --verbose --push $kci_arg ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }}
./kci docker build --verbose --push --build-arg "BASE_IMAGE_REGISTRY=$BASE_IMAGE_REGISTRY" \
$kci_arg ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }}
NAME=$(./kci docker name --prefix=ghcr.io/kernelci/ ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }})
DHNAME=$(./kci docker name --prefix=kernelci/ ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }})
docker tag $NAME $DHNAME
Expand All @@ -118,13 +150,15 @@ jobs:
export core_url=$(git remote get-url origin)
echo "core_rev=$core_rev core_url=$core_url"
kci_arg="--build-arg core_rev=$core_rev --prefix=ghcr.io/kernelci/staging- --build-arg core_url=$core_url"
./kci docker build --verbose --push $kci_arg ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }}
./kci docker build --verbose --push --build-arg "BASE_IMAGE_REGISTRY=$BASE_IMAGE_REGISTRY" \
$kci_arg ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }}
NAME=$(./kci docker name --prefix=ghcr.io/kernelci/staging- ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }})
DHNAME=$(./kci docker name --prefix=kernelci/staging- ${{ matrix.kcicmd }} --arch ${{ matrix.kciarch }})
docker tag $NAME $DHNAME
docker push $DHNAME

docker-misc-build:
needs: mirror-base-images
strategy:
fail-fast: false
matrix:
Expand All @@ -144,8 +178,6 @@ jobs:
exclude:
- kcicmd: 'rustc-1.74 kselftest kernelci --arch x86'
- kcicmd: 'rustc-1.75 kselftest kernelci --arch x86'
# only selected people can trigger this job
if: contains('["nuclearcat","JenySadadia","a-wai","broonie","laura-nao","bhcopeland"]', github.actor)
runs-on: ubuntu-latest
environment: deploydocker
steps:
Expand Down Expand Up @@ -206,7 +238,8 @@ jobs:
cd ../kernelci-core
rev_arg="--build-arg core_rev=$core_rev --build-arg api_rev=$api_rev --build-arg pipeline_rev=$pipeline_rev"
kci_arg="$rev_arg --prefix=ghcr.io/kernelci/"
./kci docker build --verbose --push $kci_arg ${{ matrix.kcicmd }}
./kci docker build --verbose --push --build-arg "BASE_IMAGE_REGISTRY=$BASE_IMAGE_REGISTRY" \
$kci_arg ${{ matrix.kcicmd }}
NAME=$(./kci docker name --prefix=ghcr.io/kernelci/ ${{ matrix.kcicmd }})
DHNAME=$(./kci docker name --prefix=kernelci/ ${{ matrix.kcicmd }})
docker tag $NAME $DHNAME
Expand All @@ -223,7 +256,8 @@ jobs:
cd ../kernelci-core
rev_arg="--build-arg core_rev=$core_rev --build-arg api_rev=$api_rev --build-arg pipeline_rev=$pipeline_rev"
kci_arg="$rev_arg --prefix=ghcr.io/kernelci/staging-"
./kci docker build --verbose --push $kci_arg ${{ matrix.kcicmd }}
./kci docker build --verbose --push --build-arg "BASE_IMAGE_REGISTRY=$BASE_IMAGE_REGISTRY" \
$kci_arg ${{ matrix.kcicmd }}
NAME=$(./kci docker name --prefix=ghcr.io/kernelci/staging- ${{ matrix.kcicmd }})
DHNAME=$(./kci docker name --prefix=kernelci/staging- ${{ matrix.kcicmd }})
docker tag $NAME $DHNAME
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
./kci-pending.py --push ${{ secrets.GHPAT}} kernelci-pipeline --token ${{ secrets.GITHUB_TOKEN }}
call-docker-build:
needs: prepare-staging-branches
permissions:
contents: read
packages: write
uses: ./.github/workflows/docker_images.yml
secrets: inherit
with:
Expand Down
7 changes: 7 additions & 0 deletions config/docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ pip3 install -r requirements.txt

## Docker images and tag names

Local builds pull their base images from Docker Hub. Before each staging or
production build, the `mirror-base-images` job copies new or changed base images
to KernelCI's packages under `ghcr.io/kernelci/mirror`. Both build matrices
select those copies with the `BASE_IMAGE_REGISTRY` build argument. When adding
a base image or changing its tag, update the list in
[`docker_images.yml`](../../.github/workflows/docker_images.yml).

The base name for each Docker image follows the main application contained in
the image. For example: `clang-14`, `gcc-10`, `k8s`, `kernelci`. Then the tag
is composed of an optional kernel CPU architecture name when applicable
Expand Down
3 changes: 2 additions & 1 deletion config/docker/base/debian.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
# Author: Alexandra Pereira <alexandra.pereira@collabora.com>
-#}

FROM mirror.gcr.io/debian:{{ debian_release | default('trixie') }}
ARG BASE_IMAGE_REGISTRY=docker.io
FROM ${BASE_IMAGE_REGISTRY}/library/debian:{{ debian_release | default('trixie') }}
MAINTAINER "KernelCI TSC" <kernelci-tsc@groups.io>
ENV DEBIAN_FRONTEND=noninteractive

Expand Down
3 changes: 2 additions & 1 deletion config/docker/base/debos.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# Author: Guillaume Tucker <guillaume.tucker@collabora.com>
-#}

FROM mirror.gcr.io/godebos/debos
ARG BASE_IMAGE_REGISTRY=docker.io
FROM ${BASE_IMAGE_REGISTRY}/godebos/debos:latest
MAINTAINER "KernelCI TSC" <kernelci-tsc@groups.io>

ENV DEBIAN_FRONTEND=noninteractive
Expand Down
3 changes: 2 additions & 1 deletion config/docker/base/python.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# Author: Guillaume Tucker <guillaume.tucker@collabora.com>
-#}

FROM mirror.gcr.io/python:3.12
ARG BASE_IMAGE_REGISTRY=docker.io
FROM ${BASE_IMAGE_REGISTRY}/library/python:3.12

MAINTAINER "KernelCI TSC" <kernelci-tsc@groups.io>

Expand Down