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
38 changes: 38 additions & 0 deletions .github/scripts/verify-rhf-artifact.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -euo pipefail

repo_root=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)
archive=${1:?usage: verify-rhf-artifact.sh <artifact archive> [rhf|generic] [6.12.0|6.16.2]}
family=${2:-rhf}
kernel_version=${3:-6.12.0}
case "$kernel_version" in
6.12.0) object_version=6.12 ;;
6.16.2) object_version=6.16.2 ;;
*) printf 'unsupported artifact kernel version: %s\n' "$kernel_version" >&2; exit 1 ;;
esac
[[ -f "$archive" ]] || { printf 'artifact not found: %s\n' "$archive" >&2; exit 1; }
case "$family" in
rhf) rhf_suffix='.rhf'; make_rhf='.rhf' ;;
generic) rhf_suffix=''; make_rhf='' ;;
*) printf 'unknown artifact family: %s\n' "$family" >&2; exit 1 ;;
esac

inventory=$(make -s -C "$repo_root/kernel" \
--eval='print-ebpf-inventory:;@printf "%s\\n%s\\n%s\\n" "$(NETDATA_APPS)" "$(NETDATA_RINGBUF_APPS)" "$(NETDATA_ARENA_APPS)"' \

Check warning on line 21 in .github/scripts/verify-rhf-artifact.sh

View workflow job for this annotation

GitHub Actions / shellcheck

[shellcheck] reported by reviewdog 🐶 Expressions don't expand in single quotes, use double quotes for that. Raw Output: ./.github/scripts/verify-rhf-artifact.sh:21:12: info: Expressions don't expand in single quotes, use double quotes for that. (ShellCheck.SC2016)
print-ebpf-inventory KERNEL_VERSION="$kernel_version" RHF="$make_rhf")
mapfile -t app_families <<< "$inventory"
((${#app_families[@]} == 3)) || { printf 'could not read expected object families from kernel/Makefile\n' >&2; exit 1; }

archive_list=$(tar -tf "$archive")
expected_object_count=0
for family in "${app_families[@]}"; do
read -r -a apps <<< "$family"
expected_object_count=$((expected_object_count + ${#apps[@]}))
for app in "${apps[@]}"; do
for prefix in p r; do
object="${prefix}netdata_ebpf_${app}.${object_version}${rhf_suffix}.o"
grep -Fxq "$object" <<< "$archive_list" || { printf 'missing object: %s\n' "$object" >&2; exit 1; }
done
done
done
((expected_object_count > 0)) || { printf 'expected object inventory is empty for kernel %s\n' "$kernel_version" >&2; exit 1; }
42 changes: 41 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
kernel_version:
- '7.2.8'
- '6.16.2'
- '6.12.0'
- '6.8.2'
- '5.16.18'
- '5.17.15'
Expand Down Expand Up @@ -48,7 +49,9 @@ jobs:
fetch-depth: 0
- name: Run build.sh
run: |
if [ ${{ matrix.kernel_version }} = "5.14.0" ]; then
if [ ${{ matrix.kernel_version }} = "6.12.0" ]; then
os=centos10
elif [ ${{ matrix.kernel_version }} = "5.14.0" ]; then
os=centos9
elif [ ${{ matrix.kernel_version }} = "5.4.17" ]; then
os=oracle8
Expand All @@ -62,9 +65,46 @@ jobs:
run: |
ls -lah artifacts
test -f artifacts/netdata_ebpf-*.tar
if [ "${{ matrix.kernel_version }}" = "6.12.0" ]; then
artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12.rhf-*.tar' -print -quit)
test -n "$artifact"
.github/scripts/verify-rhf-artifact.sh "$artifact"
elif [ "${{ matrix.kernel_version }}" = "6.16.2" ]; then
artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.16-*.tar' -print -quit)
test -n "$artifact"
.github/scripts/verify-rhf-artifact.sh "$artifact" generic 6.16.2
fi
- name: Upload Artifacts
uses: actions/upload-artifact@v6
if: success()
with:
name: artifacts-${{ matrix.kernel_version }}-${{ matrix.libc }}
path: artifacts

build-generic-612:
name: Build generic 6.12 artifacts
strategy:
fail-fast: false
matrix:
libc: [static, glibc, musl]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
fetch-depth: 0
- name: Build generic 6.12 objects
run: ./build.sh 6.12.0 "${{ matrix.libc }}" generic
- name: Verify generic artifact
run: |
ls -lah artifacts
artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12-*.tar' -print -quit)
test -n "$artifact"
.github/scripts/verify-rhf-artifact.sh "$artifact" generic
- name: Upload generic artifacts
uses: actions/upload-artifact@v6
if: success()
with:
name: artifacts-6.12.0-generic-${{ matrix.libc }}
path: artifacts
81 changes: 73 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
kernel_version:
- '7.2.8'
- '6.16.2'
- '6.12.0'
- '6.8.2'
- '5.16.18'
- '5.17.15'
Expand Down Expand Up @@ -47,9 +48,19 @@
lfs: true
- name: Checkout LFS objects
run: git lfs checkout
- name: Verify stored 3.10 BPF objects
run: |
for object in CentOS7/*.o; do
readelf -h "$object" | grep -Eq 'Machine:.*Linux BPF' || {
echo "invalid or missing BPF ELF payload: $object" >&2
exit 1
}
done
- name: Run build.sh
run: |
if [ ${{ matrix.kernel_version }} = "5.14.0" ]; then
if [ ${{ matrix.kernel_version }} = "6.12.0" ]; then
os=centos10
elif [ ${{ matrix.kernel_version }} = "5.14.0" ]; then
os=centos9
elif [ ${{ matrix.kernel_version }} = "5.4.17" ]; then
os=oracle8
Expand All @@ -63,16 +74,53 @@
run: |
ls -lah artifacts
test -f artifacts/netdata_ebpf-*.tar
if [ "${{ matrix.kernel_version }}" = "6.12.0" ]; then
artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12.rhf-*.tar' -print -quit)
test -n "$artifact"
.github/scripts/verify-rhf-artifact.sh "$artifact"
elif [ "${{ matrix.kernel_version }}" = "6.16.2" ]; then
artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.16-*.tar' -print -quit)
test -n "$artifact"
.github/scripts/verify-rhf-artifact.sh "$artifact" generic 6.16.2
fi
- name: Upload Artifacts
uses: actions/upload-artifact@v6
if: success()
with:
name: artifacts-${{ matrix.kernel_version }}-${{ matrix.libc }}
path: artifacts

build-generic-612:
name: Build generic 6.12 artifacts
strategy:
fail-fast: false
matrix:
libc: [static, glibc, musl]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: true
fetch-depth: 0
- name: Build generic 6.12 objects
run: ./build.sh 6.12.0 "${{ matrix.libc }}" generic
- name: Verify generic artifact
run: |
ls -lah artifacts
artifact=$(find artifacts -maxdepth 1 -type f -name '*_6.12-*.tar' -print -quit)
test -n "$artifact"
.github/scripts/verify-rhf-artifact.sh "$artifact" generic
- name: Upload generic artifacts
uses: actions/upload-artifact@v6
if: success()
with:
name: artifacts-6.12.0-generic-${{ matrix.libc }}
path: artifacts

create-release:
name: Create Release
needs: build-artifacts
needs: [build-artifacts, build-generic-612]
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -88,19 +136,36 @@
with:
pattern: artifacts-*
path: artifacts
merge-multiple: true
- name: Set release_tag
run: |
echo "RELEASE_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV

Check warning on line 141 in .github/workflows/release.yml

View workflow job for this annotation

GitHub Actions / actionlint

[actionlint] reported by reviewdog 🐶 shellcheck reported issue in this script: SC2086:info:1:41: Double quote to prevent globbing and word splitting [shellcheck] Raw Output: i:.github/workflows/release.yml:141:51: shellcheck reported issue in this script: SC2086:info:1:41: Double quote to prevent globbing and word splitting [shellcheck]
- name: Consolidate Artifacts
run: |
mkdir -p final-artifacts
for libc in static glibc musl; do
for pkg in artifacts/netdata_ebpf-*_*-${libc}.tar; do
mkdir -p "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}"
tar -C "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}" -xvf "${pkg}"
done
if [ "${libc}" == "glibc" ]; then cp -R CentOS7/* "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}"; fi
package="packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}"
mkdir -p "${package}"
while IFS= read -r pkg; do
case "${pkg}" in
artifacts/artifacts-6.12.0-generic-*) continue ;;
esac
tar -C "${package}" -xvf "${pkg}"
done < <(find artifacts -mindepth 2 -maxdepth 2 -type f -name "netdata_ebpf-*_*-${libc}.tar" -print | sort)
# Generic 6.12 objects own the .6.12 suffix; unpack them last so the
# 6.16 build cannot replace the 6.12 ABI in the published package.
generic_archive=$(find "artifacts/artifacts-6.12.0-generic-${libc}" -maxdepth 1 -type f -name "netdata_ebpf-*_*-${libc}.tar" -print -quit)
test -n "${generic_archive}"
tar -C "${package}" -xvf "${generic_archive}"
while IFS= read -r object; do
cmp <(tar -xOf "${generic_archive}" "${object}") "${package}/${object}"
done < <(tar -tf "${generic_archive}" | grep -E '^[pr]netdata_ebpf_.*\.6\.12\.o$')
exact_archive=$(find "artifacts/artifacts-6.16.2-${libc}" -maxdepth 1 -type f -name "netdata_ebpf-*_*-${libc}.tar" -print -quit)
test -n "${exact_archive}"
.github/scripts/verify-rhf-artifact.sh "${exact_archive}" generic 6.16.2
while IFS= read -r object; do
cmp <(tar -xOf "${exact_archive}" "${object}") "${package}/${object}"
done < <(tar -tf "${exact_archive}" | grep -E '^[pr]netdata_ebpf_.*\.6\.16\.2\.o$')
if [ "${libc}" == "static" ] || [ "${libc}" == "glibc" ]; then cp -R CentOS7/* "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}"; fi
tar -C "packages/netdata-kernel-collector-${libc}-${RELEASE_TAG}" -Jcvf "final-artifacts/netdata-kernel-collector-${libc}-${RELEASE_TAG}.tar.xz" ./
done
cd final-artifacts && sha256sum ./*.tar.xz > sha256sums.txt
Expand Down
47 changes: 47 additions & 0 deletions Dockerfile.glibc.centos10
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
FROM almalinux:10 AS build

ARG ARCH=x86
ENV ARCH=$ARCH

ENV KERNEL_VERSION=6.12.0-124.8.1.el10_1

ENV RHF=.rhf

ENV _LIBC=glibc

# We use "Development tools" to install:
# gcc c/c++ compiler, redhat-rpm-config, strace, rpm-build, make, pkgconfig, gettext, automake, strace64, gdb, bison,
# libtool, autoconf, gcc-c++ compiler, binutils and all dependencies

# hadolint ignore=DL3040,DL3041
RUN dnf update -y && \
dnf install -y gcc make gcc-c++ libtool rpm-build-libs bison git && \
dnf install -y asciidoc audit-libs-devel bash bc binutils binutils-devel \
diffutils elfutils elfutils-devel \
elfutils-libelf-devel findutils gawk \
gzip hmaccalc hostname java-devel m4 \
module-init-tools ncurses-devel net-tools newt-devel \
numactl-devel openssl openssl-devel patch pciutils-devel \
perl perl-ExtUtils-Embed pesign \
rpm-build rsync tar xmlto xz zlib-devel clang llvm

RUN mkdir -p /root/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} && \

Check warning on line 28 in Dockerfile.glibc.centos10

View workflow job for this annotation

GitHub Actions / hadolint

[hadolint] reported by reviewdog 🐶 Expressions don't expand in single quotes, use double quotes for that. Raw Output: message:"Expressions don't expand in single quotes, use double quotes for that." location:{path:"Dockerfile.glibc.centos10" range:{start:{line:28 column:1}}} severity:INFO source:{name:"hadolint" url:"https://github.com/hadolint/hadolint"} code:{value:"SC2016" url:"https://github.com/koalaman/shellcheck/wiki/SC2016"}
echo '%_topdir %(echo $HOME)/rpmbuild' > /root/.rpmmacros && \
rpm -i https://repo.almalinux.org/vault/10.1/BaseOS/Source/Packages/kernel-${KERNEL_VERSION}.src.rpm 2>&1

RUN tar -xf /root/rpmbuild/SOURCES/linux-${KERNEL_VERSION}.tar.xz -C /root/rpmbuild/SOURCES && \
mkdir -p /usr/src/kernels

RUN ln -s /root/rpmbuild/SOURCES/linux-${KERNEL_VERSION} /usr/src/linux && \
ln -s /usr/lib/gcc/x86_64-redhat-linux/14/include/stdarg.h /usr/src/linux/include/

COPY kernel-patches/${KERNEL_VERSION} /usr/src/linux-${KERNEL_VERSION}-patches
COPY .dockerfiles/patch_kernel.sh /patch_kernel.sh
RUN /patch_kernel.sh

WORKDIR /kernel-collector

COPY .dockerfiles/build.sh /build.sh
COPY . .

CMD ["/build.sh"]
7 changes: 4 additions & 3 deletions Dockerfile.glibc.generic
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ RUN apt-get update && \

RUN mkdir -p /usr/src && \
cd /usr/src && \
wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${KERNEL_VERSION}.tar.xz && \
tar -xf linux-${KERNEL_VERSION}.tar.xz && \
ln -s linux-${KERNEL_VERSION} linux
SOURCE_KERNEL_VERSION=$(echo "$KERNEL_VERSION" | sed -E 's/\.0$//') && \
wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$SOURCE_KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${SOURCE_KERNEL_VERSION}.tar.xz && \
tar -xf linux-${SOURCE_KERNEL_VERSION}.tar.xz && \
ln -s linux-${SOURCE_KERNEL_VERSION} linux

COPY kernel-patches/${KERNEL_VERSION} /usr/src/linux-${KERNEL_VERSION}-patches
COPY .dockerfiles/patch_kernel.sh /patch_kernel.sh
Expand Down
34 changes: 34 additions & 0 deletions Dockerfile.musl.centos10
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
FROM alpine:3.24 AS build

ARG ARCH=x86
ENV ARCH=$ARCH

ARG LOCAL_KERNEL_VERSION=6.12.0-124.8.1.el10_1

ENV RHF=.rhf

ENV _LIBC=musl

# hadolint ignore=DL3018
RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \
bc elfutils-dev openssl-dev clang clang-dev llvm \
rsync bison flex tar xz bash git rpm ssl_client linux-headers

# hadolint ignore=DL3003,SC3009
RUN mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} && \
echo "%_topdir %(echo $HOME)/rpmbuild" > ~/.rpmmacros && \
wget -q https://repo.almalinux.org/vault/10.1/BaseOS/Source/Packages/kernel-${LOCAL_KERNEL_VERSION}.src.rpm && \
rpm -i kernel-${LOCAL_KERNEL_VERSION}.src.rpm && \
cd ~/rpmbuild/SOURCES && \
tar -xf linux-${LOCAL_KERNEL_VERSION}.tar.xz && \
mkdir -p /usr/src/kernels && \
cd /usr/src && \
ln -s ~/rpmbuild/SOURCES/linux-${LOCAL_KERNEL_VERSION} linux && \
ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/15.2.0/include/stdarg.h /usr/src/linux/include/

WORKDIR /kernel-collector

COPY .dockerfiles/build.sh /build.sh
COPY . .

CMD ["/build.sh"]
2 changes: 1 addition & 1 deletion Dockerfile.musl.centos8
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV ARCH=$ARCH

ARG LOCAL_KERNEL_VERSION=4.18.0-372.16.1.el8_6

ENV _LIBC=static
ENV _LIBC=musl

# hadolint ignore=DL3018
RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.musl.centos9
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV ARCH=$ARCH

ARG LOCAL_KERNEL_VERSION=5.14.0-70.17.1.el9_0

ENV _LIBC=static
ENV _LIBC=musl

# hadolint ignore=DL3018
RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \
Expand Down
7 changes: 4 additions & 3 deletions Dockerfile.musl.generic
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \
# hadolint ignore=DL3003,SC3009
RUN mkdir -p /usr/src && \
cd /usr/src && \
wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${KERNEL_VERSION}.tar.xz && \
tar -xf linux-${KERNEL_VERSION}.tar.xz && \
ln -s linux-${KERNEL_VERSION} linux && \
SOURCE_KERNEL_VERSION=$(echo "$KERNEL_VERSION" | sed -E 's/\.0$//') && \
wget -q https://cdn.kernel.org/pub/linux/kernel/v$(echo "$SOURCE_KERNEL_VERSION" | cut -f 1 -d '.').x/linux-${SOURCE_KERNEL_VERSION}.tar.xz && \
tar -xf linux-${SOURCE_KERNEL_VERSION}.tar.xz && \
ln -s linux-${SOURCE_KERNEL_VERSION} linux && \
ln -s /usr/lib/gcc/x86_64-alpine-linux-musl/15.2.0/include/stdarg.h /usr/src/linux/include/

WORKDIR /kernel-collector
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.musl.oracle8
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENV ARCH=$ARCH

ARG LOCAL_KERNEL_VERSION=5.4.17

ENV _LIBC=static
ENV _LIBC=musl

# hadolint ignore=DL3018
RUN apk add --no-cache -U build-base autoconf automake coreutils pkgconfig \
Expand Down
Loading
Loading