This repository has been archived by the owner on Jan 29, 2025. It is now read-only.
forked from kubernetes-retired/external-storage
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
389 additions
and
11 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 |
---|---|---|
@@ -1 +1,6 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
/bazel-* |
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,19 @@ | ||
language: go | ||
|
||
go: | ||
- master | ||
|
||
before_install: | ||
- go get -u github.com/alecthomas/gometalinter | ||
|
||
install: | ||
- gometalinter --install | ||
- go get -u github.com/bazelbuild/buildifier/buildifier | ||
|
||
build: | ||
- true | ||
|
||
script: | ||
- verify/verify-boilerplate.sh --rootdir="${TRAVIS_BUILD_DIR}" -v | ||
- verify/verify-go-src.sh --rootdir "${TRAVIS_BUILD_DIR}" -v | ||
- buildifier -mode=check $(find . -name BUILD -o -name '*.bzl' -type f) |
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,52 @@ | ||
# Verification scripts | ||
|
||
Collection of scripts that verifies that a project meets requirements set for kubernetes related projects. The scripts are to be invoked depending on the needs via CI tooling, such as Travis CI. See main Readme file on how to integrate the repo-infra in your project. | ||
|
||
The scripts are currently being migrated from the main kubernetes repository. If your project requires additional set of verifications, consider creating an issue/PR on repo-infra to avoid code duplication across multiple projects. | ||
|
||
If repo-infra is integrated at the root of your project as git submodule at path: `/repo-infra`, | ||
then scripts can be invoked as `repo-infra/verify/verify-*.sh` | ||
|
||
travis.yaml example: | ||
|
||
``` | ||
dist: trusty | ||
os: | ||
- linux | ||
language: go | ||
go: | ||
- 1.8 | ||
before_install: | ||
- go get -u github.com/alecthomas/gometalinter | ||
install: | ||
- gometalinter --install | ||
script: | ||
- repo-infra/verify/verify-go-src.sh -v | ||
- repo-infra/verify/verify-boilerplate.sh | ||
# OR with vendoring | ||
# - vendor/github.com/kubernetes/repo-infra/verify-go-src.sh --rootdir=$(pwd) -v | ||
``` | ||
|
||
## Verify boilerplate | ||
|
||
Verifies that the boilerplate for various formats (go files, Makefile, etc.) is included in each file: `verify-boilerplate.sh`. | ||
|
||
## Verify go source code | ||
|
||
Runs a set of scripts on the go source code excluding vendored files: `verify-go-src.sh`. Expects `gometalinter` tooling installed (see travis file above) | ||
|
||
With git submodule from your repo root: `repo-infra/verify/verify-go-src.sh -v` | ||
|
||
With vendoring: `vendor/repo-infra/verify/verify-go-src.sh -v --rootdir $(pwd)` | ||
|
||
Checks include: | ||
|
||
1. gofmt | ||
2. gometalinter | ||
3. govet |
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,34 @@ | ||
#!/bin/bash | ||
# 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
find_files() { | ||
find . -not \( \ | ||
\( \ | ||
-wholename '*/vendor/*' \ | ||
\) -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,31 @@ | ||
#!/bin/bash | ||
# 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
for d in $(find . -type d -not -iwholename '*.git*' -a -not -iname '.tool' -a -not -iwholename '*vendor*'); do | ||
gometalinter --deadline=50s --vendor \ | ||
--cyclo-over=50 --dupl-threshold=100 \ | ||
--exclude=".*should not use dot imports \(golint\)$" \ | ||
--disable-all \ | ||
--enable=vet \ | ||
--enable=deadcode \ | ||
--enable=golint \ | ||
--enable=vetshadow \ | ||
--enable=gocyclo \ | ||
--tests "${d}" | ||
done |
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,20 @@ | ||
#!/bin/bash | ||
# 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. | ||
|
||
set -o errexit | ||
set -o nounset | ||
set -o pipefail | ||
|
||
go vet -v $(go list ./... | grep -v /vendor/) |
Oops, something went wrong.