Merge pull request #3266 from tstromberg/cross-build

Fix invalid build result comparison in the cross build script
pull/3350/head
Thomas Strömberg 2018-11-19 21:13:17 -05:00 committed by GitHub
commit e16c7e2def
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 22 additions and 19 deletions

View File

@ -21,31 +21,35 @@
# ghprbPullId: The pull request ID, injected from the ghpbr plugin.
# ghprbActualCommit: The commit hash, injected from the ghpbr plugin.
set -e
set -eux -o pipefail
readonly bucket="minikube-builds"
declare -rx BUILD_IN_DOCKER=y
declare -rx GOPATH=/var/lib/jenkins/go
declare -rx ISO_BUCKET="${bucket}/${ghprbPullId}"
declare -rx ISO_VERSION="testing"
declare -rx TAG="${ghprbActualCommit}"
export BUILD_IN_DOCKER=y
export TAG=$ghprbActualCommit
export GOPATH=/var/lib/jenkins/go
docker kill $(docker ps -q) || true
docker rm $(docker ps -aq) || true
set +e
make -j 16 all
set -e
make -j 16 all && failed=$? || failed=$?
make_result="$?"
gsutil cp gs://minikube-builds/logs/index.html gs://minikube-builds/logs/${ghprbPullId}/index.html
gsutil cp "gs://${bucket}/logs/index.html" \
"gs://${bucket}/logs/${ghprbPullId}/index.html"
# Exit if the cross build failed.
if [ "$make_result"-ne 0 ]; then echo "cross build failed"; exit 1; fi
if [[ "${failed}" -ne 0 ]]; then
echo "build failed"
exit "${failed}"
fi
# 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 ${ghprbActualCommit} --name-only $(git merge-base origin/master ${ghprbActualCommit}) | grep deploy/iso/minikube)" &> /dev/null; then
git diff ${ghprbActualCommit} --name-only \
$(git merge-base origin/master ${ghprbActualCommit}) \
| grep -q deploy/iso/minikube && rebuild=1 || rebuild=0
if [[ "${rebuild}" -eq 1 ]]; then
echo "ISO changes detected ... rebuilding ISO"
export ISO_BUCKET="minikube-builds/${ghprbPullId}"
export ISO_VERSION="testing"
make release-iso
fi
@ -54,5 +58,4 @@ 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}/
gsutil -m cp -r out/* "gs://${bucket}/${ghprbPullId}/"