From eff02fb3f0f4cd91a94643323c341c079bbe039e Mon Sep 17 00:00:00 2001 From: Jeremi Piotrowski Date: Fri, 23 Jul 2021 09:42:57 +0000 Subject: [PATCH] .github: Adapt docker-release-main action to Docker 20 The upstream docker repository location has changed to docker/docker. Additionally, the cli component has been split out which which requires fetching two hashes and updating two ebuilds. We also took the chance to align the ebuild with gentoo's, which means there are is no more live ebuild and no symlink. Signed-off-by: Jeremi Piotrowski --- .../.github/workflows/common.sh | 8 ++++++++ .../.github/workflows/docker-apply-patch.sh | 19 +++++++++++++------ .../workflows/docker-releases-main.yml | 10 +++++++--- .../.github/workflows/runc-apply-patch.sh | 1 - 4 files changed, 28 insertions(+), 10 deletions(-) diff --git a/sdk_container/src/third_party/coreos-overlay/.github/workflows/common.sh b/sdk_container/src/third_party/coreos-overlay/.github/workflows/common.sh index 0c2e3a140f..964b3290c5 100644 --- a/sdk_container/src/third_party/coreos-overlay/.github/workflows/common.sh +++ b/sdk_container/src/third_party/coreos-overlay/.github/workflows/common.sh @@ -28,6 +28,14 @@ function checkout_branches() { git -C "${SDK_OUTER_SRCDIR}/third_party/coreos-overlay" checkout -B "${TARGET_BRANCH}" "github/${BASE_BRANCH}" } +function regenerate_manifest() { + CATEGORY_NAME=$1 + PKGNAME_SIMPLE=$2 + pushd "${SDK_OUTER_SRCDIR}/third_party/coreos-overlay" >/dev/null || exit + enter ebuild "${SDK_INNER_SRCDIR}/third_party/coreos-overlay/${CATEGORY_NAME}/${PKGNAME_SIMPLE}/${PKGNAME_SIMPLE}-${VERSION_NEW}.ebuild" manifest --force + popd || exit +} + function generate_patches() { CATEGORY_NAME=$1 PKGNAME_SIMPLE=$2 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 eb1b641ef1..ad71c4c264 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 @@ -22,17 +22,23 @@ fi # we need to update not only the main ebuild file, but also its DOCKER_GITCOMMIT, # which needs to point to COMMIT_HASH that matches with $VERSION_NEW from upstream docker-ce. -dockerEbuildOldSymlink=$(ls -1 app-emulation/docker/docker-${VERSION_OLD}.ebuild) -dockerEbuildNewSymlink="app-emulation/docker/docker-${VERSION_NEW}.ebuild" -dockerEbuildMain="app-emulation/docker/docker-9999.ebuild" -git mv ${dockerEbuildOldSymlink} ${dockerEbuildNewSymlink} -sed -i "s/DOCKER_GITCOMMIT=\"\(.*\)\"/DOCKER_GITCOMMIT=\"${COMMIT_HASH}\"/g" ${dockerEbuildMain} -sed -i "s/v${VERSION_OLD}/v${VERSION_NEW}/g" ${dockerEbuildMain} +dockerEbuildOld=$(ls -1 app-emulation/docker/docker-${VERSION_OLD}.ebuild) +dockerEbuildNew="app-emulation/docker/docker-${VERSION_NEW}.ebuild" +git mv ${dockerEbuildOld} ${dockerEbuildNew} +sed -i "s/GIT_COMMIT=\(.*\)/GIT_COMMIT=${COMMIT_HASH}/g" ${dockerEbuildNew} +sed -i "s/v${VERSION_OLD}/v${VERSION_NEW}/g" ${dockerEbuildNew} + +cliEbuildOld=$(ls -1 app-emulation/docker-cli/docker-cli-${VERSION_OLD}.ebuild) +cliEbuildNew="app-emulation/docker-cli/docker-cli-${VERSION_NEW}.ebuild" +git mv ${cliEbuildOld} ${cliEbuildNew} +sed -i "s/GIT_COMMIT=\(.*\)/GIT_COMMIT=${COMMIT_CLI_HASH}/g" ${cliEbuildNew} +sed -i "s/v${VERSION_OLD}/v${VERSION_NEW}/g" ${cliEbuildNew} # torcx ebuild file has a docker version with only major and minor versions, like 19.03. versionTorcx=${VERSION_OLD%.*} torcxEbuildFile=$(ls -1 app-torcx/docker/docker-${versionTorcx}*.ebuild | sort -ruV | head -n1) sed -i "s/docker-${VERSION_OLD}/docker-${VERSION_NEW}/g" ${torcxEbuildFile} +sed -i "s/docker-cli-${VERSION_OLD}/docker-cli-${VERSION_NEW}/g" ${torcxEbuildFile} # update also docker versions used by the current docker-runc ebuild file. versionRunc=$(sed -n "s/^DIST docker-runc-\([0-9]*.[0-9]*.*\)\.tar.*/\1/p" app-emulation/docker-runc/Manifest | sort -ruV | head -n1) @@ -41,6 +47,7 @@ sed -i "s/github.com\/docker\/docker-ce\/blob\/v${VERSION_OLD}/github.com\/docke popd >/dev/null || exit +regenerate_manifest app-emulation docker-cli generate_patches app-emulation docker Docker apply_patches diff --git a/sdk_container/src/third_party/coreos-overlay/.github/workflows/docker-releases-main.yml b/sdk_container/src/third_party/coreos-overlay/.github/workflows/docker-releases-main.yml index e98dd9869f..992ffd96f5 100644 --- a/sdk_container/src/third_party/coreos-overlay/.github/workflows/docker-releases-main.yml +++ b/sdk_container/src/third_party/coreos-overlay/.github/workflows/docker-releases-main.yml @@ -13,12 +13,15 @@ jobs: - name: Fetch latest Docker release id: fetch-latest-release run: | - git clone https://github.com/docker/docker-ce docker + git clone https://github.com/docker/docker docker + git clone https://github.com/docker/cli docker-cli versionMain=$(git -C docker ls-remote --tags origin | cut -f2 | sed -n "/refs\/tags\/v[0-9]*\.[0-9]*\.[0-9]*$/s/^refs\/tags\/v//p" | egrep -v -e '(beta|rc)' | sort -ruV | head -n1) - commitMain=$(git -C docker rev-parse --short=7 v${versionMain}) - rm -rf docker + commitMain=$(git -C docker rev-parse --short=10 v${versionMain}) + commitCli=$(git -C docker-cli rev-parse --short=10 v${versionMain}) + rm -rf docker docker-cli echo ::set-output name=VERSION_MAIN::$(echo ${versionMain}) echo ::set-output name=COMMIT_MAIN::$(echo ${commitMain}) + echo ::set-output name=COMMIT_CLI::$(echo ${commitCli}) echo ::set-output name=BASE_BRANCH_MAIN::main - name: Set up Flatcar SDK id: setup-flatcar-sdk @@ -30,6 +33,7 @@ jobs: BASE_BRANCH: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_MAIN }} VERSION_NEW: ${{ steps.fetch-latest-release.outputs.VERSION_MAIN }} COMMIT_HASH: ${{ steps.fetch-latest-release.outputs.COMMIT_MAIN }} + COMMIT_CLI_HASH: ${{ steps.fetch-latest-release.outputs.COMMIT_CLI }} PATH: ${{ steps.setup-flatcar-sdk.outputs.path }} run: .github/workflows/docker-apply-patch.sh - name: Create pull request for main diff --git a/sdk_container/src/third_party/coreos-overlay/.github/workflows/runc-apply-patch.sh b/sdk_container/src/third_party/coreos-overlay/.github/workflows/runc-apply-patch.sh index a4a955053e..20435faba7 100755 --- a/sdk_container/src/third_party/coreos-overlay/.github/workflows/runc-apply-patch.sh +++ b/sdk_container/src/third_party/coreos-overlay/.github/workflows/runc-apply-patch.sh @@ -36,7 +36,6 @@ VERSION_NEW_HYPHEN=${VERSION_NEW//_/-} sed -i "s/${VERSION_OLD_HYPHEN}/${VERSION_NEW_HYPHEN}/g" ${runcEbuildNew} # update also runc versions used by docker and containerd -sed -i "s/docker-runc-${VERSION_OLD}/docker-runc-${VERSION_NEW}/g" app-emulation/docker/docker-9999.ebuild sed -i "s/docker-runc-${VERSION_OLD}/docker-runc-${VERSION_NEW}/g" app-emulation/containerd/containerd-9999.ebuild dockerVersion=$(sed -n "s/^DIST docker-\([0-9]*.[0-9]*.[0-9]*\).*/\1/p" app-emulation/docker/Manifest | sort -ruV | head -n1)