From dd96199e353a45944408fd5b15b50ec26e7f1fd8 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Fri, 1 Nov 2019 11:41:17 -0700 Subject: [PATCH] Add license header to files (#8) Signed-off-by: Tamal Saha --- Dockerfile.dbg | 14 ++++++++++ Dockerfile.in | 14 ++++++++++ Makefile | 30 ++++++++++++++++++++- cmd/stash-percona-xtradb/main.go | 15 +++++++++++ cmd/stash-percona-xtradb/version.go | 15 +++++++++++ hack/build.sh | 3 +-- hack/docker/stash-percona-xtradb/backup.sh | 14 ++++++++++ hack/docker/stash-percona-xtradb/restore.sh | 14 ++++++++++ hack/e2e.sh | 29 ++++++++++++++++++++ hack/fmt.sh | 2 +- hack/license/bash.txt | 13 +++++++++ hack/license/dockerfile.txt | 13 +++++++++ hack/license/go.txt | 15 +++++++++++ hack/license/makefile.txt | 14 ++++++++++ hack/test.sh | 7 +++-- pkg/backup.go | 15 +++++++++++ pkg/restore.go | 15 +++++++++++ pkg/root.go | 15 +++++++++++ pkg/utils.go | 15 +++++++++++ 19 files changed, 264 insertions(+), 8 deletions(-) create mode 100755 hack/e2e.sh create mode 100644 hack/license/bash.txt create mode 100644 hack/license/dockerfile.txt create mode 100644 hack/license/go.txt create mode 100644 hack/license/makefile.txt diff --git a/Dockerfile.dbg b/Dockerfile.dbg index 80a6bbbbc..3ffc47039 100644 --- a/Dockerfile.dbg +++ b/Dockerfile.dbg @@ -1,3 +1,17 @@ +# Copyright The Stash 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. + FROM debian:stretch ENV DEBIAN_FRONTEND noninteractive diff --git a/Dockerfile.in b/Dockerfile.in index 26b5564e0..eb292ef1b 100644 --- a/Dockerfile.in +++ b/Dockerfile.in @@ -1,3 +1,17 @@ +# Copyright The Stash 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. + FROM debian:stretch ENV DEBIAN_FRONTEND noninteractive diff --git a/Makefile b/Makefile index 020293db8..ab6a03dc5 100644 --- a/Makefile +++ b/Makefile @@ -91,6 +91,8 @@ BUILD_DIRS := bin/$(OS)_$(ARCH) \ DOCKERFILE_PROD = Dockerfile.in DOCKERFILE_DBG = Dockerfile.dbg +DOCKER_REPO_ROOT := /go/src/$(GO_PKG)/$(REPO) + # If you want to build all binaries, see the 'all-build' rule. # If you want to build all containers, see the 'all-container' rule. # If you want to build AND push all containers, see the 'all-push' rule. @@ -307,8 +309,34 @@ verify-gen: gen fmt echo "files are out of date, run make gen fmt"; exit 1; \ fi +.PHONY: add-license +add-license: + @echo "Adding license header" + @docker run --rm \ + -u $$(id -u):$$(id -g) \ + -v /tmp:/.cache \ + -v $$(pwd):$(DOCKER_REPO_ROOT) \ + -w $(DOCKER_REPO_ROOT) \ + --env HTTP_PROXY=$(HTTP_PROXY) \ + --env HTTPS_PROXY=$(HTTPS_PROXY) \ + $(BUILD_IMAGE) \ + ltag -t "./hack/license" --excludes "vendor contrib" -v + +.PHONY: check-license +check-license: + @echo "Checking files for license header" + @docker run --rm \ + -u $$(id -u):$$(id -g) \ + -v /tmp:/.cache \ + -v $$(pwd):$(DOCKER_REPO_ROOT) \ + -w $(DOCKER_REPO_ROOT) \ + --env HTTP_PROXY=$(HTTP_PROXY) \ + --env HTTPS_PROXY=$(HTTPS_PROXY) \ + $(BUILD_IMAGE) \ + ltag -t "./hack/license" --excludes "vendor contrib" --check -v + .PHONY: ci -ci: verify lint build unit-tests #cover +ci: verify check-license lint build unit-tests #cover .PHONY: qa qa: diff --git a/cmd/stash-percona-xtradb/main.go b/cmd/stash-percona-xtradb/main.go index 159cce2a4..f592c0bad 100644 --- a/cmd/stash-percona-xtradb/main.go +++ b/cmd/stash-percona-xtradb/main.go @@ -1,3 +1,18 @@ +/* +Copyright The Stash 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. +*/ package main import ( diff --git a/cmd/stash-percona-xtradb/version.go b/cmd/stash-percona-xtradb/version.go index 1f7379ff7..10c5c70f7 100644 --- a/cmd/stash-percona-xtradb/version.go +++ b/cmd/stash-percona-xtradb/version.go @@ -1,3 +1,18 @@ +/* +Copyright The Stash 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. +*/ package main import ( diff --git a/hack/build.sh b/hack/build.sh index 84ba58ebc..942b174dc 100755 --- a/hack/build.sh +++ b/hack/build.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash -# Copyright 2019 AppsCode Inc. -# Copyright 2016 The Kubernetes Authors. +# Copyright The Stash Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/hack/docker/stash-percona-xtradb/backup.sh b/hack/docker/stash-percona-xtradb/backup.sh index 28a9f8ce8..45c81cd2e 100755 --- a/hack/docker/stash-percona-xtradb/backup.sh +++ b/hack/docker/stash-percona-xtradb/backup.sh @@ -1,5 +1,19 @@ #!/usr/bin/env bash +# Copyright The Stash 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. + cluster_addr=$1 cluster_name=$2 sst_request_opts=$3 diff --git a/hack/docker/stash-percona-xtradb/restore.sh b/hack/docker/stash-percona-xtradb/restore.sh index 7fa332658..6c9349482 100755 --- a/hack/docker/stash-percona-xtradb/restore.sh +++ b/hack/docker/stash-percona-xtradb/restore.sh @@ -1,5 +1,19 @@ #!/usr/bin/env bash +# Copyright The Stash 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. + datadir=$1 xbstream -x -C $datadir diff --git a/hack/e2e.sh b/hack/e2e.sh new file mode 100755 index 000000000..7a8f05da0 --- /dev/null +++ b/hack/e2e.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +# Copyright The Stash 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 -eou pipefail + +export CGO_ENABLED=1 +export GO111MODULE=on +export GOFLAGS="-mod=vendor" + +GINKGO_ARGS=${GINKGO_ARGS:-} +TEST_ARGS=${TEST_ARGS:-} +DOCKER_REGISTRY=${DOCKER_REGISTRY:-} + +echo "Running e2e tests:" +cmd="ginkgo -r --v -race --progress --trace --noisyPendings=false ${GINKGO_ARGS} test -- --docker-registry=${DOCKER_REGISTRY} ${TEST_ARGS}" +echo $cmd; $cmd diff --git a/hack/fmt.sh b/hack/fmt.sh index 34cab84e7..307373fd3 100755 --- a/hack/fmt.sh +++ b/hack/fmt.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# Copyright 2019 AppsCode Inc. +# Copyright The Stash Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/hack/license/bash.txt b/hack/license/bash.txt new file mode 100644 index 000000000..ebb19f843 --- /dev/null +++ b/hack/license/bash.txt @@ -0,0 +1,13 @@ +# Copyright The Stash 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/hack/license/dockerfile.txt b/hack/license/dockerfile.txt new file mode 100644 index 000000000..ebb19f843 --- /dev/null +++ b/hack/license/dockerfile.txt @@ -0,0 +1,13 @@ +# Copyright The Stash 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/hack/license/go.txt b/hack/license/go.txt new file mode 100644 index 000000000..d68e18716 --- /dev/null +++ b/hack/license/go.txt @@ -0,0 +1,15 @@ +/* +Copyright The Stash 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/hack/license/makefile.txt b/hack/license/makefile.txt new file mode 100644 index 000000000..afae7977e --- /dev/null +++ b/hack/license/makefile.txt @@ -0,0 +1,14 @@ +# Copyright 2019 AppsCode Inc. +# Copyright 2016 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. diff --git a/hack/test.sh b/hack/test.sh index c1ee50047..d87a68311 100755 --- a/hack/test.sh +++ b/hack/test.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash -# Copyright 2019 AppsCode Inc. -# Copyright 2016 The Kubernetes Authors. +# Copyright The Stash Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,12 +16,12 @@ set -eou pipefail -export CGO_ENABLED=0 +export CGO_ENABLED=1 export GO111MODULE=on export GOFLAGS="-mod=vendor" TARGETS=$(for d in "$@"; do echo ./$d/...; done) echo "Running tests:" -go test -installsuffix "static" ${TARGETS} +go test -race -installsuffix "static" ${TARGETS} echo diff --git a/pkg/backup.go b/pkg/backup.go index 8acd6d005..aca77596c 100644 --- a/pkg/backup.go +++ b/pkg/backup.go @@ -1,3 +1,18 @@ +/* +Copyright The Stash 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. +*/ package pkg import ( diff --git a/pkg/restore.go b/pkg/restore.go index 50f0c6bb2..c545936e4 100644 --- a/pkg/restore.go +++ b/pkg/restore.go @@ -1,3 +1,18 @@ +/* +Copyright The Stash 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. +*/ package pkg import ( diff --git a/pkg/root.go b/pkg/root.go index 35290cfbf..84ef8bb56 100644 --- a/pkg/root.go +++ b/pkg/root.go @@ -1,3 +1,18 @@ +/* +Copyright The Stash 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. +*/ package pkg import ( diff --git a/pkg/utils.go b/pkg/utils.go index bcd43b8cb..cef4d7224 100644 --- a/pkg/utils.go +++ b/pkg/utils.go @@ -1,3 +1,18 @@ +/* +Copyright The Stash 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. +*/ package pkg import (