Skip to content

Commit 76d3001

Browse files
authored
Merge pull request #32 from inteon/upgrade_makefiles
Upgrade makefile modules
2 parents 8f087bb + d687822 commit 76d3001

File tree

36 files changed

+1246
-930
lines changed

36 files changed

+1246
-930
lines changed

.github/dependabot.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
# THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
22
# Edit https://github.com/cert-manager/makefile-modules/blob/main/modules/repository-base/base/.github/dependabot.yaml instead.
33

4-
# Update Go dependencies and GitHub Actions dependencies weekly.
4+
# Update Go dependencies and GitHub Actions dependencies daily.
55
version: 2
66
updates:
77
- package-ecosystem: gomod
88
directory: /
99
schedule:
10-
interval: weekly
10+
interval: daily
1111
groups:
1212
all:
1313
patterns: ["*"]
1414
- package-ecosystem: github-actions
1515
directory: /
1616
schedule:
17-
interval: weekly
17+
interval: daily
1818
groups:
1919
all:
2020
patterns: ["*"]

.github/workflows/govulncheck.yaml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
2+
# Edit https://github.com/cert-manager/makefile-modules/blob/main/modules/go/base/.github/workflows/govulncheck.yaml instead.
3+
4+
# Run govulncheck at midnight every night on the main branch,
5+
# to alert us to recent vulnerabilities which affect the Go code in this
6+
# project.
7+
name: govulncheck
8+
on:
9+
workflow_dispatch: {}
10+
schedule:
11+
- cron: '0 0 * * *'
12+
13+
jobs:
14+
govulncheck:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- id: go-version
21+
run: |
22+
make print-go-version >> "$GITHUB_OUTPUT"
23+
24+
- uses: actions/setup-go@v5
25+
with:
26+
go-version: ${{ steps.go-version.outputs.result }}
27+
28+
- run: make verify-govulncheck

.github/workflows/make-self-upgrade.yaml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,22 @@ on:
99
- cron: '0 0 * * *'
1010

1111
jobs:
12-
build_images:
12+
self_upgrade:
1313
runs-on: ubuntu-latest
1414

1515
permissions:
1616
contents: write
1717
pull-requests: write
18+
19+
env:
20+
SOURCE_BRANCH: "${{ github.ref_name }}"
21+
SELF_UPGRADE_BRANCH: "self-upgrade-${{ github.ref_name }}"
1822

1923
steps:
20-
- name: Fail if branch is not main
21-
if: github.ref != 'refs/heads/main'
24+
- name: Fail if branch is not head of branch.
25+
if: ${{ !startsWith(github.ref, 'refs/heads/') && env.SOURCE_BRANCH != '' && env.SELF_UPGRADE_BRANCH != '' }}
2226
run: |
23-
echo "This workflow should not be run on a branch other than main."
27+
echo "This workflow should not be run on a non-branch-head."
2428
exit 1
2529
2630
- uses: actions/checkout@v4
@@ -34,7 +38,7 @@ jobs:
3438
go-version: ${{ steps.go-version.outputs.result }}
3539

3640
- run: |
37-
git checkout -B "self-upgrade"
41+
git checkout -B "$SELF_UPGRADE_BRANCH"
3842
3943
- run: |
4044
make -j upgrade-klone
@@ -54,10 +58,10 @@ jobs:
5458
5559
- if: ${{ steps.is-up-to-date.outputs.result != 'true' }}
5660
run: |
57-
git config --global user.name "jetstack-bot"
58-
git config --global user.email "jetstack[email protected]"
61+
git config --global user.name "cert-manager-bot"
62+
git config --global user.email "cert-manager[email protected]"
5963
git add -A && git commit -m "BOT: run 'make upgrade-klone' and 'make generate'" --signoff
60-
git push -f origin self-upgrade
64+
git push -f origin "$SELF_UPGRADE_BRANCH"
6165
6266
- if: ${{ steps.is-up-to-date.outputs.result != 'true' }}
6367
uses: actions/github-script@v7
@@ -67,18 +71,18 @@ jobs:
6771
const pulls = await github.rest.pulls.list({
6872
owner: owner,
6973
repo: repo,
70-
head: owner + ':self-upgrade',
71-
base: 'main',
74+
head: owner + ':' + process.env.SELF_UPGRADE_BRANCH,
75+
base: process.env.SOURCE_BRANCH,
7276
state: 'open',
7377
});
7478
7579
if (pulls.data.length < 1) {
7680
await github.rest.pulls.create({
77-
title: '[CI] Merge self-upgrade into main',
81+
title: '[CI] Merge ' + process.env.SELF_UPGRADE_BRANCH + ' into ' + process.env.SOURCE_BRANCH,
7882
owner: owner,
7983
repo: repo,
80-
head: 'self-upgrade',
81-
base: 'main',
84+
head: process.env.SELF_UPGRADE_BRANCH,
85+
base: process.env.SOURCE_BRANCH,
8286
body: [
8387
'This PR is auto-generated to bump the Makefile modules.',
8488
].join('\n'),

.github/workflows/release.yaml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,24 @@ env:
88
VERSION: ${{ github.ref_name }}
99

1010
jobs:
11-
github_release:
11+
build_images:
1212
runs-on: ubuntu-latest
1313

1414
permissions:
15-
contents: write # needed for creating a PR
16-
pull-requests: write # needed for creating a PR
15+
contents: write # needed to write releases
16+
id-token: write # needed for keyless signing
1717

1818
steps:
19+
- uses: actions/checkout@v4
20+
21+
- id: go-version
22+
run: |
23+
make print-go-version >> "$GITHUB_OUTPUT"
24+
25+
- uses: actions/setup-go@v5
26+
with:
27+
go-version: ${{ steps.go-version.outputs.result }}
28+
1929
- env:
2030
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
21-
run: |
22-
gh release create "$VERSION" \
23-
--repo="$GITHUB_REPOSITORY" \
24-
--title="${VERSION}" \
25-
--draft \
26-
--verify-tag
31+
run: make release

.golangci.yaml

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
issues:
2+
exclude-rules:
3+
- linters:
4+
- errcheck
5+
- forbidigo
6+
- gci
7+
- gocritic
8+
- exhaustive
9+
- nilnil
10+
text: ".*"
11+
linters:
12+
# Explicitly define all enabled linters
13+
disable-all: true
14+
enable:
15+
- asasalint
16+
- asciicheck
17+
- bidichk
18+
- bodyclose
19+
- contextcheck
20+
- decorder
21+
- dogsled
22+
- dupword
23+
- durationcheck
24+
- errcheck
25+
- errchkjson
26+
- errname
27+
- execinquery
28+
- exhaustive
29+
- exportloopref
30+
- forbidigo
31+
- gci
32+
- ginkgolinter
33+
- gocheckcompilerdirectives
34+
- gochecksumtype
35+
- gocritic
36+
- gofmt
37+
- goheader
38+
- goprintffuncname
39+
- gosec
40+
- gosimple
41+
- gosmopolitan
42+
- govet
43+
- grouper
44+
- importas
45+
- ineffassign
46+
- interfacebloat
47+
- loggercheck
48+
- makezero
49+
- mirror
50+
- misspell
51+
- musttag
52+
- nakedret
53+
- nilerr
54+
- nilnil
55+
- noctx
56+
- nosprintfhostport
57+
- predeclared
58+
- promlinter
59+
- protogetter
60+
- reassign
61+
- sloglint
62+
- staticcheck
63+
- tagalign
64+
- tenv
65+
- testableexamples
66+
- typecheck
67+
- unconvert
68+
- unparam
69+
- unused
70+
- usestdlibvars
71+
- wastedassign
72+
linters-settings:
73+
gci:
74+
sections:
75+
- standard # Standard section: captures all standard packages.
76+
- default # Default section: contains all imports that could not be matched to another section type.
77+
- prefix(github.com/cert-manager/helm-tool) # Custom section: groups all imports with the specified Prefix.
78+
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
79+
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.

.goreleaser.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Our Makefile will automatically add additional settings
2+
# to this builds array (environment variables, flags, ...)
3+
builds:
4+
- id: helm-tool
5+
6+
# config the checksum filename
7+
# https://goreleaser.com/customization/checksum
8+
checksum:
9+
name_template: 'checksums.txt'
10+
11+
# creates SBOMs of all archives and the source tarball using syft
12+
# https://goreleaser.com/customization/sbom
13+
sboms:
14+
- artifacts: binary
15+
documents:
16+
- "{{ .ArtifactName }}{{ .ArtifactExt }}.spdx.sbom"
17+
18+
# signs the checksum file
19+
# all files (including the sboms) are included in the checksum, so we don't need to sign each one if we don't want to
20+
# https://goreleaser.com/customization/sign
21+
signs:
22+
- cmd: cosign
23+
signature: "${artifact}.cosign.bundle"
24+
env:
25+
- COSIGN_EXPERIMENTAL=1
26+
args:
27+
- sign-blob
28+
- '--bundle=${signature}'
29+
- '${artifact}'
30+
- "--yes" # needed on cosign 2.0.0+
31+
artifacts: checksum
32+
output: true
33+
34+
archives:
35+
- name_template: "{{ .Binary }}_{{ .Os }}_{{ .Arch }}"
36+
format: binary
37+
38+
release:
39+
draft: true
40+
make_latest: false

Makefile

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@
2929

3030
##################################
3131

32+
# Some modules build their dependencies from variables, we want these to be
33+
# evalutated at the last possible moment. For this we use second expansion to
34+
# re-evaluate the generate and verify targets a second time.
35+
#
36+
# See https://www.gnu.org/software/make/manual/html_node/Secondary-Expansion.html
37+
.SECONDEXPANSION:
38+
39+
# For details on some of these "prelude" settings, see:
40+
# https://clarkgrubb.com/makefile-style-guide
3241
MAKEFLAGS += --warn-undefined-variables --no-builtin-rules
3342
SHELL := /usr/bin/env bash
3443
.SHELLFLAGS := -uo pipefail -c
@@ -39,6 +48,10 @@ FORCE:
3948

4049
noop: # do nothing
4150

51+
# Set empty value for MAKECMDGOALS to prevent the "warning: undefined variable 'MAKECMDGOALS'"
52+
# warning from happening when running make without arguments
53+
MAKECMDGOALS ?=
54+
4255
##################################
4356
# Host OS and architecture setup #
4457
##################################
@@ -47,8 +60,10 @@ noop: # do nothing
4760
# binary may not be available in the PATH yet when the Makefiles are
4861
# evaluated. HOST_OS and HOST_ARCH only support Linux, *BSD and macOS (M1
4962
# and Intel).
50-
HOST_OS ?= $(shell uname -s | tr A-Z a-z)
51-
HOST_ARCH ?= $(shell uname -m)
63+
host_os := $(shell uname -s | tr A-Z a-z)
64+
host_arch := $(shell uname -m)
65+
HOST_OS ?= $(host_os)
66+
HOST_ARCH ?= $(host_arch)
5267

5368
ifeq (x86_64, $(HOST_ARCH))
5469
HOST_ARCH = amd64
@@ -61,7 +76,8 @@ endif
6176
# Git and versioning information #
6277
##################################
6378

64-
VERSION ?= $(shell git describe --tags --always --match='v*' --abbrev=14 --dirty)
79+
git_version := $(shell git describe --tags --always --match='v*' --abbrev=14 --dirty)
80+
VERSION ?= $(git_version)
6581
IS_PRERELEASE := $(shell git describe --tags --always --match='v*' --abbrev=0 | grep -q '-' && echo true || echo false)
6682
GITCOMMIT := $(shell git rev-parse HEAD)
6783
GITEPOCH := $(shell git show -s --format=%ct HEAD)

OWNERS

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,4 @@
11
approvers:
2-
- munnerz
3-
- joshvanl
4-
- wallrj
5-
- jakexks
6-
- maelvls
7-
- irbekrm
8-
- sgtcodfish
9-
- inteon
10-
- thatsmrtalbot
2+
- cm-maintainers
113
reviewers:
12-
- munnerz
13-
- joshvanl
14-
- wallrj
15-
- jakexks
16-
- maelvls
17-
- irbekrm
18-
- sgtcodfish
19-
- inteon
20-
- thatsmrtalbot
4+
- cm-maintainers

OWNERS_ALIASES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ aliases:
1111
- irbekrm
1212
- sgtcodfish
1313
- inteon
14+
- thatsmrtalbot

0 commit comments

Comments
 (0)