Detect and test against ISO changes

When changes are made to the ISO folder, rebuild and upload the newly
modified image.  Use this uploaded image as the default in the e2e test
binaries, so that the e2e test suite runs against the PR's changes.

TODO: Subsequent PRs (no changes to ISO) will still run against the
default version in the makefile.  We should figure out if we want to
always run tests against the "latest" image.
pull/1118/head
Matt Rickard 2017-02-10 14:43:54 -08:00
parent 072ccdc29e
commit a125157f44
5 changed files with 28 additions and 6 deletions

View File

@ -22,6 +22,7 @@ INSTALL_SIZE ?= $(shell du out/minikube-windows-amd64.exe | cut -f1)
BUILDROOT_BRANCH ?= 2016.08
ISO_VERSION ?= v1.0.6
ISO_BUCKET ?= minikube/iso
GOOS ?= $(shell go env GOOS)
GOARCH ?= $(shell go env GOARCH)
@ -47,11 +48,9 @@ BUILD_OS := $(shell uname -s)
LOCALKUBE_VERSION := $(shell $(PYTHON) hack/get_k8s_version.py --k8s-version-only 2>&1)
LOCALKUBE_BUCKET := gs://minikube/k8sReleases
ISO_BUCKET := gs://minikube/iso
# Set the version information for the Kubernetes servers, and build localkube statically
K8S_VERSION_LDFLAGS := $(shell $(PYTHON) hack/get_k8s_version.py 2>&1)
MINIKUBE_LDFLAGS := -X k8s.io/minikube/pkg/version.version=$(VERSION) -X k8s.io/minikube/pkg/version.isoVersion=$(ISO_VERSION)
MINIKUBE_LDFLAGS := -X k8s.io/minikube/pkg/version.version=$(VERSION) -X k8s.io/minikube/pkg/version.isoVersion=$(ISO_VERSION) -X k8s.io/minikube/pkg/version.isoPath=$(ISO_BUCKET)
LOCALKUBE_LDFLAGS := "$(K8S_VERSION_LDFLAGS) $(MINIKUBE_LDFLAGS) -s -w -extldflags '-static'"
LOCALKUBEFILES := GOPATH=$(GOPATH) go list -f '{{join .Deps "\n"}}' ./cmd/localkube/ | grep k8s.io | GOPATH=$(GOPATH) xargs go list -f '{{ range $$file := .GoFiles }} {{$$.Dir}}/{{$$file}}{{"\n"}}{{end}}'
@ -179,6 +178,6 @@ update-releases:
.PHONY: release-iso
release-iso: minikube_iso checksum
gsutil cp out/minikube.iso $(ISO_BUCKET)/minikube-$(ISO_VERSION).iso
gsutil cp out/minikube.iso.sha256 $(ISO_BUCKET)/minikube-$(ISO_VERSION).iso.sha256
gsutil cp out/minikube.iso gs://$(ISO_BUCKET)/minikube-$(ISO_VERSION).iso
gsutil cp out/minikube.iso.sha256 gs://$(ISO_BUCKET)/minikube-$(ISO_VERSION).iso.sha256

View File

@ -39,6 +39,9 @@ MINIKUBE_WANTREPORTERRORPROMPT=False \
rm -rf $HOME/.minikube || true
# See the default image
./out/minikube-${OS_ARCH} start -h | grep iso
# Allow this to fail, we'll switch on the return code below.
set +e
out/e2e-${OS_ARCH} -minikube-args="--vm-driver=${VM_DRIVER} --cpus=4 --v=100 ${EXTRA_BUILD_ARGS}" -test.v -test.timeout=30m -binary=out/minikube-${OS_ARCH}

View File

@ -25,6 +25,17 @@ set -e
gsutil cp gs://minikube-builds/logs/index.html gs://minikube-builds/logs/${ghprbPullId}/index.html
# If there are ISO changes, build and upload the ISO
# then set the default to the newly built ISO for testing
if out="$(git diff origin/master --name-only | grep deploy/iso/minikube)" &> /dev/null; then
echo "ISO changes detected ... rebuilding ISO"
export ISO_BUCKET="minikube-builds/${ghprbPullId}"
export ISO_VERSION="testing"
make release-iso
fi
# Build all platforms (Windows, Linux, OSX)
make cross
@ -36,5 +47,8 @@ GOPATH=$(pwd)/_gopath GOOS=linux GOARCH=amd64 go test -c k8s.io/minikube/test/in
GOPATH=$(pwd)/_gopath GOOS=windows GOARCH=amd64 go test -c k8s.io/minikube/test/integration --tags=integration -o out/e2e-windows-amd64.exe
cp -r test/integration/testdata out/
# Don't upload the buildroot artifacts if they exist
rm -r out/buildroot || true
# Upload everything we built to Cloud Storage.
gsutil -m cp -r out/* gs://minikube-builds/${ghprbPullId}/

View File

@ -89,7 +89,7 @@ const (
KubernetesVersionGCSURL = "https://storage.googleapis.com/minikube/k8s_releases.json"
)
var DefaultIsoUrl = fmt.Sprintf("https://storage.googleapis.com/minikube/iso/minikube-%s.iso", minikubeVersion.GetIsoVersion())
var DefaultIsoUrl = fmt.Sprintf("https://storage.googleapis.com/%s/minikube-%s.iso", minikubeVersion.GetIsoPath(), minikubeVersion.GetIsoVersion())
var DefaultIsoShaUrl = DefaultIsoUrl + ShaSuffix
var DefaultKubernetesVersion = version.Get().GitVersion

View File

@ -30,6 +30,8 @@ var version = "v0.0.0-unset"
var isoVersion = "v0.0.0-unset"
var isoPath = "minikube/iso"
func GetVersion() string {
return version
}
@ -38,6 +40,10 @@ func GetIsoVersion() string {
return isoVersion
}
func GetIsoPath() string {
return isoPath
}
func GetSemverVersion() (semver.Version, error) {
return semver.Make(strings.TrimPrefix(GetVersion(), VersionPrefix))
}