From 62c7d061038b7924115ea2f807f9c231fe34f24d Mon Sep 17 00:00:00 2001 From: Dongsu Park Date: Fri, 13 Mar 2020 12:53:20 +0100 Subject: [PATCH 1/4] .github: add Github actions for virtual/rust Whenever a new upstream Rust release appears, a Github workflow in `coreos-overlay` creates a new pull request for `dev-lang/rust`. At the same time, it sends a repository dispatch event to portage-stable, so it also creates a pull request for `virtual/rust`. --- .../.github/workflows/rust-apply-patch.sh | 13 +++++++ .../workflows/rust-pull-request-alpha.yml | 37 +++++++++++++++++++ .../workflows/rust-pull-request-edge.yml | 37 +++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100755 sdk_container/src/third_party/portage-stable/.github/workflows/rust-apply-patch.sh create mode 100644 sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml create mode 100644 sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-edge.yml diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-apply-patch.sh b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-apply-patch.sh new file mode 100755 index 0000000000..754462d6ac --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-apply-patch.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +set -euo pipefail + +git fetch origin +git checkout -B "${BASE_BRANCH}" "origin/${BASE_BRANCH}" + +pushd "virtual/rust" >/dev/null || exit +VERSION_OLD=$(ls -1 rust-*.ebuild | sed -n "s/rust-\(1.[0-9]*.[0-9]*\).ebuild/\1/p" | sort -ruV | head -n1) +git mv rust-${VERSION_OLD}.ebuild "rust-${VERSION_NEW}.ebuild" +popd >/dev/null || exit + +echo ::set-output name=VERSION_OLD::"${VERSION_OLD}" diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml new file mode 100644 index 0000000000..b42c3ff1e2 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml @@ -0,0 +1,37 @@ +on: + repository_dispatch: + types: [cargo-pull-request-alpha] + +jobs: + flatcar-rust-prs: + runs-on: ubuntu-latest + env: + GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" + steps: + - uses: actions/checkout@v2 + - name: Fetch latest Cargo release + id: fetch-latest-release + run: | + git clone --depth=1 --no-checkout https://github.com/rust-lang/rust + versionAlpha=$(git -C rust ls-remote --tags origin | cut -f2 | sed -n "/refs\/tags\/1.[0-9]*.[0-9]*$/s/^refs\/tags\///p" | sort -ruV | head -n1) + rm -rf rust + echo ::set-output name=VERSION_ALPHA::$(echo ${versionAlpha}) + echo ::set-output name=BASE_BRANCH_ALPHA::flatcar-master-alpha + - name: Apply patch for Alpha + id: apply-patch-alpha + env: + BASE_BRANCH: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_ALPHA }} + VERSION_NEW: ${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }} + run: .github/workflows/rust-apply-patch.sh + - name: Create pull request for Alpha + uses: peter-evans/create-pull-request@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + base: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_ALPHA }} + branch: rust-${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }}-alpha + author: Flatcar Buildbot + committer: Flatcar Buildbot + title: Upgrade Cargo in Alpha from ${{ steps.apply-patch-alpha.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }} + commit-message: Upgrade Cargo in Alpha from ${{ steps.apply-patch-alpha.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }} + body: Upgrade Cargo in Alpha from ${{ steps.apply-patch-alpha.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }} + labels: alpha diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-edge.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-edge.yml new file mode 100644 index 0000000000..372ab64893 --- /dev/null +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-edge.yml @@ -0,0 +1,37 @@ +on: + repository_dispatch: + types: [cargo-pull-request-edge] + +jobs: + flatcar-rust-prs: + runs-on: ubuntu-latest + env: + GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" + steps: + - uses: actions/checkout@v2 + - name: Fetch latest Cargo release + id: fetch-latest-release + run: | + git clone --depth=1 --no-checkout https://github.com/rust-lang/rust + versionEdge=$(git -C rust ls-remote --tags origin | cut -f2 | sed -n "/refs\/tags\/1.[0-9]*.[0-9]*$/s/^refs\/tags\///p" | sort -ruV | head -n1) + rm -rf rust + echo ::set-output name=VERSION_EDGE::$(echo ${versionEdge}) + echo ::set-output name=BASE_BRANCH_EDGE::flatcar-master-edge + - name: Apply patch for Edge + id: apply-patch-edge + env: + BASE_BRANCH: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_EDGE }} + VERSION_NEW: ${{ steps.fetch-latest-release.outputs.VERSION_EDGE }} + run: .github/workflows/rust-apply-patch.sh + - name: Create pull request for Edge + uses: peter-evans/create-pull-request@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + base: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_EDGE }} + branch: rust-${{ steps.fetch-latest-release.outputs.VERSION_EDGE }}-edge + author: Flatcar Buildbot + committer: Flatcar Buildbot + title: Upgrade Cargo in Edge from ${{ steps.apply-patch-edge.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_EDGE }} + commit-message: Upgrade Cargo in Edge from ${{ steps.apply-patch-edge.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_EDGE }} + body: Upgrade Cargo in Edge from ${{ steps.apply-patch-edge.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_EDGE }} + labels: edge From bdc2dc8405ede5192dd86acb5a529e2e78a2c9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Thu, 23 Jul 2020 18:38:55 +0200 Subject: [PATCH 2/4] .github: Use new main branch --- .../.github/workflows/rust-pull-request-alpha.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml index b42c3ff1e2..2d4f941727 100644 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml @@ -16,7 +16,7 @@ jobs: versionAlpha=$(git -C rust ls-remote --tags origin | cut -f2 | sed -n "/refs\/tags\/1.[0-9]*.[0-9]*$/s/^refs\/tags\///p" | sort -ruV | head -n1) rm -rf rust echo ::set-output name=VERSION_ALPHA::$(echo ${versionAlpha}) - echo ::set-output name=BASE_BRANCH_ALPHA::flatcar-master-alpha + echo ::set-output name=BASE_BRANCH_ALPHA::main - name: Apply patch for Alpha id: apply-patch-alpha env: From 042515d58fb4ccee491383bad7577c6d3aa5ac26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Fri, 24 Jul 2020 11:10:42 +0200 Subject: [PATCH 3/4] .github: Only update the new main branch The new main branch is the only branch that should get new software updates (with the exception of the maintenance branches that get kernel updates). --- .../workflows/rust-pull-request-alpha.yml | 37 ------------------- ...st-edge.yml => rust-pull-request-main.yml} | 30 +++++++-------- 2 files changed, 15 insertions(+), 52 deletions(-) delete mode 100644 sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml rename sdk_container/src/third_party/portage-stable/.github/workflows/{rust-pull-request-edge.yml => rust-pull-request-main.yml} (53%) diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml deleted file mode 100644 index 2d4f941727..0000000000 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-alpha.yml +++ /dev/null @@ -1,37 +0,0 @@ -on: - repository_dispatch: - types: [cargo-pull-request-alpha] - -jobs: - flatcar-rust-prs: - runs-on: ubuntu-latest - env: - GIT_SSH_COMMAND: "ssh -o StrictHostKeyChecking=no" - steps: - - uses: actions/checkout@v2 - - name: Fetch latest Cargo release - id: fetch-latest-release - run: | - git clone --depth=1 --no-checkout https://github.com/rust-lang/rust - versionAlpha=$(git -C rust ls-remote --tags origin | cut -f2 | sed -n "/refs\/tags\/1.[0-9]*.[0-9]*$/s/^refs\/tags\///p" | sort -ruV | head -n1) - rm -rf rust - echo ::set-output name=VERSION_ALPHA::$(echo ${versionAlpha}) - echo ::set-output name=BASE_BRANCH_ALPHA::main - - name: Apply patch for Alpha - id: apply-patch-alpha - env: - BASE_BRANCH: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_ALPHA }} - VERSION_NEW: ${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }} - run: .github/workflows/rust-apply-patch.sh - - name: Create pull request for Alpha - uses: peter-evans/create-pull-request@v2 - with: - token: ${{ secrets.GITHUB_TOKEN }} - base: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_ALPHA }} - branch: rust-${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }}-alpha - author: Flatcar Buildbot - committer: Flatcar Buildbot - title: Upgrade Cargo in Alpha from ${{ steps.apply-patch-alpha.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }} - commit-message: Upgrade Cargo in Alpha from ${{ steps.apply-patch-alpha.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }} - body: Upgrade Cargo in Alpha from ${{ steps.apply-patch-alpha.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_ALPHA }} - labels: alpha diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-edge.yml b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-main.yml similarity index 53% rename from sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-edge.yml rename to sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-main.yml index 372ab64893..109301491f 100644 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-edge.yml +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-pull-request-main.yml @@ -1,6 +1,6 @@ on: repository_dispatch: - types: [cargo-pull-request-edge] + types: [cargo-pull-request-main] jobs: flatcar-rust-prs: @@ -13,25 +13,25 @@ jobs: id: fetch-latest-release run: | git clone --depth=1 --no-checkout https://github.com/rust-lang/rust - versionEdge=$(git -C rust ls-remote --tags origin | cut -f2 | sed -n "/refs\/tags\/1.[0-9]*.[0-9]*$/s/^refs\/tags\///p" | sort -ruV | head -n1) + versionMain=$(git -C rust ls-remote --tags origin | cut -f2 | sed -n "/refs\/tags\/1.[0-9]*.[0-9]*$/s/^refs\/tags\///p" | sort -ruV | head -n1) rm -rf rust - echo ::set-output name=VERSION_EDGE::$(echo ${versionEdge}) - echo ::set-output name=BASE_BRANCH_EDGE::flatcar-master-edge - - name: Apply patch for Edge - id: apply-patch-edge + echo ::set-output name=VERSION_MAIN::$(echo ${versionMain}) + echo ::set-output name=BASE_BRANCH_MAIN::main + - name: Apply patch for main + id: apply-patch-main env: - BASE_BRANCH: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_EDGE }} - VERSION_NEW: ${{ steps.fetch-latest-release.outputs.VERSION_EDGE }} + BASE_BRANCH: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_MAIN }} + VERSION_NEW: ${{ steps.fetch-latest-release.outputs.VERSION_MAIN }} run: .github/workflows/rust-apply-patch.sh - - name: Create pull request for Edge + - name: Create pull request for main uses: peter-evans/create-pull-request@v2 with: token: ${{ secrets.GITHUB_TOKEN }} - base: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_EDGE }} - branch: rust-${{ steps.fetch-latest-release.outputs.VERSION_EDGE }}-edge + base: ${{ steps.fetch-latest-release.outputs.BASE_BRANCH_MAIN }} + branch: rust-${{ steps.fetch-latest-release.outputs.VERSION_MAIN }}-main author: Flatcar Buildbot committer: Flatcar Buildbot - title: Upgrade Cargo in Edge from ${{ steps.apply-patch-edge.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_EDGE }} - commit-message: Upgrade Cargo in Edge from ${{ steps.apply-patch-edge.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_EDGE }} - body: Upgrade Cargo in Edge from ${{ steps.apply-patch-edge.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_EDGE }} - labels: edge + title: Upgrade Cargo in main from ${{ steps.apply-patch-main.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_MAIN }} + commit-message: Upgrade Cargo in main from ${{ steps.apply-patch-main.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_MAIN }} + body: Upgrade Cargo in main from ${{ steps.apply-patch-main.outputs.VERSION_OLD }} to ${{ steps.fetch-latest-release.outputs.VERSION_MAIN }} + labels: main From 7411de99f34feb8c5b3c1e0bb8fc2eb09483dc37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20L=C3=BCke?= Date: Fri, 24 Jul 2020 11:15:26 +0200 Subject: [PATCH 4/4] .github: Give background on Rust updates --- .../portage-stable/.github/workflows/rust-apply-patch.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-apply-patch.sh b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-apply-patch.sh index 754462d6ac..8a58ff9e71 100755 --- a/sdk_container/src/third_party/portage-stable/.github/workflows/rust-apply-patch.sh +++ b/sdk_container/src/third_party/portage-stable/.github/workflows/rust-apply-patch.sh @@ -8,6 +8,9 @@ git checkout -B "${BASE_BRANCH}" "origin/${BASE_BRANCH}" pushd "virtual/rust" >/dev/null || exit VERSION_OLD=$(ls -1 rust-*.ebuild | sed -n "s/rust-\(1.[0-9]*.[0-9]*\).ebuild/\1/p" | sort -ruV | head -n1) git mv rust-${VERSION_OLD}.ebuild "rust-${VERSION_NEW}.ebuild" +# For a complete update we would need to download the upstream ebuild and apply our crossdev patch. +# Automating this is not done yet and maybe would not work well either and had the same result as just renaming +# which we did here and has the same effect for minor updates that do not touch the ebuild logic. popd >/dev/null || exit echo ::set-output name=VERSION_OLD::"${VERSION_OLD}"