From e5563f47e58eaf9e8ff387ae8be6a14a0706ca0a Mon Sep 17 00:00:00 2001 From: Tim Ramlot <42113979+inteon@users.noreply.github.com> Date: Mon, 22 Apr 2024 16:21:48 +0200 Subject: [PATCH] bump sha, run 'make generate-klone' and run 'make generate-base' Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com> --- .github/dependabot.yaml | 6 ++-- .github/workflows/make-self-upgrade.yaml | 30 +++++++++++-------- klone.yaml | 2 +- make/_shared/repository-base/01_mod.mk | 10 +++++++ .../.github/dependabot.yaml | 6 ++-- .../.github/workflows/make-self-upgrade.yaml | 30 +++++++++++-------- 6 files changed, 51 insertions(+), 33 deletions(-) rename make/_shared/repository-base/{base => base-dependabot}/.github/dependabot.yaml (78%) diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml index 35367ea..81b9297 100644 --- a/.github/dependabot.yaml +++ b/.github/dependabot.yaml @@ -1,20 +1,20 @@ # THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. # Edit https://github.com/cert-manager/makefile-modules/blob/main/modules/repository-base/base/.github/dependabot.yaml instead. -# Update Go dependencies and GitHub Actions dependencies weekly. +# Update Go dependencies and GitHub Actions dependencies daily. version: 2 updates: - package-ecosystem: gomod directory: / schedule: - interval: weekly + interval: daily groups: all: patterns: ["*"] - package-ecosystem: github-actions directory: / schedule: - interval: weekly + interval: daily groups: all: patterns: ["*"] diff --git a/.github/workflows/make-self-upgrade.yaml b/.github/workflows/make-self-upgrade.yaml index ccebdb2..93beedf 100644 --- a/.github/workflows/make-self-upgrade.yaml +++ b/.github/workflows/make-self-upgrade.yaml @@ -9,18 +9,22 @@ on: - cron: '0 0 * * *' jobs: - build_images: + self_upgrade: runs-on: ubuntu-latest permissions: contents: write pull-requests: write + + env: + SOURCE_BRANCH: "${{ github.ref_name }}" + SELF_UPGRADE_BRANCH: "self-upgrade-${{ github.ref_name }}" steps: - - name: Fail if branch is not main - if: github.ref != 'refs/heads/main' + - name: Fail if branch is not head of branch. + if: ${{ !startsWith(github.ref, 'refs/heads/') && env.SOURCE_BRANCH != '' && env.SELF_UPGRADE_BRANCH != '' }} run: | - echo "This workflow should not be run on a branch other than main." + echo "This workflow should not be run on a non-branch-head." exit 1 - uses: actions/checkout@v4 @@ -34,7 +38,7 @@ jobs: go-version: ${{ steps.go-version.outputs.result }} - run: | - git checkout -B "self-upgrade" + git checkout -B "$SELF_UPGRADE_BRANCH" - run: | make -j upgrade-klone @@ -54,10 +58,10 @@ jobs: - if: ${{ steps.is-up-to-date.outputs.result != 'true' }} run: | - git config --global user.name "jetstack-bot" - git config --global user.email "jetstack-bot@users.noreply.github.com" + git config --global user.name "cert-manager-bot" + git config --global user.email "cert-manager-bot@users.noreply.github.com" git add -A && git commit -m "BOT: run 'make upgrade-klone' and 'make generate'" --signoff - git push -f origin self-upgrade + git push -f origin "$SELF_UPGRADE_BRANCH" - if: ${{ steps.is-up-to-date.outputs.result != 'true' }} uses: actions/github-script@v7 @@ -67,18 +71,18 @@ jobs: const pulls = await github.rest.pulls.list({ owner: owner, repo: repo, - head: owner + ':self-upgrade', - base: 'main', + head: owner + ':' + process.env.SELF_UPGRADE_BRANCH, + base: process.env.SOURCE_BRANCH, state: 'open', }); if (pulls.data.length < 1) { await github.rest.pulls.create({ - title: '[CI] Merge self-upgrade into main', + title: '[CI] Merge ' + process.env.SELF_UPGRADE_BRANCH + ' into ' + process.env.SOURCE_BRANCH, owner: owner, repo: repo, - head: 'self-upgrade', - base: 'main', + head: process.env.SELF_UPGRADE_BRANCH, + base: process.env.SOURCE_BRANCH, body: [ 'This PR is auto-generated to bump the Makefile modules.', ].join('\n'), diff --git a/klone.yaml b/klone.yaml index d0868e1..f4aac2b 100644 --- a/klone.yaml +++ b/klone.yaml @@ -45,7 +45,7 @@ targets: - folder_name: repository-base repo_url: https://github.com/cert-manager/makefile-modules.git repo_ref: main - repo_hash: fa9c9274d1d852de501461b9442f7206aaf74007 + repo_hash: e9363accaaee20a995bbf8f1c9cba2ea77da8935 repo_path: modules/repository-base - folder_name: tools repo_url: https://github.com/cert-manager/makefile-modules.git diff --git a/make/_shared/repository-base/01_mod.mk b/make/_shared/repository-base/01_mod.mk index 251ac88..aa6b7ee 100644 --- a/make/_shared/repository-base/01_mod.mk +++ b/make/_shared/repository-base/01_mod.mk @@ -13,11 +13,21 @@ # limitations under the License. base_dir := $(dir $(lastword $(MAKEFILE_LIST)))/base/ +base_dependabot_dir := $(dir $(lastword $(MAKEFILE_LIST)))/base-dependabot/ +ifdef repository_base_no_dependabot .PHONY: generate-base ## Generate base files in the repository ## @category [shared] Generate/ Verify generate-base: cp -r $(base_dir)/. ./ +else +.PHONY: generate-base +## Generate base files in the repository +## @category [shared] Generate/ Verify +generate-base: + cp -r $(base_dir)/. ./ + cp -r $(base_dependabot_dir)/. ./ +endif shared_generate_targets += generate-base diff --git a/make/_shared/repository-base/base/.github/dependabot.yaml b/make/_shared/repository-base/base-dependabot/.github/dependabot.yaml similarity index 78% rename from make/_shared/repository-base/base/.github/dependabot.yaml rename to make/_shared/repository-base/base-dependabot/.github/dependabot.yaml index 35367ea..81b9297 100644 --- a/make/_shared/repository-base/base/.github/dependabot.yaml +++ b/make/_shared/repository-base/base-dependabot/.github/dependabot.yaml @@ -1,20 +1,20 @@ # THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT. # Edit https://github.com/cert-manager/makefile-modules/blob/main/modules/repository-base/base/.github/dependabot.yaml instead. -# Update Go dependencies and GitHub Actions dependencies weekly. +# Update Go dependencies and GitHub Actions dependencies daily. version: 2 updates: - package-ecosystem: gomod directory: / schedule: - interval: weekly + interval: daily groups: all: patterns: ["*"] - package-ecosystem: github-actions directory: / schedule: - interval: weekly + interval: daily groups: all: patterns: ["*"] diff --git a/make/_shared/repository-base/base/.github/workflows/make-self-upgrade.yaml b/make/_shared/repository-base/base/.github/workflows/make-self-upgrade.yaml index ccebdb2..93beedf 100644 --- a/make/_shared/repository-base/base/.github/workflows/make-self-upgrade.yaml +++ b/make/_shared/repository-base/base/.github/workflows/make-self-upgrade.yaml @@ -9,18 +9,22 @@ on: - cron: '0 0 * * *' jobs: - build_images: + self_upgrade: runs-on: ubuntu-latest permissions: contents: write pull-requests: write + + env: + SOURCE_BRANCH: "${{ github.ref_name }}" + SELF_UPGRADE_BRANCH: "self-upgrade-${{ github.ref_name }}" steps: - - name: Fail if branch is not main - if: github.ref != 'refs/heads/main' + - name: Fail if branch is not head of branch. + if: ${{ !startsWith(github.ref, 'refs/heads/') && env.SOURCE_BRANCH != '' && env.SELF_UPGRADE_BRANCH != '' }} run: | - echo "This workflow should not be run on a branch other than main." + echo "This workflow should not be run on a non-branch-head." exit 1 - uses: actions/checkout@v4 @@ -34,7 +38,7 @@ jobs: go-version: ${{ steps.go-version.outputs.result }} - run: | - git checkout -B "self-upgrade" + git checkout -B "$SELF_UPGRADE_BRANCH" - run: | make -j upgrade-klone @@ -54,10 +58,10 @@ jobs: - if: ${{ steps.is-up-to-date.outputs.result != 'true' }} run: | - git config --global user.name "jetstack-bot" - git config --global user.email "jetstack-bot@users.noreply.github.com" + git config --global user.name "cert-manager-bot" + git config --global user.email "cert-manager-bot@users.noreply.github.com" git add -A && git commit -m "BOT: run 'make upgrade-klone' and 'make generate'" --signoff - git push -f origin self-upgrade + git push -f origin "$SELF_UPGRADE_BRANCH" - if: ${{ steps.is-up-to-date.outputs.result != 'true' }} uses: actions/github-script@v7 @@ -67,18 +71,18 @@ jobs: const pulls = await github.rest.pulls.list({ owner: owner, repo: repo, - head: owner + ':self-upgrade', - base: 'main', + head: owner + ':' + process.env.SELF_UPGRADE_BRANCH, + base: process.env.SOURCE_BRANCH, state: 'open', }); if (pulls.data.length < 1) { await github.rest.pulls.create({ - title: '[CI] Merge self-upgrade into main', + title: '[CI] Merge ' + process.env.SELF_UPGRADE_BRANCH + ' into ' + process.env.SOURCE_BRANCH, owner: owner, repo: repo, - head: 'self-upgrade', - base: 'main', + head: process.env.SELF_UPGRADE_BRANCH, + base: process.env.SOURCE_BRANCH, body: [ 'This PR is auto-generated to bump the Makefile modules.', ].join('\n'),