Skip to content

Commit b7241a4

Browse files
committed
Add update portainer
1 parent 90b9032 commit b7241a4

File tree

3 files changed

+62
-0
lines changed

3 files changed

+62
-0
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,6 +1239,10 @@ update-headlamp-version:
12391239
update-kube-vip-version:
12401240
cd hack && go run update/kube_vip_version/update_kube_vip_version.go
12411241

1242+
.PHONY: update-portainer-version
1243+
update-portainer-version:
1244+
go run hack/update/portainer_version/update_portainer_version.go
1245+
12421246
# used by update- Targets to get before/after versions of tools it updates
12431247
# example usage echo "OLD_VERSION=$(DEP=node make get-dependency-version)" >> "$GITHUB_OUTPUT"
12441248
.PHONY: get-dependency-verison

hack/update/get_version/get_version.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ var dependencies = map[string]dependency{
7070
"nerdctld": {"deploy/kicbase/Dockerfile", `NERDCTLD_VERSION="(.*)"`},
7171
"node": {"netlify.toml", `NODE_VERSION = "(.*)"`},
7272
"nvidia-device-plugin": {addonsFile, `nvidia/k8s-device-plugin:(.*)@`},
73+
"portainer": {addonsFile, `portainer/portainer-ce:(.*)@`},
7374
"registry": {addonsFile, `registry:(.*)@`},
7475
"runc": {"deploy/iso/minikube-iso/package/runc-master/runc-master.mk", `RUNC_MASTER_VERSION = (.*)`},
7576
"ubuntu": {dockerfile, `ubuntu:jammy-(.*)"`},
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
Copyright 2023 The Kubernetes Authors All rights reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package main
18+
19+
import (
20+
"context"
21+
"fmt"
22+
"time"
23+
24+
"k8s.io/klog/v2"
25+
"k8s.io/minikube/hack/update"
26+
)
27+
28+
var schema = map[string]update.Item{
29+
"pkg/minikube/assets/addons.go": {
30+
Replace: map[string]string{
31+
`portainer/portainer-ce:.*`: `portainer/portainer-ce:{{.Version}}@{{.SHA}}",`,
32+
},
33+
},
34+
}
35+
36+
type Data struct {
37+
Version string
38+
SHA string
39+
}
40+
41+
func main() {
42+
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)
43+
defer cancel()
44+
45+
stable, _, _, err := update.GHReleases(ctx, "portainer", "portainer")
46+
if err != nil {
47+
klog.Fatalf("Unable to get stable version: %v", err)
48+
}
49+
sha, err := update.GetImageSHA(fmt.Sprintf("portainer/portainer-ce:%s", stable.Tag))
50+
if err != nil {
51+
klog.Fatalf("failed to get image SHA: %v", err)
52+
}
53+
54+
data := Data{Version: stable.Tag, SHA: sha}
55+
56+
update.Apply(schema, data)
57+
}

0 commit comments

Comments
 (0)