Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix scripts and go modules #1181

Merged
merged 1 commit into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 19 additions & 10 deletions hack/update-toc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,26 @@ set -o errexit
set -o nounset
set -o pipefail

export KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
# cd to the root path
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
cd "${ROOT}"

# Install tools we need, but only from vendor/...
cd ${KUBE_ROOT}
go install ./vendor/github.com/tallclair/mdtoc
if ! which mdtoc >/dev/null 2>&1; then
echo "Can't find mdtoc - is your GOPATH 'bin' in your PATH?" >&2
echo " GOPATH: ${GOPATH}" >&2
echo " PATH: ${PATH}" >&2
exit 1
fi
# create a temporary directory
TMP_DIR=$(mktemp -d)

# cleanup
exitHandler() (
echo "Cleaning up..."
rm -rf "${TMP_DIR}"
)
trap exitHandler EXIT

# perform go get in a temp dir as we are not tracking this version in a go module
# if we do the go get in the repo, it will create / update a go.mod and go.sum
cd "${TMP_DIR}"
GO111MODULE=on GOBIN="${TMP_DIR}" go get "github.com/tallclair/mdtoc@${TOOL_VERSION}"
export PATH="${TMP_DIR}:${PATH}"
cd "${ROOT}"

# Update tables of contents if necessary.
grep --include='*.md' -rl keps -e '<!-- toc -->' | xargs mdtoc --inplace
21 changes: 18 additions & 3 deletions hack/verify-kep-metadata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,25 @@ set -o pipefail
TOOL_VERSION=v0.1.0

# cd to the root path
ROOT=$(dirname "${BASH_SOURCE}")/..
cd ${ROOT}
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
cd "${ROOT}"

GO111MODULE=on go get "github.com/chuckha/kepview/cmd/kepval@${TOOL_VERSION}"
# create a temporary directory
TMP_DIR=$(mktemp -d)

# cleanup
exitHandler() (
echo "Cleaning up..."
rm -rf "${TMP_DIR}"
)
trap exitHandler EXIT

# perform go get in a temp dir as we are not tracking this version in a go module
# if we do the go get in the repo, it will create / update a go.mod and go.sum
cd "${TMP_DIR}"
GO111MODULE=on GOBIN="${TMP_DIR}" go get "github.com/chuckha/kepview/cmd/kepval@${TOOL_VERSION}"
export PATH="${TMP_DIR}:${PATH}"
cd "${ROOT}"

echo "Checking metadata validity..."
# * ignore "0023-documentation-for-images.md" because it is not a real KEP
Expand Down
11 changes: 8 additions & 3 deletions hack/verify-spelling.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ set -o pipefail
TOOL_VERSION="v0.3.4"

# cd to the root path
ROOT=$(dirname "${BASH_SOURCE}")/..
cd ${ROOT}
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
cd "${ROOT}"

# create a temporary directory
TMP_DIR=$(mktemp -d)
Expand All @@ -34,7 +34,12 @@ exitHandler() (
)
trap exitHandler EXIT

GO111MODULE=on go get "github.com/client9/misspell/cmd/misspell@${TOOL_VERSION}"
# perform go get in a temp dir as we are not tracking this version in a go module
# if we do the go get in the repo, it will create / update a go.mod and go.sum
cd "${TMP_DIR}"
GO111MODULE=on GOBIN="${TMP_DIR}" go get "github.com/client9/misspell/cmd/misspell@${TOOL_VERSION}"
export PATH="${TMP_DIR}:${PATH}"
cd "${ROOT}"

# check spelling
RES=0
Expand Down
22 changes: 19 additions & 3 deletions hack/verify-toc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,25 @@ set -o pipefail
TOOL_VERSION=4dc3d6f908138504b02a1766f1f8ea282d6bdd7c

# cd to the root path
ROOT=$(dirname "${BASH_SOURCE}")/..
cd ${ROOT}
GO111MODULE=on go get "github.com/tallclair/mdtoc@${TOOL_VERSION}"
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd -P)"
cd "${ROOT}"

# create a temporary directory
TMP_DIR=$(mktemp -d)

# cleanup
exitHandler() (
echo "Cleaning up..."
rm -rf "${TMP_DIR}"
)
trap exitHandler EXIT

# perform go get in a temp dir as we are not tracking this version in a go module
# if we do the go get in the repo, it will create / update a go.mod and go.sum
cd "${TMP_DIR}"
GO111MODULE=on GOBIN="${TMP_DIR}" go get "github.com/tallclair/mdtoc@${TOOL_VERSION}"
export PATH="${TMP_DIR}:${PATH}"
cd "${ROOT}"

echo "Checking table of contents are up to date..."
# Verify tables of contents are up-to-date
Expand Down