2016-09-13 19:57:44 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright 2016 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.
|
|
|
|
|
2016-10-05 19:37:32 +00:00
|
|
|
# This script builds the minikube binary for all 3 platforms and uploads them.
|
|
|
|
# This is to done as part of the CI tests for Github PRs
|
|
|
|
|
2016-12-24 04:11:05 +00:00
|
|
|
# The script expects the following env variables:
|
2016-09-13 19:57:44 +00:00
|
|
|
# ghprbPullId: The pull request ID, injected from the ghpbr plugin.
|
|
|
|
# ghprbActualCommit: The commit hash, injected from the ghpbr plugin.
|
|
|
|
|
2018-10-19 23:00:06 +00:00
|
|
|
set -eux -o pipefail
|
2017-01-31 21:30:09 +00:00
|
|
|
|
2018-10-19 23:10:35 +00:00
|
|
|
readonly bucket="minikube-builds"
|
|
|
|
|
2019-08-15 20:58:07 +00:00
|
|
|
# Make sure the right golang version is installed based on Makefile
|
2019-08-16 17:21:08 +00:00
|
|
|
WANT_GOLANG_VERSION=$(grep '^GO_VERSION' Makefile | awk '{ print $3 }')
|
|
|
|
./hack/jenkins/installers/check_install_golang.sh $WANT_GOLANG_VERSION /usr/local
|
2019-08-15 20:58:07 +00:00
|
|
|
|
|
|
|
|
2018-10-19 23:00:06 +00:00
|
|
|
declare -rx BUILD_IN_DOCKER=y
|
|
|
|
declare -rx GOPATH=/var/lib/jenkins/go
|
2018-10-19 23:10:35 +00:00
|
|
|
declare -rx ISO_BUCKET="${bucket}/${ghprbPullId}"
|
2018-10-19 23:00:06 +00:00
|
|
|
declare -rx ISO_VERSION="testing"
|
|
|
|
declare -rx TAG="${ghprbActualCommit}"
|
|
|
|
|
2017-10-05 18:55:35 +00:00
|
|
|
|
|
|
|
docker kill $(docker ps -q) || true
|
2017-10-19 15:33:35 +00:00
|
|
|
docker rm $(docker ps -aq) || true
|
2018-10-19 23:10:35 +00:00
|
|
|
make -j 16 all && failed=$? || failed=$?
|
2019-10-14 21:37:03 +00:00
|
|
|
|
|
|
|
"out/minikube-$(go env GOOS)-$(go env GOARCH)" version
|
2017-10-24 17:17:14 +00:00
|
|
|
|
2018-10-19 23:25:32 +00:00
|
|
|
gsutil cp "gs://${bucket}/logs/index.html" \
|
2018-10-19 23:10:35 +00:00
|
|
|
"gs://${bucket}/logs/${ghprbPullId}/index.html"
|
2016-09-13 19:57:44 +00:00
|
|
|
|
2018-10-19 23:10:35 +00:00
|
|
|
if [[ "${failed}" -ne 0 ]]; then
|
2018-10-19 23:00:06 +00:00
|
|
|
echo "build failed"
|
2018-10-19 23:10:35 +00:00
|
|
|
exit "${failed}"
|
2018-10-19 23:00:06 +00:00
|
|
|
fi
|
2017-10-24 17:17:14 +00:00
|
|
|
|
2018-10-19 23:00:06 +00:00
|
|
|
git diff ${ghprbActualCommit} --name-only \
|
|
|
|
$(git merge-base origin/master ${ghprbActualCommit}) \
|
2018-10-19 23:10:35 +00:00
|
|
|
| grep -q deploy/iso/minikube && rebuild=1 || rebuild=0
|
2018-10-19 23:00:06 +00:00
|
|
|
|
2018-10-19 23:10:35 +00:00
|
|
|
if [[ "${rebuild}" -eq 1 ]]; then
|
2019-08-12 18:16:20 +00:00
|
|
|
echo "ISO changes detected ... rebuilding ISO"
|
|
|
|
make release-iso
|
2017-02-10 22:43:54 +00:00
|
|
|
fi
|
|
|
|
|
2019-10-14 19:12:48 +00:00
|
|
|
|
2016-09-13 19:57:44 +00:00
|
|
|
cp -r test/integration/testdata out/
|
|
|
|
|
2017-02-10 22:43:54 +00:00
|
|
|
# Don't upload the buildroot artifacts if they exist
|
|
|
|
rm -r out/buildroot || true
|
|
|
|
|
2019-10-14 16:06:31 +00:00
|
|
|
# At this point, the out directory contains the jenkins scripts (populated by jenkins),
|
|
|
|
# testdata, and our build output. Push the changes to GCS so that worker nodes can re-use them.
|
|
|
|
|
|
|
|
# -d: delete remote files that don't exist (removed test files, for instance)
|
|
|
|
# -J: gzip compression
|
2019-10-14 19:12:48 +00:00
|
|
|
# -R: recursive. strangely, this is not the default for sync.
|
|
|
|
gsutil -m rsync -dJR out "gs://${bucket}/${ghprbPullId}"
|