forked from kubernetes/kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
client-go: add staging/copy.sh testing
- Loading branch information
Showing
2 changed files
with
71 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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="[email protected]" -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters