get last 30 releases of k8s from github

pull/7042/head
Priya Wadhwa 2020-03-16 17:48:00 -07:00
parent 316eef44d1
commit c9c597c2e1
5 changed files with 49 additions and 10 deletions

2
go.mod
View File

@ -27,6 +27,8 @@ require (
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/google/go-cmp v0.3.1
github.com/google/go-containerregistry v0.0.0-20200131185320-aec8da010de2
github.com/google/go-github v17.0.0+incompatible
github.com/google/go-github/v29 v29.0.3 // indirect
github.com/googleapis/gnostic v0.3.0 // indirect
github.com/hashicorp/go-getter v1.4.0
github.com/hashicorp/go-retryablehttp v0.5.4

2
go.sum
View File

@ -335,6 +335,8 @@ github.com/google/go-containerregistry v0.0.0-20200131185320-aec8da010de2 h1:/z0
github.com/google/go-containerregistry v0.0.0-20200131185320-aec8da010de2/go.mod h1:Wtl/v6YdQxv397EREtzwgd9+Ud7Q5D8XMbi3Zazgkrs=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-github/v29 v29.0.3 h1:IktKCTwU//aFHnpA+2SLIi7Oo9uhAzgsdZNbcAqhgdc=
github.com/google/go-github/v29 v29.0.3/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/google/gofuzz v0.0.0-20161122191042-44d81051d367/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=

View File

@ -41,10 +41,6 @@ docker kill $(docker ps -q) || true
docker rm $(docker ps -aq) || true
make -j 16 all && failed=$? || failed=$?
echo "Running preloaded images release script..."
make upload-preloaded-images-tar
"out/minikube-$(go env GOOS)-$(go env GOARCH)" version
gsutil cp "gs://${bucket}/logs/index.html" \

View File

@ -0,0 +1,40 @@
/*
Copyright 2020 The Kubernetes Authors All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"context"
"github.com/golang/glog"
"github.com/google/go-github/github"
)
// RecentK8sVersions returns the most recent k8s version, usually around 30
func RecentK8sVersions() ([]string, error) {
client := github.NewClient(nil)
k8s := "kubernetes"
list, _, err := client.Repositories.ListReleases(context.Background(), k8s, k8s, &github.ListOptions{})
if err != nil {
return nil, err
}
var releases []string
for _, r := range list {
releases = append(releases, r.GetTagName())
}
glog.Infof("Got releases: %v", releases)
return releases, nil
}

View File

@ -22,7 +22,6 @@ import (
"os/exec"
"strings"
"k8s.io/minikube/pkg/minikube/constants"
"k8s.io/minikube/pkg/minikube/download"
"k8s.io/minikube/pkg/minikube/exit"
)
@ -36,17 +35,17 @@ var (
dockerStorageDriver = "overlay2"
preloadedTarballVersion = "v1"
containerRuntimes = []string{"docker"}
kubernetesVersions = []string{
constants.OldestKubernetesVersion,
constants.DefaultKubernetesVersion,
constants.NewestKubernetesVersion,
}
)
func main() {
if err := verifyDockerStorage(); err != nil {
exit.WithError("Docker storage type is incompatible: %v\n", err)
}
kubernetesVersions, err := RecentK8sVersions()
if err != nil {
exit.WithError("Unable to get recent k8s versions: %v\n", err)
}
for _, kubernetesVersion := range kubernetesVersions {
for _, cr := range containerRuntimes {
tf := tarballFilename(kubernetesVersion, cr)