mirror of https://github.com/kubernetes/kops.git
Merge pull request #8572 from rifelpet/hack-gopath
Hack directory cleanup
This commit is contained in:
commit
11600413ca
|
|
@ -5,17 +5,12 @@
|
||||||
./hack/dev-build.sh
|
./hack/dev-build.sh
|
||||||
./hack/make-apimachinery.sh
|
./hack/make-apimachinery.sh
|
||||||
./hack/new-iam-user.sh
|
./hack/new-iam-user.sh
|
||||||
./hack/publish-docs.sh
|
|
||||||
./hack/update-bazel.sh
|
./hack/update-bazel.sh
|
||||||
./hack/update-expected.sh
|
|
||||||
./hack/update-header.sh
|
./hack/update-header.sh
|
||||||
./hack/verify-apimachinery.sh
|
|
||||||
./hack/verify-bazel.sh
|
./hack/verify-bazel.sh
|
||||||
./hack/verify-boilerplate.sh
|
./hack/verify-boilerplate.sh
|
||||||
./hack/verify-gofmt.sh
|
./hack/verify-gofmt.sh
|
||||||
./hack/verify-packages.sh
|
|
||||||
./hack/verify-spelling.sh
|
./hack/verify-spelling.sh
|
||||||
./hack/verify-staticcheck.sh
|
|
||||||
./hooks/nvidia-bootstrap/image/run.sh
|
./hooks/nvidia-bootstrap/image/run.sh
|
||||||
./hooks/nvidia-device-plugin/image/files/01-aws-nvidia-driver.sh
|
./hooks/nvidia-device-plugin/image/files/01-aws-nvidia-driver.sh
|
||||||
./hooks/nvidia-device-plugin/image/files/02-nvidia-docker.sh
|
./hooks/nvidia-device-plugin/image/files/02-nvidia-docker.sh
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ def file_passes(filename, refs, regexs):
|
||||||
def file_extension(filename):
|
def file_extension(filename):
|
||||||
return os.path.splitext(filename)[1].split(".")[-1].lower()
|
return os.path.splitext(filename)[1].split(".")[-1].lower()
|
||||||
|
|
||||||
skipped_dirs = ['Godeps', 'third_party', '_gopath', '_output', '.git', 'cluster/env.sh',
|
skipped_dirs = ['third_party', '_gopath', '_output', '.git', 'cluster/env.sh',
|
||||||
"vendor", "test/e2e/generated/bindata.go", "hack/boilerplate/test",
|
"vendor", "test/e2e/generated/bindata.go", "hack/boilerplate/test",
|
||||||
"pkg/generated/bindata.go"]
|
"pkg/generated/bindata.go"]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,50 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/..
|
KOPS_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/.. >/dev/null 2>&1 && pwd )"
|
||||||
|
|
||||||
|
kube::util::array_contains() {
|
||||||
|
local search="$1"
|
||||||
|
local element
|
||||||
|
shift
|
||||||
|
for element; do
|
||||||
|
if [[ "${element}" == "${search}" ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
kube::util::read-array() {
|
||||||
|
local i=0
|
||||||
|
unset -v "$1"
|
||||||
|
while IFS= read -r "$1[i++]"; do :; done
|
||||||
|
eval "[[ \${$1[--i]} ]]" || unset "$1[i]" # ensures last element isn't empty
|
||||||
|
}
|
||||||
|
|
||||||
|
kube::util::trap_add() {
|
||||||
|
local trap_add_cmd
|
||||||
|
trap_add_cmd=$1
|
||||||
|
shift
|
||||||
|
|
||||||
|
for trap_add_name in "$@"; do
|
||||||
|
local existing_cmd
|
||||||
|
local new_cmd
|
||||||
|
|
||||||
|
# Grab the currently defined trap commands for this trap
|
||||||
|
existing_cmd=$(trap -p "${trap_add_name}" | awk -F"'" '{print $2}')
|
||||||
|
|
||||||
|
if [[ -z "${existing_cmd}" ]]; then
|
||||||
|
new_cmd="${trap_add_cmd}"
|
||||||
|
else
|
||||||
|
new_cmd="${trap_add_cmd};${existing_cmd}"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Assign the test. Disable the shellcheck warning telling that trap
|
||||||
|
# commands should be single quoted to avoid evaluating them at this
|
||||||
|
# point instead evaluating them at run time. The logic of adding new
|
||||||
|
# commands to a single trap requires them to be evaluated right away.
|
||||||
|
# shellcheck disable=SC2064
|
||||||
|
trap "${new_cmd}" "${trap_add_name}"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
|
||||||
72
hack/dep.py
72
hack/dep.py
|
|
@ -1,72 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# Copyright 2017 The Kubernetes Authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
# This python script helps sync godeps from the k8s repos into our git submodules
|
|
||||||
# It generates bash commands where changes are needed
|
|
||||||
# We can probably also use it for deps when the time comes!
|
|
||||||
|
|
||||||
import json
|
|
||||||
import os
|
|
||||||
import subprocess
|
|
||||||
from os.path import join
|
|
||||||
|
|
||||||
if not os.environ['GOPATH']:
|
|
||||||
raise Exception("Must set GOPATH")
|
|
||||||
|
|
||||||
kops_dir = join(os.environ['GOPATH'], 'src', 'k8s.io', 'kops')
|
|
||||||
k8s_dir = join(os.environ['GOPATH'], 'src', 'k8s.io', 'kubernetes')
|
|
||||||
|
|
||||||
with open(join(k8s_dir, 'Godeps', 'Godeps.json')) as data_file:
|
|
||||||
godeps = json.load(data_file)
|
|
||||||
|
|
||||||
# For debugging, because dep status is unbearably slow
|
|
||||||
# dep status -json | jq .> dep-status.json
|
|
||||||
# with open(join(kops_dir, 'dep-status.json')) as data_file:
|
|
||||||
# dep_status = json.load(data_file)
|
|
||||||
|
|
||||||
process = subprocess.Popen(['dep', 'status', '-json'], stdout=subprocess.PIPE, cwd=kops_dir)
|
|
||||||
dep_status_stdout, err = process.communicate()
|
|
||||||
dep_status = json.loads(dep_status_stdout)
|
|
||||||
|
|
||||||
#pprint(godeps)
|
|
||||||
|
|
||||||
godep_map = {}
|
|
||||||
for godep in godeps['Deps']:
|
|
||||||
#print("%s %s" % (godep['ImportPath'], godep['Rev']))
|
|
||||||
godep_map[godep['ImportPath']] = godep['Rev']
|
|
||||||
|
|
||||||
dep_status_map = {}
|
|
||||||
for dep in dep_status:
|
|
||||||
#print("%s %s" % (godep['ImportPath'], godep['Rev']))
|
|
||||||
dep_status_map[dep['ProjectRoot']] = dep['Revision']
|
|
||||||
|
|
||||||
|
|
||||||
for dep in dep_status_map:
|
|
||||||
sha = dep_status_map.get(dep)
|
|
||||||
godep_sha = godep_map.get(dep)
|
|
||||||
if not godep_sha:
|
|
||||||
for k in godep_map:
|
|
||||||
if k.startswith(dep):
|
|
||||||
godep_sha = godep_map[k]
|
|
||||||
break
|
|
||||||
if godep_sha:
|
|
||||||
if godep_sha != sha:
|
|
||||||
print("# update needed: %s %s vs %s" % (dep, godep_sha, sha))
|
|
||||||
print("[[override]]")
|
|
||||||
print(' name = "%s"' % (dep))
|
|
||||||
print(' revision = "%s"' % (godep_sha))
|
|
||||||
else:
|
|
||||||
print("# UNKNOWN dep %s" % dep)
|
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
#
|
#
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
KOPS_DIRECTORY="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check that required binaries are installed
|
# Check that required binaries are installed
|
||||||
|
|
@ -85,7 +85,7 @@ NETWORKING=${NETWORKING:-weave}
|
||||||
# How verbose go logging is
|
# How verbose go logging is
|
||||||
VERBOSITY=${VERBOSITY:-10}
|
VERBOSITY=${VERBOSITY:-10}
|
||||||
|
|
||||||
cd $KOPS_DIRECTORY/..
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
GIT_VER=git-$(git describe --always)
|
GIT_VER=git-$(git describe --always)
|
||||||
[ -z "$GIT_VER" ] && echo "we do not have GIT_VER something is very wrong" && exit 1;
|
[ -z "$GIT_VER" ] && echo "we do not have GIT_VER something is very wrong" && exit 1;
|
||||||
|
|
|
||||||
|
|
@ -1,42 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Copyright 2019 The Kubernetes Authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
if ! [ -z $DEBUG ]; then
|
|
||||||
set -x
|
|
||||||
fi
|
|
||||||
|
|
||||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
|
||||||
|
|
||||||
if [ "$COMPONENT" != "docs" ]; then
|
|
||||||
echo "This task runs only to publish docs"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
make -C ${DIR}/.. build-docs
|
|
||||||
|
|
||||||
git config --global user.email "travis@travis-ci.com"
|
|
||||||
git config --global user.name "Travis Bot"
|
|
||||||
|
|
||||||
git clone --branch=gh-pages --depth=1 https://${GH_REF} ${DIR}/gh-pages
|
|
||||||
cd ${DIR}/gh-pages
|
|
||||||
|
|
||||||
git rm -r .
|
|
||||||
|
|
||||||
cp -r ${DIR}/../site/* .
|
|
||||||
|
|
||||||
git add .
|
|
||||||
git commit -m "Deploy GitHub Pages"
|
|
||||||
git push --force --quiet "https://${GH_TOKEN}@${GH_REF}" gh-pages > /dev/null 2>&1
|
|
||||||
|
|
@ -18,21 +18,15 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KOPS_ROOT=$(git rev-parse --show-toplevel)
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
cd ${KOPS_ROOT}
|
|
||||||
|
|
||||||
export GOPATH=${KOPS_ROOT}/../../../
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
TMP_OUT=$(mktemp -d)
|
TMP_OUT=$(mktemp -d)
|
||||||
trap "{ rm -rf ${TMP_OUT}; }" EXIT
|
trap "{ rm -rf ${TMP_OUT}; }" EXIT
|
||||||
|
|
||||||
GOBIN="${TMP_OUT}" go install ./vendor/github.com/bazelbuild/bazel-gazelle/cmd/gazelle
|
GOBIN="${TMP_OUT}" go install ./vendor/github.com/bazelbuild/bazel-gazelle/cmd/gazelle
|
||||||
|
|
||||||
# manually remove BUILD file for k8s.io/apimachinery/pkg/util/sets/BUILD if it
|
|
||||||
# exists; there is a specific set-gen rule that breaks importing
|
|
||||||
# ref: https://github.com/kubernetes/kubernetes/blob/4e2f5e2212b05a305435ef96f4b49dc0932e1264/staging/src/k8s.io/apimachinery/pkg/util/sets/BUILD#L23-L49
|
|
||||||
# rm -f ${KOPS_ROOT}/vendor/k8s.io/apimachinery/pkg/util/sets/{BUILD,BUILD.bazel}
|
|
||||||
|
|
||||||
"${TMP_OUT}/gazelle" fix \
|
"${TMP_OUT}/gazelle" fix \
|
||||||
-external=vendored \
|
-external=vendored \
|
||||||
-mode=fix \
|
-mode=fix \
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KOPS_ROOT=$(git rev-parse --show-toplevel)
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
cd ${KOPS_ROOT}
|
|
||||||
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
# Update gobindata to reflect any yaml changes
|
# Update gobindata to reflect any yaml changes
|
||||||
make kops-gobindata
|
make kops-gobindata
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
. $(dirname "${BASH_SOURCE}")/common.sh
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
|
|
||||||
BAD_HEADERS=$((${KUBE_ROOT}/hack/verify-boilerplate.sh || true) | awk '{ print $7}')
|
BAD_HEADERS=$((${KOPS_ROOT}/hack/verify-boilerplate.sh || true) | awk '{ print $7}')
|
||||||
FORMATS="sh go Makefile Dockerfile"
|
FORMATS="sh go Makefile Dockerfile"
|
||||||
|
|
||||||
YEAR=`date +%Y`
|
YEAR=`date +%Y`
|
||||||
|
|
@ -27,7 +27,7 @@ do
|
||||||
for j in ${BAD_HEADERS}
|
for j in ${BAD_HEADERS}
|
||||||
do
|
do
|
||||||
:
|
:
|
||||||
HEADER=$(cat ${KUBE_ROOT}/hack/boilerplate/boilerplate.${i}.txt | sed "s/YEAR/${YEAR}/")
|
HEADER=$(cat ${KOPS_ROOT}/hack/boilerplate/boilerplate.${i}.txt | sed "s/YEAR/${YEAR}/")
|
||||||
value=$(<${j})
|
value=$(<${j})
|
||||||
if [[ "$j" != *$i ]]
|
if [[ "$j" != *$i ]]
|
||||||
then
|
then
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,9 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KOPS_ROOT=$(git rev-parse --show-toplevel)
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
|
|
||||||
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
export API_OPTIONS="--verify-only"
|
export API_OPTIONS="--verify-only"
|
||||||
if make apimachinery-codegen; then
|
if make apimachinery-codegen; then
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,9 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
KOPS_ROOT=$(git rev-parse --show-toplevel)
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
cd ${KOPS_ROOT}
|
|
||||||
|
|
||||||
export GOPATH=${KOPS_ROOT}/../../../
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
TMP_OUT=$(mktemp -d)
|
TMP_OUT=$(mktemp -d)
|
||||||
trap "{ rm -rf ${TMP_OUT}; }" EXIT
|
trap "{ rm -rf ${TMP_OUT}; }" EXIT
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
. $(dirname "${BASH_SOURCE}")/common.sh
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
|
|
||||||
boiler="${KUBE_ROOT}/hack/boilerplate/boilerplate.py $@"
|
boiler="${KOPS_ROOT}/hack/boilerplate/boilerplate.py $@"
|
||||||
|
|
||||||
files_need_boilerplate=( `${boiler}` )
|
files_need_boilerplate=( `${boiler}` )
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ if [[ -z ${files_need_boilerplate+x} ]]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TO_REMOVE=(${PWD}/federation/model/bindata.go ${PWD}/upup/models/bindata.go)
|
TO_REMOVE=(${KOPS_ROOT}/federation/model/bindata.go ${KOPS_ROOT}/upup/models/bindata.go)
|
||||||
TEMP_ARRAY=()
|
TEMP_ARRAY=()
|
||||||
|
|
||||||
for pkg in "${files_need_boilerplate[@]}"; do
|
for pkg in "${files_need_boilerplate[@]}"; do
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,8 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KOPS_ROOT=$(git rev-parse --show-toplevel)
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
|
|
||||||
cd "${KOPS_ROOT}"
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
make crds
|
make crds
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,9 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
. $(dirname "${BASH_SOURCE}")/common.sh
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
|
|
||||||
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
GOFMT="bazel run //:gofmt -- -s -w"
|
GOFMT="bazel run //:gofmt -- -s -w"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
export REPO_ROOT="${REPO_ROOT:-$(git rev-parse --show-toplevel)}"
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
cd "${REPO_ROOT}"
|
|
||||||
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
changes=$(git status --porcelain || true)
|
changes=$(git status --porcelain || true)
|
||||||
if [ -n "${changes}" ]; then
|
if [ -n "${changes}" ]; then
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,10 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
. $(dirname "${BASH_SOURCE}")/common.sh
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
|
|
||||||
# Check that the .packages file contains all packages
|
# Check that the .packages file contains all packages
|
||||||
packages_file="${KUBE_ROOT}/hack/.packages"
|
packages_file="${KOPS_ROOT}/hack/.packages"
|
||||||
if ! diff -u "${packages_file}" <(go list k8s.io/kops/... | grep -v vendor); then
|
if ! diff -u "${packages_file}" <(go list k8s.io/kops/... | grep -v vendor); then
|
||||||
{
|
{
|
||||||
echo
|
echo
|
||||||
|
|
|
||||||
|
|
@ -18,45 +18,7 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/..
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
|
|
||||||
kube::util::array_contains() {
|
|
||||||
local search="$1"
|
|
||||||
local element
|
|
||||||
shift
|
|
||||||
for element; do
|
|
||||||
if [[ "${element}" == "${search}" ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
kube::util::trap_add() {
|
|
||||||
local trap_add_cmd
|
|
||||||
trap_add_cmd=$1
|
|
||||||
shift
|
|
||||||
|
|
||||||
for trap_add_name in "$@"; do
|
|
||||||
local existing_cmd
|
|
||||||
local new_cmd
|
|
||||||
|
|
||||||
# Grab the currently defined trap commands for this trap
|
|
||||||
existing_cmd=$(trap -p "${trap_add_name}" | awk -F"'" '{print $2}')
|
|
||||||
|
|
||||||
if [[ -z "${existing_cmd}" ]]; then
|
|
||||||
new_cmd="${trap_add_cmd}"
|
|
||||||
else
|
|
||||||
new_cmd="${trap_add_cmd};${existing_cmd}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Assign the test. Disable the shellcheck warning telling that trap
|
|
||||||
# commands should be single quoted to avoid evaluating them at this
|
|
||||||
# point instead evaluating them at run time. The logic of adding new
|
|
||||||
# commands to a single trap requires them to be evaluated right away.
|
|
||||||
# shellcheck disable=SC2064
|
|
||||||
trap "${new_cmd}" "${trap_add_name}"
|
|
||||||
done
|
|
||||||
}
|
|
||||||
|
|
||||||
# required version for this script, if not installed on the host we will
|
# required version for this script, if not installed on the host we will
|
||||||
# use the official docker image instead. keep this in sync with SHELLCHECK_IMAGE
|
# use the official docker image instead. keep this in sync with SHELLCHECK_IMAGE
|
||||||
|
|
@ -92,7 +54,7 @@ create_container () {
|
||||||
# we're done.
|
# we're done.
|
||||||
# This is incredibly much faster than creating a container for each shellcheck
|
# This is incredibly much faster than creating a container for each shellcheck
|
||||||
# call ...
|
# call ...
|
||||||
docker run --name "${SHELLCHECK_CONTAINER}" -d --rm -v "${KUBE_ROOT}:${KUBE_ROOT}" -w "${KUBE_ROOT}" --entrypoint="sleep" "${SHELLCHECK_IMAGE}" 2147483647
|
docker run --name "${SHELLCHECK_CONTAINER}" -d --rm -v "${KOPS_ROOT}:/go/src/k8s.io/kops" -w "/go/src/k8s.io/kops" --entrypoint="sleep" "${SHELLCHECK_IMAGE}" 2147483647
|
||||||
}
|
}
|
||||||
# removes the shellcheck container
|
# removes the shellcheck container
|
||||||
remove_container () {
|
remove_container () {
|
||||||
|
|
@ -100,7 +62,7 @@ remove_container () {
|
||||||
}
|
}
|
||||||
|
|
||||||
# ensure we're linting the k8s source tree
|
# ensure we're linting the k8s source tree
|
||||||
cd "${KUBE_ROOT}"
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
# Find all shell scripts excluding:
|
# Find all shell scripts excluding:
|
||||||
# - Anything git-ignored - No need to lint untracked files.
|
# - Anything git-ignored - No need to lint untracked files.
|
||||||
|
|
@ -121,7 +83,7 @@ done < <(find . -name "*.sh" \
|
||||||
\))
|
\))
|
||||||
|
|
||||||
# make sure known failures are sorted
|
# make sure known failures are sorted
|
||||||
failure_file="${KUBE_ROOT}/hack/.shellcheck_failures"
|
failure_file="${KOPS_ROOT}/hack/.shellcheck_failures"
|
||||||
if ! diff -u "${failure_file}" <(LC_ALL=C sort "${failure_file}"); then
|
if ! diff -u "${failure_file}" <(LC_ALL=C sort "${failure_file}"); then
|
||||||
{
|
{
|
||||||
echo
|
echo
|
||||||
|
|
|
||||||
|
|
@ -18,10 +18,11 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
REPO_ROOT=$(git rev-parse --show-toplevel)
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
cd "${REPO_ROOT}"
|
|
||||||
|
|
||||||
OUTPUT_GOBIN="${REPO_ROOT}/_output/bin"
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
|
OUTPUT_GOBIN="${KOPS_ROOT}/_output/bin"
|
||||||
|
|
||||||
# Install tools we need, but from vendor/
|
# Install tools we need, but from vendor/
|
||||||
GOBIN="${OUTPUT_GOBIN}" go install ./vendor/github.com/client9/misspell/cmd/misspell
|
GOBIN="${OUTPUT_GOBIN}" go install ./vendor/github.com/client9/misspell/cmd/misspell
|
||||||
|
|
|
||||||
|
|
@ -18,26 +18,7 @@ set -o errexit
|
||||||
set -o nounset
|
set -o nounset
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
|
||||||
KUBE_ROOT=$(git rev-parse --show-toplevel)
|
. "$(dirname "${BASH_SOURCE[0]}")/common.sh"
|
||||||
|
|
||||||
kube::util::array_contains() {
|
|
||||||
local search="$1"
|
|
||||||
local element
|
|
||||||
shift
|
|
||||||
for element; do
|
|
||||||
if [[ "${element}" == "${search}" ]]; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
function kube::util::read-array {
|
|
||||||
local i=0
|
|
||||||
unset -v "$1"
|
|
||||||
while IFS= read -r "$1[i++]"; do :; done
|
|
||||||
eval "[[ \${$1[--i]} ]]" || unset "$1[i]" # ensures last element isn't empty
|
|
||||||
}
|
|
||||||
|
|
||||||
FOCUS="${1:-}"
|
FOCUS="${1:-}"
|
||||||
|
|
||||||
|
|
@ -65,7 +46,7 @@ IGNORE=(
|
||||||
export IFS='|'; ignore_pattern="^(${IGNORE[*]})\$"; unset IFS
|
export IFS='|'; ignore_pattern="^(${IGNORE[*]})\$"; unset IFS
|
||||||
|
|
||||||
# Ensure that we find the binaries we build before anything else.
|
# Ensure that we find the binaries we build before anything else.
|
||||||
export GOBIN="${KUBE_ROOT}/_output/bin"
|
export GOBIN="${KOPS_ROOT}/_output/bin"
|
||||||
PATH="${GOBIN}:${PATH}"
|
PATH="${GOBIN}:${PATH}"
|
||||||
|
|
||||||
# Install staticcheck from vendor
|
# Install staticcheck from vendor
|
||||||
|
|
@ -73,10 +54,10 @@ echo 'installing staticcheck from vendor'
|
||||||
|
|
||||||
go install k8s.io/kops/vendor/honnef.co/go/tools/cmd/staticcheck
|
go install k8s.io/kops/vendor/honnef.co/go/tools/cmd/staticcheck
|
||||||
|
|
||||||
cd "${KUBE_ROOT}"
|
cd "${KOPS_ROOT}"
|
||||||
|
|
||||||
# Check that the file is in alphabetical order
|
# Check that the file is in alphabetical order
|
||||||
failure_file="${KUBE_ROOT}/hack/.staticcheck_failures"
|
failure_file="${KOPS_ROOT}/hack/.staticcheck_failures"
|
||||||
if ! diff -u "${failure_file}" <(LC_ALL=C sort "${failure_file}"); then
|
if ! diff -u "${failure_file}" <(LC_ALL=C sort "${failure_file}"); then
|
||||||
{
|
{
|
||||||
echo
|
echo
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue