From 87bfe5e89ec947853cc747ef56022dd8faf3805a Mon Sep 17 00:00:00 2001 From: James Le Cuirot Date: Thu, 17 Sep 2026 17:42:43 +0100 Subject: [PATCH 1/2] .github: Replace workflow for portage-stable with gentoo submodule one This repoints the gentoo submodule to the latest without actually cloning it. The latest is determined with `git ls-remote`. A PR is still created, but an existing open PR is reused to prevent these from accumulating now that the job is run every weekday. A Jenkins build is automatically triggered by the PR. Signed-off-by: James Le Cuirot --- ...ate-portage-stable-packages-from-list.yaml | 117 ++++++------------ .gitmodules | 1 + 2 files changed, 40 insertions(+), 78 deletions(-) diff --git a/.github/workflows/update-portage-stable-packages-from-list.yaml b/.github/workflows/update-portage-stable-packages-from-list.yaml index 044b77af865..e6e8d167b43 100644 --- a/.github/workflows/update-portage-stable-packages-from-list.yaml +++ b/.github/workflows/update-portage-stable-packages-from-list.yaml @@ -1,92 +1,53 @@ -name: Keep portage-stable packages updated +name: Keep Gentoo submodule updated on: schedule: - - cron: '0 7 * * 1' + - cron: '0 4 * * 0-4' workflow_dispatch: jobs: - keep-packages-updated: + keep-gentoo-updated: runs-on: ubuntu-latest steps: - name: Check out scripts - uses: actions/checkout@v4 + uses: actions/checkout@v7 with: - token: ${{ secrets.GITHUB_TOKEN }} - path: ./scripts - - name: Check out Gentoo - uses: actions/checkout@v4 - with: - repository: gentoo/gentoo - path: gentoo - # Gentoo is quite a large repo, so limit ourselves to last - # quarter milion of commits. It is about two years worth of changes. - # Is is needed by the sync script to find out the hash of the last commit - # that made the changes to the package. - fetch-depth: 250000 - ref: master - - name: Check out build scripts - uses: actions/checkout@v4 - with: - repository: flatcar/flatcar-build-scripts - path: flatcar-build-scripts - - name: Update listed packages - id: update-listed-packages + token: ${{ secrets.BOT_PR_TOKEN }} + path: scripts + sparse-checkout: | + .gitmodules + .github/workflows/common.sh + sparse-checkout-cone-mode: false + - name: Update Gentoo submodule + id: update-gentoo + env: + WORK_SCRIPTS_DIR: "${{ github.workspace }}/scripts" run: | - git config --global user.name "Flatcar Buildbot" - git config --global user.email "buildbot@flatcar-linux.org" - old_head=$(git -C scripts rev-parse HEAD) - packages_list=$(realpath scripts/.github/workflows/portage-stable-packages-list) - gentoo_repo=$(realpath gentoo) - build_scripts=$(realpath flatcar-build-scripts) - pushd scripts/sdk_container/src/third_party/portage-stable - while read -r package; do - if [[ ! -e "${package}" ]]; then - # If this happens, it means that the package was moved to overlay - # or dropped, the list ought to be updated. - echo "::warning title=${package}::Nonexistent package" - continue - fi - if [[ ! -e "${gentoo_repo}/${package}" ]]; then - # If this happens, it means that the package was obsoleted or moved - # in Gentoo. The obsoletion needs to be handled in the case-by-case - # manner, while move should be handled by doing the same move - # in portage-stable. The build should not break because of the move, - # because most likely it's already reflected in the profiles/updates - # directory. - echo "::warning title=${package}::Obsolete or moved package" - continue - fi - GENTOO_REPO="${gentoo_repo}" "${build_scripts}/sync-with-gentoo" "${package}" - done < <(grep '^[^#]' "${packages_list}") - popd - new_head=$(git -C scripts rev-parse HEAD) - updated=0 - if [[ "${new_head}" != "${old_head}" ]]; then - updated=1 + set -euo pipefail + source scripts/.github/workflows/common.sh + prepare_git_repo + submodule=sdk_container/src/third_party/gentoo + url=$(git -C "${WORK_SCRIPTS_DIR}" config --file .gitmodules --get "submodule.${submodule}.url") + branch=$(git -C "${WORK_SCRIPTS_DIR}" config --file .gitmodules --get "submodule.${submodule}.branch") + read -r latest_commit _ < <(git ls-remote --exit-code "${url}" "refs/heads/${branch}") + short_commit=${latest_commit:0:12} + git -C "${WORK_SCRIPTS_DIR}" update-index --cacheinfo "160000,${latest_commit},${submodule}" + if git -C "${WORK_SCRIPTS_DIR}" diff --cached --quiet -- "${submodule}"; then + echo 'UPDATE_NEEDED=0' >>"${GITHUB_OUTPUT}" + exit 0 fi - todaydate=$(date +%Y-%m-%d) - echo "UPDATED=${updated}" >>"${GITHUB_OUTPUT}" - echo "TODAYDATE=${todaydate}" >>"${GITHUB_OUTPUT}" - - name: Create pull request for main branch - uses: peter-evans/create-pull-request@v6 - if: steps.update-listed-packages.outputs.UPDATED == 1 + git -C "${WORK_SCRIPTS_DIR}" commit --signoff -m "gentoo: Update to ${short_commit}" + cleanup_repo + echo 'UPDATE_NEEDED=1' >>"${GITHUB_OUTPUT}" + echo "LATEST_COMMIT=${latest_commit}" >>"${GITHUB_OUTPUT}" + echo "SHORT_COMMIT=${short_commit}" >>"${GITHUB_OUTPUT}" + - name: Create pull request + uses: peter-evans/create-pull-request@v8 + if: steps.update-gentoo.outputs.UPDATE_NEEDED == 1 with: - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.BOT_PR_TOKEN }} path: scripts - branch: buildbot/weekly-portage-stable-package-updates-${{steps.update-listed-packages.outputs.TODAYDATE }} + branch: buildbot/update-gentoo-submodule delete-branch: true - base: main - title: Weekly portage-stable package updates ${{steps.update-listed-packages.outputs.TODAYDATE }} - body: | - CI: TODO - - -- - - TODO: Changes. - - -- - - - [ ] changelog - - [ ] image diff - labels: main - draft: true + title: Update gentoo submodule to ${{ steps.update-gentoo.outputs.SHORT_COMMIT }} + body: Update `sdk_container/src/third_party/gentoo` to flatcar-hub/gentoo@${{ steps.update-gentoo.outputs.LATEST_COMMIT }}. + labels: auto-ci,auto-jenkins,main diff --git a/.gitmodules b/.gitmodules index 73da0835763..cfedcf70075 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,4 +1,5 @@ [submodule "sdk_container/src/third_party/gentoo"] path = sdk_container/src/third_party/gentoo url = https://github.com/flatcar-hub/gentoo.git + branch = master shallow = true From 6741729b6a1c4542bad19d6ecd60451a7ca22678 Mon Sep 17 00:00:00 2001 From: Flatcar Buildbot Date: Thu, 17 Sep 2026 17:27:42 +0000 Subject: [PATCH 2/2] gentoo: Update to be864fdabad8 Signed-off-by: Flatcar Buildbot --- sdk_container/src/third_party/gentoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk_container/src/third_party/gentoo b/sdk_container/src/third_party/gentoo index 26848107409..be864fdabad 160000 --- a/sdk_container/src/third_party/gentoo +++ b/sdk_container/src/third_party/gentoo @@ -1 +1 @@ -Subproject commit 26848107409f08ee79da713b24ec322c4b00a9b4 +Subproject commit be864fdabad8d28585e315ed0b6c3d2a43b4bfa9