From c74c31a83542fd1cd59629130f105b807ea49169 Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Thu, 9 Apr 2020 14:08:15 +0200 Subject: [PATCH] .github: split out from docker into common.sh To avoid duplicates, make docker-apply-patch.sh use the helper functions in `common.sh`. --- .../.github/workflows/docker-apply-patch.sh | 32 ++++--------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/.github/workflows/docker-apply-patch.sh b/sdk_container/src/third_party/coreos-overlay/.github/workflows/docker-apply-patch.sh index 2591579fb0..2b6293f78c 100755 --- a/sdk_container/src/third_party/coreos-overlay/.github/workflows/docker-apply-patch.sh +++ b/sdk_container/src/third_party/coreos-overlay/.github/workflows/docker-apply-patch.sh @@ -2,13 +2,11 @@ set -euo pipefail -branch="docker-${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 "docker-${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 VERSION_OLD=$(sed -n "s/^DIST docker-\([0-9]*.[0-9]*.[0-9]*\).*/\1/p" app-emulation/docker/Manifest | sort -ruV | head -n1) [[ "${VERSION_NEW}" = "${VERSION_OLD}" ]] && echo "already the latest Docker, nothing to do" && exit @@ -32,28 +30,10 @@ versionRunc=$(sed -n "s/^DIST docker-runc-\([0-9]*.[0-9]*.*\)\.tar.*/\1/p" app-e runcEbuildFile=$(ls -1 app-emulation/docker-runc/docker-runc-${versionRunc}*.ebuild | sort -ruV | head -n1) sed -i "s/github.com\/docker\/docker-ce\/blob\/v${VERSION_OLD}/github.com\/docker\/docker-ce\/blob\/v${VERSION_NEW}/g" ${runcEbuildFile} -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/docker-${VERSION_NEW}.ebuild" manifest --force +generate_patches app-emulation docker Docker -# 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/docker-${VERSION_NEW}* app-torcx metadata -git commit -a -m "app-emulation/docker: Upgrade Docker ${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}"