update automation to update jammy
parent
c2bb95054c
commit
c5b4b8336f
|
@ -37,16 +37,16 @@ jobs:
|
|||
uses: peter-evans/create-pull-request@284f54f989303d2699d373481a0cfa13ad5a6666
|
||||
with:
|
||||
token: ${{ secrets.MINIKUBE_BOT_PAT }}
|
||||
commit-message: 'Kicbase: Bump ubuntu:focal from ${{ steps.bumpUbuntu.outputs.OLD_VERSION }} to ${{ steps.bumpUbuntu.outpus.NEW_VERSION }}'
|
||||
commit-message: 'Kicbase: Bump ubuntu:jammy from ${{ steps.bumpUbuntu.outputs.OLD_VERSION }} to ${{ steps.bumpUbuntu.outpus.NEW_VERSION }}'
|
||||
committer: minikube-bot <minikube-bot@google.com>
|
||||
author: minikube-bot <minikube-bot@google.com>
|
||||
branch: auto_bump_ubuntu_version
|
||||
push-to-fork: minikube-bot/minikube
|
||||
base: master
|
||||
delete-branch: true
|
||||
title: 'Kicbase: Bump ubuntu:focal from ${{ steps.bumpUbuntu.outputs.OLD_VERSION }} to ${{ steps.bumpUbuntu.outpus.NEW_VERSION }}'
|
||||
title: 'Kicbase: Bump ubuntu:jammy from ${{ steps.bumpUbuntu.outputs.OLD_VERSION }} to ${{ steps.bumpUbuntu.outpus.NEW_VERSION }}'
|
||||
body: |
|
||||
The ubuntu:focal image released a new version
|
||||
The ubuntu:jammy image released a new version
|
||||
|
||||
This PR was auto-generated by `make update-ubuntu-version` using [update-ubuntu-version.yml](https://github.com/kubernetes/minikube/tree/master/.github/workflows/update-ubuntu-version.yml) CI Workflow.
|
||||
- uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410
|
||||
|
|
|
@ -49,13 +49,13 @@ var (
|
|||
schema = map[string]update.Item{
|
||||
"deploy/kicbase/Dockerfile": {
|
||||
Replace: map[string]string{
|
||||
`UBUNTU_FOCAL_IMAGE=.*`: `UBUNTU_FOCAL_IMAGE="{{.LatestVersion}}"`,
|
||||
`UBUNTU_JAMMY_IMAGE=.*`: `UBUNTU_JAMMY_IMAGE="{{.LatestVersion}}"`,
|
||||
},
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// Data holds latest Ubuntu focal version in semver format.
|
||||
// Data holds latest Ubuntu jammy version in semver format.
|
||||
type Data struct {
|
||||
LatestVersion string
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ type Response struct {
|
|||
func getLatestVersion() (string, error) {
|
||||
resp, err := http.Get(dockerHubUbuntuBaseURL)
|
||||
if err != nil {
|
||||
return "", fmt.Errorf("unable to get Ubuntu focal's latest version: %v", err)
|
||||
return "", fmt.Errorf("unable to get Ubuntu jammy's latest version: %v", err)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
|
||||
|
@ -86,22 +86,22 @@ func getLatestVersion() (string, error) {
|
|||
}
|
||||
|
||||
for _, i := range content.Results {
|
||||
if strings.Contains(i.Name, "focal-") {
|
||||
if strings.Contains(i.Name, "jammy-") {
|
||||
return i.Name, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("response from Docker Hub does not contain a latest focal image")
|
||||
return "", fmt.Errorf("response from Docker Hub does not contain a latest jammy image")
|
||||
}
|
||||
|
||||
func main() {
|
||||
// get Ubuntu Focal latest version
|
||||
// get Ubuntu Jammy latest version
|
||||
latest, err := getLatestVersion()
|
||||
if err != nil {
|
||||
klog.Fatalf("Unable to find latest ubuntu:focal version: %v\n", err)
|
||||
klog.Fatalf("Unable to find latest ubuntu:jammy version: %v\n", err)
|
||||
}
|
||||
data := Data{LatestVersion: fmt.Sprintf("ubuntu:%s", latest)}
|
||||
klog.Infof("Ubuntu focal latest version: %s", latest)
|
||||
klog.Infof("Ubuntu jammy latest version: %s", latest)
|
||||
|
||||
update.Apply(schema, data)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue