forked from kubernetes/ingress-nginx
-
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.
Merge pull request kubernetes#1791 from aledbf/fix-headers
Fix verification of boilerplate, style and file headers
- Loading branch information
Showing
20 changed files
with
297 additions
and
18 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
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
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
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2014 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. | ||
|
||
# Some useful colors. | ||
if [[ -z "${color_start-}" ]]; then | ||
declare -r color_start="\033[" | ||
declare -r color_red="${color_start}0;31m" | ||
declare -r color_yellow="${color_start}0;33m" | ||
declare -r color_green="${color_start}0;32m" | ||
declare -r color_norm="${color_start}0m" | ||
fi | ||
|
||
# Returns the server version as MMmmpp, with MM as the major | ||
# component, mm the minor component, and pp as the patch | ||
# revision. e.g. 0.7.1 is echoed as 701, and 1.0.11 would be | ||
# 10011. (This makes for easy integer comparison in bash.) | ||
function kube_server_version() { | ||
local server_version | ||
local major | ||
local minor | ||
local patch | ||
|
||
# This sed expression is the POSIX BRE to match strings like: | ||
# Server Version: &version.Info{Major:"0", Minor:"7+", GitVersion:"v0.7.0-dirty", GitCommit:"ad44234f7152e9c66bc2853575445c7071335e57", GitTreeState:"dirty"} | ||
# and capture the GitVersion portion (which has the patch level) | ||
server_version=$(${KUBECTL} --match-server-version=false version | grep "Server Version:") | ||
read major minor patch < <( | ||
echo ${server_version} | \ | ||
sed "s/.*GitVersion:\"v\([0-9]\{1,\}\)\.\([0-9]\{1,\}\)\.\([0-9]\{1,\}\).*/\1 \2 \3/") | ||
printf "%02d%02d%02d" ${major} ${minor} ${patch} | sed 's/^0*//' | ||
} |
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 |
---|---|---|
@@ -0,0 +1,78 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2014 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. | ||
source "${KUBE_ROOT}/hack/kube-env.sh" | ||
|
||
SILENT=true | ||
|
||
function is-excluded { | ||
for e in $EXCLUDE; do | ||
if [[ $1 -ef ${BASH_SOURCE} ]]; then | ||
return | ||
fi | ||
if [[ $1 -ef "$KUBE_ROOT/hack/$e" ]]; then | ||
return | ||
fi | ||
done | ||
return 1 | ||
} | ||
|
||
while getopts ":v" opt; do | ||
case $opt in | ||
v) | ||
SILENT=false | ||
;; | ||
\?) | ||
echo "Invalid flag: -$OPTARG" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
|
||
if $SILENT ; then | ||
echo "Running in the silent mode, run with -v if you want to see script logs." | ||
fi | ||
|
||
EXCLUDE="verify-all.sh verify-codegen.sh" | ||
|
||
ret=0 | ||
for t in `ls $KUBE_ROOT/hack/verify-*.sh` | ||
do | ||
if is-excluded $t ; then | ||
echo "Skipping $t" | ||
continue | ||
fi | ||
if $SILENT ; then | ||
echo -e "Verifying $t" | ||
if bash "$t" &> /dev/null; then | ||
echo -e "${color_green}SUCCESS${color_norm}" | ||
else | ||
echo -e "${color_red}FAILED${color_norm}" | ||
ret=1 | ||
fi | ||
else | ||
bash "$t" || ret=1 | ||
fi | ||
done | ||
|
||
exit $ret | ||
|
||
# ex: ts=2 sw=2 et filetype=sh |
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
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2014 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. | ||
|
||
# GoFmt apparently is changing @ head... | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. | ||
|
||
cd "${KUBE_ROOT}" | ||
|
||
find_files() { | ||
find . -not \( \ | ||
\( \ | ||
-wholename './.git' \ | ||
-o -wholename '*/vendor/*' \ | ||
-o -wholename '*bindata.go' \ | ||
\) -prune \ | ||
\) -name '*.go' | ||
} | ||
|
||
GOFMT="gofmt -s" | ||
bad_files=$(find_files | xargs $GOFMT -l) | ||
if [[ -n "${bad_files}" ]]; then | ||
echo "!!! '$GOFMT' needs to be run on the following files: " | ||
echo "${bad_files}" | ||
exit 1 | ||
fi |
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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
# Copyright 2014 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
KUBE_ROOT=$(dirname "${BASH_SOURCE}")/.. | ||
|
||
cd "${KUBE_ROOT}" | ||
|
||
GOLINT=${GOLINT:-"golint"} | ||
PACKAGES=($(go list ./... | grep -v /vendor/ | grep -v /test\/e2e/)) | ||
bad_files=() | ||
for package in "${PACKAGES[@]}"; do | ||
out=$("${GOLINT}" -min_confidence=0.9 "${package}") | ||
if [[ -n "${out}" ]]; then | ||
bad_files+=("${out}") | ||
fi | ||
done | ||
if [[ "${#bad_files[@]}" -ne 0 ]]; then | ||
echo "!!! '$GOLINT' problems: " | ||
echo "${bad_files[@]}" | ||
exit 1 | ||
fi | ||
|
||
# ex: ts=2 sw=2 et filetype=sh |
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
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
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
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
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
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
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
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
Oops, something went wrong.