mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-17 18:06:59 +02:00
.github: new Github workflow for open-vm-tools
Automatically update coreos/open-vm-tools as well as coreos-base/oem-vmware. Get the latest open-vm-tools release number, and get its build number from the Github repo, and replace the old build number with the new one. Also sync coreos-base/oem-vmware in line with open-vm-tools.
This commit is contained in:
parent
1cdf93de4d
commit
2b84ad8efd
55
sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-apply-patch.sh
vendored
Executable file
55
sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-apply-patch.sh
vendored
Executable file
@ -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}"
|
47
sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-releases-main.yml
vendored
Normal file
47
sdk_container/src/third_party/coreos-overlay/.github/workflows/vmware-releases-main.yml
vendored
Normal file
@ -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 <buildbot@flatcar-linux.org>
|
||||
committer: Flatcar Buildbot <buildbot@flatcar-linux.org>
|
||||
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
|
Loading…
Reference in New Issue
Block a user