From f040e6ab59f309da35200ea662fe792963228403 Mon Sep 17 00:00:00 2001 From: Kunal Kushwaha Date: Fri, 2 Mar 2018 14:30:50 +0900 Subject: [PATCH] CI check for file-header added file-header check using github.com/kunalkushwaha/ltag Signed-off-by: Kunal Kushwaha --- .travis.yml | 2 ++ script/validate/dco | 2 +- script/validate/fileheader | 26 +++++++++++++++++++++++++ script/validate/template/bash.txt | 14 +++++++++++++ script/validate/template/dockerfile.txt | 14 +++++++++++++ script/validate/template/go.txt | 16 +++++++++++++++ script/validate/template/makefile.txt | 14 +++++++++++++ 7 files changed, 87 insertions(+), 1 deletion(-) create mode 100755 script/validate/fileheader create mode 100644 script/validate/template/bash.txt create mode 100644 script/validate/template/dockerfile.txt create mode 100644 script/validate/template/go.txt create mode 100644 script/validate/template/makefile.txt diff --git a/.travis.yml b/.travis.yml index 454c68626..7d30d839b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -45,6 +45,7 @@ install: - sudo chmod -R og+r /usr/local/include/google/protobuf/ - protoc --version - go get -u github.com/vbatts/git-validation + - go get -u github.com/kunalkushwaha/ltag - sudo PATH=$PATH GOPATH=$GOPATH script/setup/install-runc - sudo PATH=$PATH GOPATH=$GOPATH script/setup/install-cni - sudo PATH=$PATH GOPATH=$GOPATH script/setup/install-critools @@ -57,6 +58,7 @@ script: - export GOOS=$TRAVIS_GOOS - export CGO_ENABLED=$TRAVIS_CGO_ENABLED - DCO_VERBOSITY=-q script/validate/dco + - script/validate/fileheader - GOOS=linux script/setup/install-dev-tools - script/validate/vendor - go build -i . diff --git a/script/validate/dco b/script/validate/dco index f8000fc8f..9a104ab3e 100755 --- a/script/validate/dco +++ b/script/validate/dco @@ -24,4 +24,4 @@ if ! command -v git-validation; then fi verbosity="${DCO_VERBOSITY--v}" -GIT_CHECK_EXCLUDE="./vendor" git-validation "$verbosity" -run DCO,short-subject,dangling-whitespace +GIT_CHECK_EXCLUDE="./vendor:./script/validate/template" git-validation "$verbosity" -run DCO,short-subject,dangling-whitespace diff --git a/script/validate/fileheader b/script/validate/fileheader new file mode 100755 index 000000000..ef5fa287f --- /dev/null +++ b/script/validate/fileheader @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Copyright The containerd 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 -eu -o pipefail + +if ! command -v ltag; then + >&2 echo "ERROR: ltag not found. Install with:" + >&2 echo " go get -u github.com/kunalkushwaha/ltag" + exit 1 +fi + +ltag -t script/validate/template --check -v diff --git a/script/validate/template/bash.txt b/script/validate/template/bash.txt new file mode 100644 index 000000000..b8424f326 --- /dev/null +++ b/script/validate/template/bash.txt @@ -0,0 +1,14 @@ +# Copyright The containerd 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. + diff --git a/script/validate/template/dockerfile.txt b/script/validate/template/dockerfile.txt new file mode 100644 index 000000000..b8424f326 --- /dev/null +++ b/script/validate/template/dockerfile.txt @@ -0,0 +1,14 @@ +# Copyright The containerd 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. + diff --git a/script/validate/template/go.txt b/script/validate/template/go.txt new file mode 100644 index 000000000..bee278d30 --- /dev/null +++ b/script/validate/template/go.txt @@ -0,0 +1,16 @@ +/* + Copyright The containerd 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. +*/ + diff --git a/script/validate/template/makefile.txt b/script/validate/template/makefile.txt new file mode 100644 index 000000000..b8424f326 --- /dev/null +++ b/script/validate/template/makefile.txt @@ -0,0 +1,14 @@ +# Copyright The containerd 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. +