Skip to content

Commit

Permalink
Use updatecli to update versions
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Buil <[email protected]>
  • Loading branch information
manuelbuil committed Mar 1, 2024
1 parent f0d1769 commit e235389
Show file tree
Hide file tree
Showing 3 changed files with 147 additions and 0 deletions.
78 changes: 78 additions & 0 deletions updatecli/updatecli.d/updatebuildbase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
---
name: "Update build base version"

sources:
gomod:
name: Get latest Golang version based on go.mod
kind: file
spec:
file: https://raw.githubusercontent.com/kubernetes-sigs/metrics-server/master/go.mod
matchpattern: 'go ([0-9]+\.[0-9]+)'
transformers:
- trimprefix: "go "

buildbase:
name: Get build base version
kind: githubrelease
dependson:
- "gomod"
spec:
owner: rancher
repository: image-build-base
token: '{{ requiredEnv .github.token }}'
typefilter:
release: true
draft: false
prerelease: false
versionfilter:
kind: regex
pattern: '{{ source "gomod"}}\.\S+'

targets:
dockerfile:
name: "Bump to latest build base version in Dockerfile"
kind: dockerfile
scmid: default
sourceid: buildbase
spec:
file: Dockerfile
instruction:
keyword: ARG
matcher: "GO_IMAGE"
transformers:
- addprefix: "rancher/hardened-build-base:"

drone:
name: "Bump to latest build base version in Dockerfile"
kind: file
scmid: default
disablesourceinput: true
spec:
file: .drone.yml
matchpattern: '(?m)^ image: rancher/hardened-build-base:(.*)'
replacepattern: ' image: rancher/hardened-build-base:{{ source "buildbase" }}'

scms:
default:
kind: github
spec:
token: '{{ requiredEnv .github.token }}'
username: '{{ .github.username }}'
user: '{{ .github.user }}'
email: '{{ .github.email }}'
owner: '{{ .github.owner }}'
repository: '{{ .github.repository }}'
branch: '{{ .github.branch }}'

actions:
default:
title: 'Bump build base version to {{ source "buildbase" }}'
kind: github/pullrequest
spec:
automerge: false
labels:
- chore
- skip-changelog
- status/auto-created
scmid: default

66 changes: 66 additions & 0 deletions updatecli/updatecli.d/updatemetricsserver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
name: "Update metrics server version"

sources:
metricsserver:
name: Get metrics-server version
kind: githubrelease
spec:
owner: kubernetes-sigs
repository: metrics-server
token: '{{ requiredEnv .github.token }}'
typefilter:
release: true
draft: false
prerelease: false
versionfilter:
kind: semver
# pattern accepts any semver constraint
pattern: "*"

targets:
dockerfile:
name: "Bump to latest metrics server version in Dockerfile"
kind: dockerfile
scmid: default
sourceid: metricsserver
spec:
file: "Dockerfile"
instruction:
keyword: "ARG"
matcher: "TAG"

makefile:
name: "Bump to latest metrics server version in Makefile"
kind: file
scmid: default
disablesourceinput: true
spec:
file: Makefile
matchpattern: '(?m)^TAG \?\= (.*)'
replacepattern: 'TAG ?= {{ source "metricsserver" }}$$(BUILD_META)'

scms:
default:
kind: github
spec:
token: '{{ requiredEnv .github.token }}'
username: '{{ .github.username }}'
user: '{{ .github.user }}'
email: '{{ .github.email }}'
owner: '{{ .github.owner }}'
repository: '{{ .github.repository }}'
branch: '{{ .github.branch }}'

actions:
default:
title: 'Bump metrics server version to {{ source "metricsserver" }}'
kind: github/pullrequest
spec:
automerge: false
labels:
- chore
- skip-changelog
- status/auto-created
scmid: default

3 changes: 3 additions & 0 deletions updatecli/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ github:
email: "41898282+github-actions[bot]@users.noreply.github.com"
username: "UPDATECLI_GITHUB_ACTOR"
token: "UPDATECLI_GITHUB_TOKEN"
repository: "image-build-k8s-metrics-server"
branch: "master"
owner: "rancher"

0 comments on commit e235389

Please sign in to comment.