Skip to content

Commit 5e982f6

Browse files
authored
Merge pull request #77 from rafaelbreno/updatecli-patch
`updatecli` must match build base minor
2 parents 66af79a + 6ad2be7 commit 5e982f6

File tree

1 file changed

+42
-26
lines changed

1 file changed

+42
-26
lines changed

updatecli/updatecli.d/updatebuildbase.yaml

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,54 @@
22
name: "Update build base version"
33

44
sources:
5-
gomod:
6-
name: Get latest Golang version based on go.mod
7-
kind: file
5+
# Read the current version from the Dockerfile
6+
current_minor:
7+
name: Get current build base minor version from Dockerfile
8+
kind: dockerfile
89
spec:
9-
file: https://raw.githubusercontent.com/kubernetes-sigs/node-feature-discovery/master/go.mod
10-
matchpattern: 'go ([0-9]+\.[0-9]+)'
10+
file: Dockerfile
11+
instruction:
12+
keyword: ARG
13+
matcher: GO_IMAGE
1114
transformers:
12-
- trimprefix: "go "
15+
# Value is "rancher/hardened-build-base:v1.24.9b1"
16+
# Trim prefix to get "v1.24.9b1"
17+
- trimprefix: "rancher/hardened-build-base:"
18+
# Trim 'v' prefix to get "1.24.9b1"
19+
- trimprefix: "v"
20+
# This regex captures the major.minor to get "1.24"
21+
# but it will be a list that will be handled in the next step
22+
- findsubmatch:
23+
pattern: '^([0-9]+\.[0-9]+)'
24+
# Select the last element from the list
25+
- kind: lastelement
1326

14-
buildbase:
15-
name: Get build base version
16-
kind: githubrelease
17-
dependson:
18-
- "gomod"
19-
spec:
20-
owner: rancher
21-
repository: image-build-base
22-
token: '{{ requiredEnv .github.token }}'
23-
typefilter:
24-
release: true
25-
draft: false
26-
prerelease: false
27-
versionfilter:
28-
kind: regex
29-
pattern: '{{ source "gomod"}}\.\S+'
27+
# Find the latest release matching that minor version
28+
latest_patch:
29+
name: Get latest build base patch for that minor
30+
kind: githubrelease
31+
dependson:
32+
- "current_minor"
33+
spec:
34+
owner: rancher
35+
repository: image-build-base
36+
token: '{{ requiredEnv .github.token }}'
37+
typefilter:
38+
release: true
39+
draft: false
40+
prerelease: false
41+
versionfilter:
42+
kind: regex
43+
# This searches for tags "v1.24.*"
44+
# using the "1.24" value from the 'current_minor' source
45+
pattern: 'v{{ source "current_minor" }}\.\S+'
3046

3147
targets:
3248
dockerfile:
3349
name: "Bump to latest build base version in Dockerfile"
3450
kind: dockerfile
3551
scmid: default
36-
sourceid: buildbase
52+
sourceid: latest_patch
3753
spec:
3854
file: Dockerfile
3955
instruction:
@@ -47,16 +63,16 @@ scms:
4763
kind: github
4864
spec:
4965
token: '{{ requiredEnv .github.token }}'
50-
username: '{{ .github.username }}'
66+
username: '{{ requiredEnv .github.username }}'
5167
user: '{{ .github.user }}'
5268
email: '{{ .github.email }}'
5369
owner: '{{ .github.owner }}'
5470
repository: '{{ .github.repository }}'
5571
branch: '{{ .github.branch }}'
56-
72+
5773
actions:
5874
default:
59-
title: 'Bump build base version to {{ source "buildbase" }}'
75+
title: 'Bump build base version to {{ source "latest_patch" }}'
6076
kind: github/pullrequest
6177
spec:
6278
automerge: false

0 commit comments

Comments
 (0)