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

Add updatecli policy #29

Merged
merged 1 commit into from
May 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
68 changes: 68 additions & 0 deletions updatecli/updatecli.d/updatebuildbase.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
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/cri-tools/master/go.mod
Copy link

@mgfritch mgfritch May 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Query the go version from the tag defined by the image-build instead of the master branch?

$ curl https://raw.githubusercontent.com/kubernetes-sigs/cri-tools/v1.26.1/go.mod 2>/dev/null | egrep 'go ([0-9]+\.[0-9]+)'
go 1.19
$ curl https://raw.githubusercontent.com/kubernetes-sigs/cri-tools/master/go.mod 2>/dev/null | egrep 'go ([0-9]+\.[0-9]+)'
go 1.22.0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought about that but if you check the releases, we are not really updating that tag and releasing new versions that overwrite that tag. I thought using the master would be ok since we want to be always in sync with upstream k8s releases

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:"

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

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-crictl"
branch: "master"
owner: "rancher"