mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-02 03:08:15 +00:00
client-go: add staging/copy.sh testing
This commit is contained in:
@@ -18,8 +18,59 @@ set -o errexit
|
||||
set -o nounset
|
||||
set -o pipefail
|
||||
|
||||
go build ./staging/src/k8s.io/client-go/examples/...
|
||||
V=""
|
||||
while getopts ":v" opt; do
|
||||
case $opt in
|
||||
v) # increase verbosity
|
||||
V="-v"
|
||||
;;
|
||||
\?)
|
||||
echo "Invalid option: -$OPTARG" >&2
|
||||
;;
|
||||
esac
|
||||
done
|
||||
readonly V
|
||||
|
||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
||||
# TODO: reenable copy.sh when test can cope with circular dependencies
|
||||
# "${KUBE_ROOT}"/staging/copy.sh -v
|
||||
cd ${KUBE_ROOT}
|
||||
|
||||
# Smoke test client-go examples
|
||||
go install ./staging/src/k8s.io/client-go/examples/...
|
||||
|
||||
# Create a temporary GOPATH for apimachinery and client-go, copy the current HEAD into each and turn them
|
||||
# into a git repo. Then we can run copy.sh with this additional GOPATH. The Godeps.json will
|
||||
# have invalid git SHA1s, but it's good enough as a smoke test of copy.sh.
|
||||
if [ "${USE_TEMP_DIR:-1}" = 1 ]; then
|
||||
TEMP_STAGING_GOPATH=$(mktemp -d -t verify-staging-client-go.XXXXX)
|
||||
echo "Creating the temporary staging GOPATH directory: ${TEMP_STAGING_GOPATH}"
|
||||
cleanup() {
|
||||
if [ "${KEEP_TEMP_DIR:-0}" != 1 ]; then
|
||||
rm -rf "${TEMP_STAGING_GOPATH}"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT SIGINT
|
||||
mkdir -p "${TEMP_STAGING_GOPATH}/src/k8s.io"
|
||||
ln -s "${PWD}" "${TEMP_STAGING_GOPATH}/src/k8s.io"
|
||||
else
|
||||
TEMP_STAGING_GOPATH="${GOPATH}"
|
||||
fi
|
||||
for PACKAGE in apimachinery client-go; do
|
||||
PACKAGE_PATH="${TEMP_STAGING_GOPATH}/src/k8s.io/${PACKAGE}"
|
||||
echo "Creating a temporary ${PACKAGE} repo with a snapshot of HEAD"
|
||||
mkdir -p "${PACKAGE_PATH}"
|
||||
rsync -ax --delete staging/src/k8s.io/${PACKAGE}/ "${PACKAGE_PATH}/"
|
||||
pushd "${PACKAGE_PATH}" >/dev/null
|
||||
git init >/dev/null
|
||||
git add *
|
||||
git -c user.email="nobody@k8s.io" -c user.name="verify-staging-client-go.sh" commit -q -m "Snapshot"
|
||||
popd >/dev/null
|
||||
done
|
||||
|
||||
echo "Running godep restore"
|
||||
pushd "${TEMP_STAGING_GOPATH}/src/k8s.io/kubernetes" >/dev/null
|
||||
export GOPATH="${TEMP_STAGING_GOPATH}"
|
||||
godep restore ${V} 2>&1 | sed 's/^/ /'
|
||||
|
||||
echo "Testing staging/copy.sh"
|
||||
staging/copy.sh -d 2>&1 | sed 's/^/ /'
|
||||
popd
|
||||
|
||||
Reference in New Issue
Block a user