Skip to content

Commit

Permalink
Separate available version from built version
Browse files Browse the repository at this point in the history
Update logic to always save the latest version from Proxmox but
check against the latest built version to determine whether to
trigger a build.

Fixed patching for kernel version 5.15 so that the relaxablermrr
suffix is correctly applied.

Fixed artifact uploading for newer 6.2.16 kernels which started
failing due to internal renaming (pve-kernel-* to
proxmox-kernel-*).
  • Loading branch information
brunokc committed Aug 5, 2023
1 parent ebb1ccb commit 0aeb61b
Show file tree
Hide file tree
Showing 9 changed files with 55 additions and 33 deletions.
58 changes: 37 additions & 21 deletions .github/workflows/new-pve-kernel-release-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ on:
env:
DEBIAN_FRONTEND: noninteractive
TOKEN: ${{ secrets.token }}
VERSION_AVAILABLE_FILE_PATH: '${{ github.workspace }}/config/${{ inputs.branch }}/version_available'
VERSION_BUILT_FILE_PATH: '${{ github.workspace }}/config/${{ inputs.branch }}/version_built'

jobs:
check-for-new-kernel:
Expand Down Expand Up @@ -62,12 +64,11 @@ jobs:
- name: Check for latest kernel version
id: check-version
run: |
config_path='${{ github.workspace }}/config/${{ inputs.branch }}/version'
cur_abi_ver=""
if [[ -e ${config_path} ]]; then
cur_abi_ver=`yq .version.kernel ${config_path}`
if [[ -e ${VERSION_AVAILABLE_FILE_PATH} ]]; then
cur_abi_ver=`yq .version.kernel ${VERSION_AVAILABLE_FILE_PATH}`
fi
echo "Current cached kernel version for branch ${{ inputs.branch }}: ${cur_abi_ver}"
echo "Current cached kernel ABI version for branch ${{ inputs.branch }}: ${cur_abi_ver}"
proxmox_ver=`curl -s "https://git.proxmox.com/?p=pve-kernel-meta.git;a=shortlog;h=refs/heads/${{ inputs.branch }}" | \
grep -oP "bump version to \K[^<]*" | head -n 1`
url="https://git.proxmox.com/?p=pve-kernel.git;a=shortlog;h=refs/heads/${{ inputs.branch }}"
Expand All @@ -76,28 +77,41 @@ jobs:
abi_ver=`grep -oP "update ABI file for \K[^<,]+" shortlog.html | head -n 1`
#kernel_ver="pve-kernel-${abi_ver}-${ver}"
if [[ ${abi_ver} == ${cur_abi_ver} ]]; then
echo "Kernel ABI version ${abi_ver} for branch ${{ inputs.branch }} is up to date. Nothing to do."
echo "status=up-to-date" >> $GITHUB_OUTPUT
echo "Kernel ABI version ${abi_ver} for branch ${{ inputs.branch }} is up to date. Checking latest built kernel..."
built_abi_ver=""
if [[ -e ${VERSION_BUILT_FILE_PATH} ]]; then
built_abi_ver=`yq .version.kernel ${VERSION_BUILT_FILE_PATH}`
fi
echo "Current built kernel version for branch ${{ inputs.branch }}: ${built_abi_ver}"
if [[ ${abi_ver} == ${built_abi_ver} ]]; then
echo "Built kernel ABI version ${abi_ver} for branch ${{ inputs.branch }} is up to date. Nothing to do."
echo "status=up-to-date" >> $GITHUB_OUTPUT
else
echo "Built kernel ABI version and available kernel ABI version are out of sync. Will trigger a build..."
echo "kernel-version=${abi_ver}" >> $GITHUB_OUTPUT
echo "proxmox-version=${proxmox_ver}" >> $GITHUB_OUTPUT
echo "status=needs-update" >> $GITHUB_OUTPUT
fi
else
echo "New kernel ABI version avaiable for branch ${{ inputs.branch }}: ${abi_ver}. Will update repository."
mkdir -p `dirname ${config_path}`
sudo echo -e "version:\n proxmox: ${proxmox_ver}\n kernel: ${abi_ver}" > ${config_path}
echo "New kernel ABI version avaiable for branch ${{ inputs.branch }}: ${abi_ver}. Will trigger a build."
mkdir -p `dirname ${VERSION_AVAILABLE_FILE_PATH}`
sudo echo -e "version:\n proxmox: ${proxmox_ver}\n kernel: ${abi_ver}" > ${VERSION_AVAILABLE_FILE_PATH}
echo "kernel-version=${abi_ver}" >> $GITHUB_OUTPUT
echo "proxmox-version=${proxmox_ver}" >> $GITHUB_OUTPUT
echo "status=needs-update" >> $GITHUB_OUTPUT
fi
rm -f shortlog.html
#- name: Save new kernel version
# continue-on-error: true
# if: inputs.save-new-version && steps.check-version.outputs.status == 'needs-update'
# run: |
# git config --local user.email "[email protected]"
# git config --local user.name "Github Actions"
# git pull
# git add config/**
# git commit -m 'Update version for branch ${{ inputs.branch }} to ${{ steps.check-version.outputs.kernel-version }}'
# git push
- name: Save new available kernel version
continue-on-error: true
if: inputs.save-new-version && steps.check-version.outputs.status == 'needs-update'
run: |
git config --local user.email "[email protected]"
git config --local user.name "Github Actions"
git pull
git add config/**
git commit -m 'Update available kernel version for branch ${{ inputs.branch }} to ${{ steps.check-version.outputs.kernel-version }}'
git push
build-kernel:
name: Build new kernel
Expand Down Expand Up @@ -127,13 +141,15 @@ jobs:
with:
token: ${{ env.TOKEN }}

- name: Commit new kernel version
- name: Save new built kernel version
run: |
version_built_file_path='${{ github.workspace }}/config/${{ inputs.branch }}/version_built'
sudo echo -e "version:\n proxmox: ${proxmox_ver}\n kernel: ${abi_ver}" > ${version_built_file_path}
git config --local user.email "[email protected]"
git config --local user.name "Github Actions"
git pull
git add config/**
git commit -m 'Update kernel version for branch ${{ inputs.branch }} to ${{ needs.check-for-new-kernel.outputs.kernel-version }}'
git commit -m 'Update built kernel version for branch ${{ inputs.branch }} to ${{ needs.check-for-new-kernel.outputs.kernel-version }}'
git push
release-new-kernel:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trigger-kernel-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
uses: ./.github/workflows/new-pve-kernel-release-check.yml
with:
branch: ${{ matrix.branch }}
save-new-version: ${{ inputs.save-new-version }}
save-new-version: ${{ inputs.save-new-version != '' && inputs.save-new-kernel || true }}
secrets:
token: ${{ secrets.PAT }}
permissions:
Expand Down
3 changes: 0 additions & 3 deletions config/master/version

This file was deleted.

3 changes: 3 additions & 0 deletions config/master/version_available
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version:
proxmox: 8.0.4
kernel: 6.2.16-8-pve
3 changes: 3 additions & 0 deletions config/master/version_built
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version:
proxmox:
kernel:
File renamed without changes.
3 changes: 3 additions & 0 deletions config/pve-kernel-5.15/version_built
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version:
proxmox:
kernel:
14 changes: 7 additions & 7 deletions patches/build/pve-kernel-5.15/0001-proxmox-kernel-version.patch
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
--- a/Makefile
+++ b/Makefile
@@ -11,7 +11,7 @@
@@ -13,7 +13,7 @@
KERNEL_MAJMIN=$(KERNEL_MAJ).$(KERNEL_MIN)
KERNEL_VER=$(KERNEL_MAJMIN).$(KERNEL_PATCHLEVEL)

-EXTRAVERSION=-${KREL}-pve
+EXTRAVERSION=-${KREL}-pve-relaxablermrr
KVNAME=${KERNEL_VER}${EXTRAVERSION}
PACKAGE=pve-kernel-${KVNAME}
HDRPACKAGE=pve-headers-${KVNAME}
-EXTRAVERSION=-$(KREL)-pve
+EXTRAVERSION=-$(KREL)-pve-relaxablermrr
KVNAME=$(KERNEL_VER)$(EXTRAVERSION)
PACKAGE=pve-kernel-$(KVNAME)
HDRPACKAGE=pve-headers-$(KVNAME)
2 changes: 1 addition & 1 deletion scripts/build-kernel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ echo Exporting artifacts...
mkdir -p $OUTPUT_DIR/artifacts
cp *.deb $OUTPUT_DIR/artifacts

for d in build pve-kernel-*; do
for d in build pve-kernel-* proxmox-kernel-*; do
if [[ -d $d ]]; then
echo "Exporting abi files from $d to $OUTPUT_DIR..."
cp $d/abi* $OUTPUT_DIR
Expand Down

0 comments on commit 0aeb61b

Please sign in to comment.