mirror of https://github.com/istio/istio.io.git
More fixes and cleanup for makefiles (#6612)
This commit is contained in:
parent
6ba9f2c86e
commit
a804d49342
|
@ -14,7 +14,7 @@ GOPATH ?= $(shell cd ${ISTIOIO_GO}/../../..; pwd)
|
||||||
export GOPATH
|
export GOPATH
|
||||||
|
|
||||||
# Set the directory for Istio source.
|
# Set the directory for Istio source.
|
||||||
ISTIO_GO ?= ${GOPATH}/src/istio.io/istio
|
ISTIO_GO ?= $(GOPATH)/src/istio.io/istio
|
||||||
export ISTIO_GO
|
export ISTIO_GO
|
||||||
|
|
||||||
# If GOPATH is made up of several paths, use the first one for our targets in this Makefile
|
# If GOPATH is made up of several paths, use the first one for our targets in this Makefile
|
||||||
|
|
47
bin/init.sh
47
bin/init.sh
|
@ -18,29 +18,62 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
|
export ISTIO_REMOTE=${ISTIO_REMOTE:-origin}
|
||||||
export ISTIO_BRANCH=${ISTIO_BRANCH:-master}
|
export ISTIO_BRANCH=${ISTIO_BRANCH:-master}
|
||||||
|
|
||||||
echo "ISTIOIO_GO=${ISTIOIO_GO}"
|
echo "ISTIOIO_GO=${ISTIOIO_GO}"
|
||||||
echo "ISTIO_GO=${ISTIO_GO}"
|
echo "ISTIO_GO=${ISTIO_GO}"
|
||||||
|
echo "ISTIO_REMOTE=${ISTIO_REMOTE}"
|
||||||
echo "ISTIO_BRANCH=${ISTIO_BRANCH}"
|
echo "ISTIO_BRANCH=${ISTIO_BRANCH}"
|
||||||
|
|
||||||
# Download the Istio source if not available.
|
# Download the Istio source if not available.
|
||||||
if [[ ! -d "${ISTIO_GO}" ]]
|
if [[ -d "${ISTIO_GO}" ]]
|
||||||
then
|
then
|
||||||
|
echo "${ISTIO_GO} already exists. Using existing repository ..."
|
||||||
|
else
|
||||||
|
echo "${ISTIO_GO} not found. Cloning Istio repository ..."
|
||||||
git clone https://github.com/istio/istio.git "${ISTIO_GO}"
|
git clone https://github.com/istio/istio.git "${ISTIO_GO}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
pushd "${ISTIO_GO}" > /dev/null
|
||||||
|
|
||||||
|
REMOTE_BRANCH="${ISTIO_REMOTE}/${ISTIO_BRANCH}"
|
||||||
|
|
||||||
|
# Switch to latest for requested branch if possible
|
||||||
|
if [ -z "$(git status --porcelain)" ]; then
|
||||||
|
# Get updates to the remote repository
|
||||||
|
git fetch "$ISTIO_REMOTE"
|
||||||
|
|
||||||
|
# Switch to the desired local branch (create if necessary)
|
||||||
|
git checkout -B "${ISTIO_BRANCH}"
|
||||||
|
|
||||||
|
LOCAL_REV=$(git rev-parse @)
|
||||||
|
REMOTE_REV=$(git rev-parse "${REMOTE_BRANCH}")
|
||||||
|
BASE_REV=$(git merge-base @ "${REMOTE_BRANCH}")
|
||||||
|
|
||||||
|
if [[ "${LOCAL_REV}" == "${REMOTE_REV}" ]]; then
|
||||||
|
echo "Istio already up-to-date with ${REMOTE_BRANCH}"
|
||||||
|
elif [[ "${LOCAL_REV}" == "${BASE_REV}" ]]; then
|
||||||
|
echo "WARNING: Istio is out-of-date with ${REMOTE_BRANCH}. Merging remote changes."
|
||||||
|
git pull "${ISTIO_REMOTE}" "${ISTIO_BRANCH}"
|
||||||
|
elif [[ "${REMOTE_REV}" == "${BASE_REV}" ]]; then
|
||||||
|
echo "WARNING: Istio is ahead of ${REMOTE_BRANCH}. Using local branch."
|
||||||
|
else
|
||||||
|
echo "WARNING: Istio has diverged with ${REMOTE_BRANCH}. Using local branch."
|
||||||
|
fi
|
||||||
|
|
||||||
|
else
|
||||||
|
echo "WARNING: Istio has uncommitted changes. To use latest from ${REMOTE_BRANCH} clear your local changes."
|
||||||
|
fi
|
||||||
|
|
||||||
# Build and install istioctl
|
# Build and install istioctl
|
||||||
pushd "${ISTIO_GO}"
|
|
||||||
git checkout "${ISTIO_BRANCH}"
|
|
||||||
go install ./istioctl/cmd/istioctl
|
go install ./istioctl/cmd/istioctl
|
||||||
popd
|
|
||||||
|
popd > /dev/null
|
||||||
|
|
||||||
# Copy install/samples files over from Istio. These are needed by the tests.
|
# Copy install/samples files over from Istio. These are needed by the tests.
|
||||||
rm -rf "${ISTIOIO_GO}/install"
|
rm -rf "${ISTIOIO_GO}/install" "${ISTIOIO_GO}/samples"
|
||||||
cp -a "${ISTIO_GO}/install" "${ISTIOIO_GO}/install"
|
cp -a "${ISTIO_GO}/install" "${ISTIOIO_GO}/install"
|
||||||
|
|
||||||
rm -rf "${ISTIOIO_GO}/samples"
|
|
||||||
cp -a "${ISTIO_GO}/samples" "${ISTIOIO_GO}/samples"
|
cp -a "${ISTIO_GO}/samples" "${ISTIOIO_GO}/samples"
|
||||||
|
|
||||||
# For generating junit.xml files
|
# For generating junit.xml files
|
||||||
|
|
|
@ -31,11 +31,8 @@ endif
|
||||||
# $(INTEGRATION_TEST_KUBECONFIG) specifies the kube config file to be used. If not specified, then
|
# $(INTEGRATION_TEST_KUBECONFIG) specifies the kube config file to be used. If not specified, then
|
||||||
# ~/.kube/config is used.
|
# ~/.kube/config is used.
|
||||||
# TODO: This probably needs to be more intelligent and take environment variables into account.
|
# TODO: This probably needs to be more intelligent and take environment variables into account.
|
||||||
ifneq ($(KUBECONFIG),)
|
KUBECONFIG ?= ~/.kube/config
|
||||||
_INTEGRATION_TEST_FLAGS += --istio.test.kube.config=$(KUBECONFIG)
|
_INTEGRATION_TEST_FLAGS += --istio.test.kube.config=$(KUBECONFIG)
|
||||||
else
|
|
||||||
_INTEGRATION_TEST_FLAGS += --istio.test.kube.config=~/.kube/config
|
|
||||||
endif
|
|
||||||
|
|
||||||
test.kube.presubmit: init
|
test.kube.presubmit: init
|
||||||
PATH=${PATH}:${ISTIO_OUT} $(GO) test -p 1 ${T} ./tests/... -timeout 30m \
|
PATH=${PATH}:${ISTIO_OUT} $(GO) test -p 1 ${T} ./tests/... -timeout 30m \
|
||||||
|
|
Loading…
Reference in New Issue