diff --git a/sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-apply-patch.sh b/sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-apply-patch.sh new file mode 100755 index 0000000000..e71f65d339 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-apply-patch.sh @@ -0,0 +1,55 @@ +#!/bin/bash + +set -euo pipefail + +UPDATE_NEEDED=1 + +. .github/workflows/common.sh + +prepare_git_repo + +if ! checkout_branches "${VERSION_NEW}-${TARGET}"; then + UPDATE_NEEDED=0 + exit 0 +fi + +# Update app-emulation/open-vm-tools + +pushd "${SDK_OUTER_SRCDIR}/third_party/coreos-overlay" >/dev/null || exit + +# Parse the Manifest file for already present source files and keep the latest version in the current series +VERSION_OLD=$(sed -n "s/^DIST open-vm-tools-\([0-9]*\.[0-9]*\.[0-9]*\).*$/\1/p" app-emulation/open-vm-tools/Manifest | sort -ruV | head -n1) +if [[ "${VERSION_NEW}" = "${VERSION_OLD}" ]]; then + echo "already the latest open-vm-tools, nothing to do" + UPDATE_NEEDED=0 + exit 0 +fi + +EBUILD_FILENAME_OVT=$(get_ebuild_filename "app-emulation" "open-vm-tools" "${VERSION_OLD}") +git mv "${EBUILD_FILENAME_OVT}" "app-emulation/open-vm-tools/open-vm-tools-${VERSION_NEW}.ebuild" + +# We need to also replace the old build number with the new build number in the ebuild. +sed -i -e "s/^\(MY_P=.*-\)[0-9]*\"$/\1${BUILD_NUMBER}\"/" app-emulation/open-vm-tools/open-vm-tools-${VERSION_NEW}.ebuild + +popd >/dev/null || exit + +generate_patches app-emulation open-vm-tools open-vm-tools + +apply_patches + + +# Update coreos-base/oem-vmware + +pushd "${SDK_OUTER_SRCDIR}/third_party/coreos-overlay" >/dev/null || exit + +EBUILD_FILENAME_OEM=$(get_ebuild_filename "coreos-base" "oem-vmware" "${VERSION_OLD}") +git mv "${EBUILD_FILENAME_OEM}" "coreos-base/oem-vmware/oem-vmware-${VERSION_NEW}.ebuild" + +popd >/dev/null || exit + +generate_patches coreos-base oem-vmware oem-vmware + +apply_patches + +echo ::set-output name=VERSION_OLD::"${VERSION_OLD}" +echo ::set-output name=UPDATE_NEEDED::"${UPDATE_NEEDED}" diff --git a/sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-releases-main.yml b/sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-releases-main.yml new file mode 100644 index 0000000000..6b5061220f --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-releases-main.yml @@ -0,0 +1,47 @@ +name: Get the latest open-vm-tools release for main +on: + schedule: + - cron: '0 7 * * 3' + +jobs: + get-vmware-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + - name: Fetch latest open-vm-tools release + id: fetch-latest-release + run: | + git clone https://github.com/vmware/open-vm-tools + versionMain=$(git -C open-vm-tools ls-remote --tags origin | cut -f2 | sed -n "/refs\/tags\/stable-[0-9]*\.[0-9]*\.[0-9]*$/s/^refs\/tags\/stable-//p" | sort -ruV | head -n1) + buildNumber=$(curl -sSL https://api.github.com/repos/vmware/open-vm-tools/releases/latest | jq -r '.assets[0].name' | sed -n "s/^open-vm-tools-${versionMain}*-\([0-9]*\)\..*/\1/p") + rm -rf open-vm-tools + echo ::set-output name=BASE_BRANCH_MAIN::main + echo ::set-output name=BUILD_NUMBER::$(echo ${buildNumber}) + echo ::set-output name=VERSION_MAIN::$(echo ${versionMain}) + - name: Set up Flatcar SDK + id: setup-flatcar-sdk + run: .github/workflows/setup-flatcar-sdk.sh + - name: Apply patch for main + id: apply-patch-main + env: + TARGET: main + BASE_BRANCH: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_MAIN }} + BUILD_NUMBER: ${{ steps.fetch-latest-release.outputs.BUILD_NUMBER }} + PATH: ${{ steps.setup-flatcar-sdk.outputs.path }} + VERSION_NEW: ${{ steps.fetch-latest-release.outputs.VERSION_MAIN }} + run: .github/workflows/vmware-apply-patch.sh + - name: Create pull request for main + uses: peter-evans/create-pull-request@v3 + if: steps.apply-patch-main.outputs.UPDATE_NEEDED == 1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + base: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_MAIN }} + branch: vmware-${{ steps.fetch-latest-release.outputs.VERSION_MAIN }}-${{ steps.fetch-latest-release.outputs.BASE_BRANCH_MAIN }} + author: Flatcar Buildbot + committer: Flatcar Buildbot + title: Upgrade open-vm-tools in main from ${{ steps.apply-patch-main.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_MAIN }} + commit-message: Upgrade open-vm-tools in main from ${{ steps.apply-patch-main.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_MAIN }} + body: Upgrade open-vm-tools in main from ${{ steps.apply-patch-main.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_MAIN }} + labels: main