Skip to content

Commit fe46610

Browse files
committed
Add Debian-based image for kernel build jobs
Update automated build workflows to build 5 images: - x86_64 Ubuntu runner - aarch64 Ubuntu runner - s390x Ubuntu runner - x86_64 Debian builder - aarch64 Debian builder With this change, Ubuntu runners don't install build dependencies from libbpf/ci/setup-build-env action, only run-vmtest dependencies. For context see kernel-patches/vmtest#433 Signed-off-by: Ihor Solodrai <[email protected]>
1 parent 4d4800e commit fe46610

File tree

7 files changed

+110
-79
lines changed

7 files changed

+110
-79
lines changed

.github/workflows/publish.yml

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -11,50 +11,67 @@ on:
1111
push:
1212
branches:
1313
- main
14-
- staging
15-
# Publish semver tags as releases.
16-
tags: [ 'v*.*.*' ]
1714
pull_request:
1815
branches:
1916
- main
20-
- staging
2117
workflow_dispatch:
2218

2319
env:
2420
# Use docker.io for Docker Hub if empty
2521
REGISTRY: ghcr.io
2622
# github.repository as <account>/<repo>
2723
IMAGE_NAME: ${{ github.repository }}
28-
24+
LIBBPF_CI_TAG: v4
25+
RUNNER_VERSION: 2.331.0
2926

3027
jobs:
3128
build:
32-
33-
runs-on: ubuntu-latest
29+
name: ${{ matrix.tag }}
30+
runs-on: ${{ matrix.runs_on }}
3431
permissions:
3532
contents: read
3633
packages: write
3734
# This is used to complete the identity challenge
3835
# with sigstore/fulcio when running outside of PRs.
3936
id-token: write
4037
strategy:
38+
fail-fast: false
4139
matrix:
42-
ubuntu_version: [noble]
43-
arch: [s390x, aarch64, x86_64]
4440
include:
45-
- arch: s390x
46-
dockerfile: s390x.Dockerfile
47-
platform: linux/s390x
41+
- arch: x86_64
42+
dockerfile: Dockerfile
43+
platform: linux/amd64
44+
tag: main-noble-x86_64
45+
runs_on: ubuntu-latest
46+
4847
- arch: aarch64
4948
dockerfile: Dockerfile
5049
platform: linux/arm64
50+
tag: main-noble-aarch64
51+
runs_on: ubuntu-24.04-arm
52+
53+
- arch: s390x
54+
dockerfile: s390x.Dockerfile
55+
platform: linux/s390x
56+
tag: main-noble-s390x
57+
runs_on: ubuntu-latest
58+
5159
- arch: x86_64
52-
dockerfile: Dockerfile
60+
dockerfile: kbuilder-debian.Dockerfile
5361
platform: linux/amd64
62+
tag: kbuilder-debian-x86_64
63+
runs_on: ubuntu-latest
64+
65+
- arch: aarch64
66+
dockerfile: kbuilder-debian.Dockerfile
67+
platform: linux/arm64
68+
tag: kbuilder-debian-aarch64
69+
runs_on: ubuntu-24.04-arm
5470

5571
steps:
72+
5673
- name: Checkout repository
57-
uses: actions/checkout@v4
74+
uses: actions/checkout@v6
5875

5976
# Install the cosign tool except on PR
6077
# https://github.com/sigstore/cosign-installer
@@ -66,9 +83,8 @@ jobs:
6683
run: cosign version
6784

6885
- name: Set up QEMU
86+
if: matrix.arch == 's390x'
6987
uses: docker/setup-qemu-action@v3
70-
with:
71-
image: tonistiigi/binfmt:qemu-v9.2.2
7288

7389
- name: Setup Docker buildx
7490
uses: docker/setup-buildx-action@v3
@@ -83,27 +99,6 @@ jobs:
8399
username: ${{ github.actor }}
84100
password: ${{ secrets.GITHUB_TOKEN }}
85101

86-
# Extract metadata (tags, labels) for Docker
87-
# https://github.com/docker/metadata-action
88-
- name: Extract Docker metadata
89-
id: meta
90-
uses: docker/metadata-action@v5
91-
with:
92-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
93-
flavor: |
94-
latest=auto
95-
prefix=
96-
suffix=-${{ matrix.ubuntu_version }}-${{ matrix.arch }}
97-
tags: |
98-
# Generate old tag names (e.g main-s390x, main-x86_64...) when building noble
99-
# branch event
100-
type=ref,enable=${{ matrix.ubuntu_version == 'noble' }},suffix=-${{ matrix.arch }},event=branch
101-
# pr event
102-
type=ref,enable=${{ matrix.ubuntu_version == 'noble' }},prefix=pr-,suffix=-${{ matrix.arch }},event=pr
103-
# tags for all pr/branches
104-
type=ref,event=branch,enable=true,priority=600
105-
type=ref,event=pr,enable=true,prefix=pr-,priority=600
106-
107102
# Build and push Docker image with Buildx (don't push on PR)
108103
# https://github.com/docker/build-push-action
109104
- name: Build and push Docker image
@@ -113,10 +108,11 @@ jobs:
113108
context: .
114109
file: ${{ matrix.dockerfile }}
115110
push: ${{ github.event_name != 'pull_request' }}
116-
tags: ${{ steps.meta.outputs.tags }}
117-
labels: ${{ steps.meta.outputs.labels }}
111+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}
118112
platforms: ${{ matrix.platform }}
119-
build-args: UBUNTU_VERSION=${{ matrix.ubuntu_version }}
113+
build-args: |
114+
LIBBPF_CI_TAG=${{ env.LIBBPF_CI_TAG }}
115+
RUNNER_VERSION=${{ env.RUNNER_VERSION }}
120116
121117
# Sign the resulting Docker image digest except on PRs.
122118
# This will only write to the public Rekor transparency log when the Docker
@@ -127,7 +123,6 @@ jobs:
127123
if: ${{ github.event_name != 'pull_request' }}
128124
env:
129125
COSIGN_EXPERIMENTAL: "true"
130-
TAGS: ${{ steps.meta.outputs.tags }}
131126
# This step uses the identity token to provision an ephemeral certificate
132127
# against the sigstore community Fulcio instance.
133-
run: cosign sign --yes ${TAGS}
128+
run: cosign sign --yes ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ matrix.tag }}

.github/workflows/version_bump.yml

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
name: s390x version bump
1+
name: RUNNER_VERSION bump
22

33
# This workflow pulls the latest official actions runner version using GH API
4-
# and update our s390x Dockerfile.
4+
# and update RUNNER_VERSION variable.
55
# If a change happens, the change will be commited in a versioned branch and
66
# a PR will be created. Upon merging, the branch will be deleted.
77
#
@@ -14,13 +14,13 @@ on:
1414

1515
jobs:
1616
bump_version:
17-
runs-on: ubuntu-latest
17+
runs-on: ubuntu-slim
1818
permissions:
1919
contents: write
2020
pull-requests: write
2121
steps:
2222
- name: Checkout repository
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v6
2424

2525
- name: Get latest runner release
2626
id: release
@@ -35,14 +35,30 @@ jobs:
3535
3636
- name: Update release
3737
id: bump
38-
run: sed -i 's#^ARG RUNNER_VERSION=.*#ARG RUNNER_VERSION=${{ steps.release.outputs.ACTIONS_VERSION}}#' s390x.Dockerfile
38+
run: |
39+
sed -i 's#RUNNER_VERSION:.*#RUNNER_VERSION: ${{ steps.release.outputs.ACTIONS_VERSION }}#' .github/workflows/publish.yml
3940
4041
- name: Create Pull Request
41-
uses: peter-evans/create-pull-request@v7
42-
with:
43-
title: "[automated] s390x: bump RUNNER_VERSION to v${{ steps.release.outputs.ACTIONS_VERSION}}"
44-
commit-message: "[automated] s390x: bump RUNNER_VERSION to v${{ steps.release.outputs.ACTIONS_VERSION}}"
45-
branch: "version-bump/${{ steps.release.outputs.ACTIONS_VERSION}}"
46-
delete-branch: true
47-
body: ""
48-
reviewers: anakryiko, chantra, danielocfb, yurinnick, theihor
42+
env:
43+
GH_TOKEN: ${{ github.token }}
44+
RUNNER_VERSION: ${{ steps.release.outputs.ACTIONS_VERSION }}
45+
BRANCH: version-bump/${{ steps.release.outputs.ACTIONS_VERSION }}
46+
run: |
47+
48+
if git diff --quiet; then
49+
echo "No changes to commit"
50+
exit 0
51+
fi
52+
53+
git config user.name "github-actions[bot]"
54+
git config user.email "github-actions[bot]@users.noreply.github.com"
55+
56+
git checkout -b "${BRANCH}"
57+
git add -A
58+
git commit -m "[automated] Bump RUNNER_VERSION to v${VERSION}"
59+
git push -u origin "${BRANCH}"
60+
61+
gh pr create \
62+
--title "[automated] Bump RUNNER_VERSION to v${VERSION}" \
63+
--body "" \
64+
--reviewer anakryiko,danielocfb,theihor

Dockerfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@ FROM myoung34/github-runner:ubuntu-${UBUNTU_VERSION}
55
ARG UBUNTU_VERSION
66

77
COPY install-dependencies.sh /tmp/install-dependencies.sh
8-
RUN bash /tmp/install-dependencies.sh
9-
10-
RUN apt-get clean
8+
RUN bash /tmp/install-dependencies.sh run
119

1210
COPY token.sh /token.sh
13-
14-
COPY setup-mirror-repos.sh /tmp/setup-mirror-repos.sh
15-
RUN bash /tmp/setup-mirror-repos.sh

install-dependencies.sh

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,40 @@
11
#!/bin/bash
22

3-
set -euo pipefail
3+
set -xeuo pipefail
4+
5+
export DEPS=${1:-"all"} # "build", "run" or "all"
46

57
# Most of the BPF CI dependencies are set up by libbpf/ci/setup-build-env action
68
# This script runs a subset of that, in order to cache the packages at image build time
7-
export LIBBPF_CI_TAG=v3
9+
export LIBBPF_CI_TAG=${LIBBPF_CI_TAG:-"v4"}
10+
export RUNNER_VERSION=${RUNNER_VERSION:-2.331.0}
811

912
# These should correspond to https://github.com/kernel-patches/vmtest/blob/master/.github/scripts/matrix.py#L20-L21
10-
# Otherwise there is no point in caching dependencies in the image
11-
export GCC_VERSION=15
12-
export LLVM_VERSION=21
13-
14-
# do not install pahole and cross-compilation toolchain in the docker image
15-
export TARGET_ARCH=$(uname -m)
16-
export PAHOLE_BRANCH=none
13+
# Otherwise there is no point in caching the dependencies in the image
14+
export GCC_VERSION=${GCC_VERSION:-15}
15+
export LLVM_VERSION=${LLVM_VERSION:-21}
1716

1817
scratch=$(mktemp -d)
1918
cd $scratch
19+
20+
# Install pre-requisites for GitHub Actions Runner client app
21+
# https://github.com/actions/runner/blob/main/docs/start/envlinux.md
22+
curl -Lf https://raw.githubusercontent.com/actions/runner/v${RUNNER_VERSION}/src/Misc/layoutbin/installdependencies.sh \
23+
-o install-gha-runner-deps.sh
24+
bash install-gha-runner-deps.sh
25+
26+
# Use libbpf/ci/setup-build-env scripts
2027
git clone --depth 1 --branch $LIBBPF_CI_TAG https://github.com/libbpf/ci.git actions
2128

22-
# Install build dependencies only on x86_64, we cross-compile everything else
23-
if [ "$(uname -m)" == "x86_64" ]; then
29+
if [ "$DEPS" = "all" ] || [ "$DEPS" = "build" ]; then
30+
# do not install cross-compilation toolchain by default
31+
export TARGET_ARCH=$(uname -m)
2432
cd "${scratch}/actions/setup-build-env" && ./action.sh
2533
fi
2634

27-
cd "${scratch}/actions/run-vmtest" && ./install-dependencies.sh
35+
if [ "$DEPS" = "all" ] || [ "$DEPS" = "run" ]; then
36+
cd "${scratch}/actions/run-vmtest" && ./install-dependencies.sh
37+
fi
38+
39+
cd / && rm -rf $scratch
40+
sudo apt-get clean

kbuilder-debian.Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM debian:experimental
2+
3+
ARG RUNNER_VERSION=2.331.0
4+
ARG LIBBPF_CI_TAG=v4
5+
6+
ENV DEBIAN_FRONTEND=noninteractive
7+
8+
RUN apt-get update -y && apt-get install -y --no-install-recommends \
9+
ca-certificates curl git sudo wget
10+
11+
COPY setup-mirror-repos.sh /tmp/setup-mirror-repos.sh
12+
RUN bash /tmp/setup-mirror-repos.sh
13+
14+
COPY install-dependencies.sh /tmp/install-dependencies.sh
15+
RUN bash /tmp/install-dependencies.sh build
16+
17+
RUN apt-get clean

s390x.Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ RUN apt-get install -y --no-install-recommends \
5252
software-properties-common sudo tar unzip wget zip zstd
5353

5454
COPY install-dependencies.sh /tmp/install-dependencies.sh
55-
RUN /tmp/install-dependencies.sh
55+
RUN /tmp/install-dependencies.sh run
5656

5757
RUN apt-get -y install aspnetcore-runtime-8.0
5858

setup-mirror-repos.sh

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@
22

33
set -euo pipefail
44

5-
if [ "$(uname -m)" != "x86_64" ]; then
6-
echo "Skip setting up mirror repos in non-x86_64 image"
7-
exit 0
8-
fi
9-
105
mkdir -p /libbpfci/mirrors
116
git clone https://github.com/kernel-patches/bpf.git /libbpfci/mirrors/linux
127
chmod -R a+rX /libbpfci/mirrors

0 commit comments

Comments
 (0)