Skip to content

Commit 5691aa0

Browse files
authored
Merge pull request #17510 from spowelljr/autoUpdateNvidia
CI: Auto update nvidia-device-plugin
2 parents 4c2d5f0 + 6d130e3 commit 5691aa0

File tree

4 files changed

+112
-0
lines changed

4 files changed

+112
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: "update-nvidia-device-plugin-version"
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
# every Monday at around 3 am pacific/10 am UTC
6+
- cron: "0 10 * * 1"
7+
env:
8+
GOPROXY: https://proxy.golang.org
9+
GO_VERSION: '1.21.3'
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
bump-nvidia-device-plugin-version:
15+
runs-on: ubuntu-20.04
16+
steps:
17+
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
18+
- uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe
19+
with:
20+
go-version: ${{env.GO_VERSION}}
21+
cache-dependency-path: ./go.sum
22+
- name: Bump nvidia-device-plugin version
23+
id: bumpNvidiaDevicePlugin
24+
run: |
25+
echo "OLD_VERSION=$(DEP=nvidia-device-plugin make get-dependency-version)" >> $GITHUB_OUTPUT
26+
make update-nvidia-device-plugin-version
27+
echo "NEW_VERSION=$(DEP=nvidia-device-plugin make get-dependency-version)" >> $GITHUB_OUTPUT
28+
# The following is to support multiline with GITHUB_OUTPUT, see https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#multiline-strings
29+
echo "changes<<EOF" >> $GITHUB_OUTPUT
30+
echo "$(git status --porcelain)" >> $GITHUB_OUTPUT
31+
echo "EOF" >> $GITHUB_OUTPUT
32+
- name: Create PR
33+
if: ${{ steps.bumpNvidiaDevicePlugin.outputs.changes != '' }}
34+
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38
35+
with:
36+
token: ${{ secrets.MINIKUBE_BOT_PAT }}
37+
commit-message: 'Addon nvidia-device-plugin: Update nvidia/k8s-device-plugin image from ${{ steps.bumpNvidiaDevicePlugin.outputs.OLD_VERSION }} to ${{ steps.bumpNvidiaDevicePlugin.outputs.NEW_VERSION }}'
38+
committer: minikube-bot <minikube-bot@google.com>
39+
author: minikube-bot <minikube-bot@google.com>
40+
branch: auto_bump_nvidia_device_plugin_version
41+
push-to-fork: minikube-bot/minikube
42+
base: master
43+
delete-branch: true
44+
title: 'Addon nvidia-device-plugin: Update nvidia/k8s-device-plugin image from ${{ steps.bumpNvidiaDevicePlugin.outputs.OLD_VERSION }} to ${{ steps.bumpNvidiaDevicePlugin.outputs.NEW_VERSION }}'
45+
labels: ok-to-test
46+
body: |
47+
The [k8s-device-plugin](https://github.com/NVIDIA/k8s-device-plugin) project released a new k8s-device-plugin image
48+
49+
This PR was auto-generated by `make update-nvidia-device-plugin-version` using [update-nvidia-device-plugin-version.yml](https://github.com/kubernetes/minikube/tree/master/.github/workflows/update-nvidia-device-plugin-version.yml) CI Workflow.

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,6 +1190,11 @@ update-kong-ingress-controller-version:
11901190
(cd hack/update/kong_ingress_controller_version && \
11911191
go run update_kong_ingress_controller_version.go)
11921192

1193+
.PHONY: update-nvidia-device-plugin-version
1194+
update-nvidia-device-plugin-version:
1195+
(cd hack/update/nvidia_device_plugin_version && \
1196+
go run update_nvidia_device_plugin_version.go)
1197+
11931198
.PHONY: get-dependency-verison
11941199
get-dependency-version:
11951200
@(cd hack/update/get_version && \

hack/update/get_version/get_version.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ var dependencies = map[string]dependency{
5656
"kong-ingress-controller": {addonsFile, `kong/kubernetes-ingress-controller:(.*)@`},
5757
"metrics-server": {addonsFile, `metrics-server/metrics-server:(.*)@`},
5858
"nerdctl": {"deploy/kicbase/Dockerfile", `NERDCTL_VERSION="(.*)"`},
59+
"nvidia-device-plugin": {addonsFile, `nvidia/k8s-device-plugin:(.*)@`},
5960
"registry": {addonsFile, `registry:(.*)@`},
6061
"runc": {"deploy/iso/minikube-iso/package/runc-master/runc-master.mk", `RUNC_MASTER_VERSION = (.*)`},
6162
"ubuntu": {"deploy/kicbase/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+
`nvidia/k8s-device-plugin:.*`: `nvidia/k8s-device-plugin:{{.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, "NVIDIA", "k8s-device-plugin")
46+
if err != nil {
47+
klog.Fatalf("Unable to get stable version: %v", err)
48+
}
49+
sha, err := update.GetImageSHA(fmt.Sprintf("nvcr.io/nvidia/k8s-device-plugin:%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)