.github: split out from runc into common.sh

To avoid duplicates, make runc-apply-patch.sh use the helper
functions in `common.sh`.
This commit is contained in:
Dongsu Park 2020-04-09 14:22:32 +02:00 committed by Kai Lüke
parent c74c31a835
commit 0d4a0194be

View File

@ -2,13 +2,11 @@
set -euo pipefail
branch="runc-${VERSION_NEW}"
. .github/workflows/common.sh
git -C ~/flatcar-sdk/src/scripts checkout -B "${BASE_BRANCH}" "github/${BASE_BRANCH}"
git -C ~/flatcar-sdk/src/third_party/portage-stable checkout -B "${BASE_BRANCH}" "github/${BASE_BRANCH}"
checkout_branches "runc-${VERSION_NEW}"
pushd ~/flatcar-sdk/src/third_party/coreos-overlay >/dev/null || exit
git checkout -B "${branch}" "github/${BASE_BRANCH}"
pushd "${SDK_OUTER_SRCDIR}/third_party/coreos-overlay" >/dev/null || exit
# Get the original runc version, including official releases and rc versions.
# We need some sed tweaks like adding underscore, sort, and trim the underscore again,
@ -32,28 +30,10 @@ versionTorcx=${dockerVersion%.*}
torcxEbuildFile=$(ls -1 app-torcx/docker/docker-${versionTorcx}*.ebuild | sort -ruV | head -n1)
sed -i "s/docker-runc-${VERSION_OLD}/docker-runc-${VERSION_NEW}/g" ${torcxEbuildFile}
function enter() ( cd ../../..; exec cork enter -- $@ )
popd >/dev/null || exit
# Update manifest and regenerate metadata
enter ebuild "/mnt/host/source/src/third_party/coreos-overlay/app-emulation/docker-runc/docker-runc-${VERSION_NEW}.ebuild" manifest --force
generate_patches app-emulation docker-runc Runc
# We can only create the actual commit in the actual source directory, not under the SDK.
# So create a format-patch, and apply to the actual source.
git add app-emulation/docker-runc/docker-runc-${VERSION_NEW}* app-torcx metadata
git commit -a -m "app-emulation/docker-runc: Upgrade Runc ${VERSION_OLD} to ${VERSION_NEW}"
# Generate metadata after the main commit was done.
enter /mnt/host/source/src/scripts/update_metadata --commit coreos
# Create 2 patches, one for the main ebuilds, the other for metadata changes.
git format-patch -2 HEAD
popd || exit
git config user.name 'Flatcar Buildbot'
git config user.email 'buildbot@flatcar-linux.org'
git reset --hard HEAD
git fetch origin
git checkout -B "${BASE_BRANCH}" "origin/${BASE_BRANCH}"
git am ~/flatcar-sdk/src/third_party/coreos-overlay/0*.patch
apply_patches
echo ::set-output name=VERSION_OLD::"${VERSION_OLD}"