From 33aca108c15941a0681c4f2fae7b1d60c28d845e Mon Sep 17 00:00:00 2001 From: Ihor Solodrai Date: Tue, 17 Sep 2024 12:16:31 -0700 Subject: [PATCH] tar-artifacts.sh: don't rely on kbuild-output to be in kernel repo --- .github/scripts/tar-artifact.sh | 40 ++++++++++++++++++------------ .github/workflows/kernel-build.yml | 1 + .github/workflows/kernel-test.yml | 2 +- 3 files changed, 26 insertions(+), 17 deletions(-) diff --git a/.github/scripts/tar-artifact.sh b/.github/scripts/tar-artifact.sh index f5818ba..43bff08 100644 --- a/.github/scripts/tar-artifact.sh +++ b/.github/scripts/tar-artifact.sh @@ -45,25 +45,33 @@ if [ $archive_make_helpers -ne 0 ]; then # 'make kernelrelease' and bpf tool checks later on. mapfile -t additional_file_list < <(find . -iname Makefile) additional_file_list+=( - "scripts/" - "tools/testing/selftests/bpf/" - "tools/include/" + "scripts/" + "tools/testing/selftests/bpf/" + "tools/include/" "tools/bpf/bpftool/" ) fi image_name=$(make ARCH="$(platform_to_kernel_arch "${arch}")" -s image_name) -# zstd is installed by default in the runner images. -tar -cf - \ - "${KBUILD_OUTPUT}/.config" \ - "${KBUILD_OUTPUT}/${image_name}" \ - "${KBUILD_OUTPUT}/include/config/auto.conf" \ - "${KBUILD_OUTPUT}/include/generated/autoconf.h" \ - "${KBUILD_OUTPUT}/vmlinux" \ - "${additional_file_list[@]}" \ - --exclude '*.cmd' \ - --exclude '*.d' \ - --exclude '*.h' \ - --exclude '*.output' \ - selftests/bpf/ | zstd -T0 -19 -o "vmlinux-${arch}-${toolchain}.tar.zst" +kbuild_output_file_list=( + ".config" + "${image_name}" + "include/config/auto.conf" + "include/generated/autoconf.h" + "vmlinux" +) + +# Assumptions: +# - $(pwd) is the root of kernel repo we're tarring +# - zstd is installed by default in the runner images +tar -cf - \ + -C "$KBUILD_OUTPUT" \ + "${kbuild_output_file_list[@]}" \ + -C "$(pwd)" \ + "${additional_file_list[@]}" \ + --exclude '*.cmd' \ + --exclude '*.d' \ + --exclude '*.output' \ + selftests/bpf/ \ + | zstd -T0 -19 -o "vmlinux-${arch}-${toolchain}.tar.zst" diff --git a/.github/workflows/kernel-build.yml b/.github/workflows/kernel-build.yml index 33ee34c..47137fb 100644 --- a/.github/workflows/kernel-build.yml +++ b/.github/workflows/kernel-build.yml @@ -127,6 +127,7 @@ jobs: max-make-jobs: 32 llvm-version: ${{ inputs.llvm-version }} - name: Tar artifacts + working-directory: ${{ env.REPO_ROOT }} run: | bash .github/scripts/tar-artifact.sh ${{ inputs.arch }} ${{ inputs.toolchain_full }} 1 - if: ${{ github.event_name != 'push' }} diff --git a/.github/workflows/kernel-test.yml b/.github/workflows/kernel-test.yml index 87eef72..4fbb2c7 100644 --- a/.github/workflows/kernel-test.yml +++ b/.github/workflows/kernel-test.yml @@ -64,7 +64,7 @@ jobs: arch: ${{ inputs.arch }} img: '/tmp/root.img' vmlinuz: '${{ github.workspace }}/vmlinuz' - kernel-root: '.' + kernel-root: ${{ env.REPO_ROOT }} max-cpu: 8 kernel-test: ${{ inputs.test }} kbuild-output: ${{ env.KBUILD_OUTPUT }}