Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade repository-base module #52

Merged
merged 1 commit into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -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: ["*"]
30 changes: 17 additions & 13 deletions .github/workflows/make-self-upgrade.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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'),
Expand Down
2 changes: 1 addition & 1 deletion klone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions make/_shared/repository-base/01_mod.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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: ["*"]
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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'),
Expand Down