From 053fe006d3b2ede4088bc62c6614be5f3950bd1e Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Thu, 13 Oct 2022 13:15:23 +0200 Subject: [PATCH] .github: Simplify kernel patch script No point in setting UPDATE_NEEDED to zero if we exit the script without doing anything with the just set variable. Also to avoid mismatches in branch names, export the branch name as a github workflow step output, so the follow-up steps can pick it up and use. --- .../.github/workflows/kernel-apply-patch.sh | 11 +++++------ .../.github/workflows/kernel-release.yml | 2 +- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/.github/workflows/kernel-apply-patch.sh b/sdk_container/src/third_party/coreos-overlay/.github/workflows/kernel-apply-patch.sh index 9846ccc5f8..b11004332c 100755 --- a/sdk_container/src/third_party/coreos-overlay/.github/workflows/kernel-apply-patch.sh +++ b/sdk_container/src/third_party/coreos-overlay/.github/workflows/kernel-apply-patch.sh @@ -4,14 +4,13 @@ set -euo pipefail # trim the 3rd part in the input semver, e.g. from 5.4.1 to 5.4 VERSION_SHORT=${VERSION_NEW%.*} -UPDATE_NEEDED=1 +BRANCH_NAME="linux-${VERSION_NEW}-${TARGET}" . .github/workflows/common.sh prepare_git_repo -if ! checkout_branches "linux-${VERSION_NEW}-${TARGET}"; then - UPDATE_NEEDED=0 +if ! checkout_branches "${BRANCH_NAME}"; then exit 0 fi @@ -23,7 +22,6 @@ if [[ -z "${VERSION_OLD}" ]]; then fi if [[ "${VERSION_NEW}" = "${VERSION_OLD}" ]]; then echo "already the latest Kernel, nothing to do" - UPDATE_NEEDED=0 exit 0 fi @@ -77,5 +75,6 @@ generate_patches sys-kernel coreos-sources Kernel apply_patches -echo ::set-output name=VERSION_OLD::"${VERSION_OLD}" -echo ::set-output name=UPDATE_NEEDED::"${UPDATE_NEEDED}" +echo "VERSION_OLD=${VERSION_OLD}" >>"${GITHUB_OUTPUT}" +echo "UPDATE_NEEDED=1" >>"${GITHUB_OUTPUT}" +echo "BRANCH_NAME=${BRANCH_NAME}" >>"${GITHUB_OUTPUT}" diff --git a/sdk_container/src/third_party/coreos-overlay/.github/workflows/kernel-release.yml b/sdk_container/src/third_party/coreos-overlay/.github/workflows/kernel-release.yml index 001f523ae1..a365a66287 100644 --- a/sdk_container/src/third_party/coreos-overlay/.github/workflows/kernel-release.yml +++ b/sdk_container/src/third_party/coreos-overlay/.github/workflows/kernel-release.yml @@ -53,7 +53,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} base: ${{ steps.figure-out-branch.outputs.BRANCH }} - branch: linux-${{ steps.fetch-latest-release.outputs.KERNEL_VERSION }}-${{ steps.figure-out-branch.outputs.BRANCH }} + branch: ${{ steps.apply-patch.outputs.BRANCH_NAME }} author: Flatcar Buildbot committer: Flatcar Buildbot title: Upgrade Linux Kernel for ${{ steps.figure-out-branch.outputs.BRANCH }} from ${{ steps.apply-patch.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.KERNEL_VERSION }}