From 5199d2052e54a5393e9d9ce1a6eb70ff1c54eb99 Mon Sep 17 00:00:00 2001 From: Tamal Saha Date: Fri, 1 Nov 2019 13:14:56 -0700 Subject: [PATCH] Add license header to files (#11) Signed-off-by: Tamal Saha --- .github/workflows/ci.yml | 5 ++++- .github/workflows/release.yml | 1 + Dockerfile.dbg | 14 ++++++++++++++ Dockerfile.in | 14 ++++++++++++++ Makefile | 30 +++++++++++++++++++++++++++++- cmd/stash-mongodb/main.go | 16 ++++++++++++++++ cmd/stash-mongodb/version.go | 16 ++++++++++++++++ hack/build.sh | 3 +-- hack/e2e.sh | 29 +++++++++++++++++++++++++++++ hack/fmt.sh | 2 +- hack/license/bash.txt | 14 ++++++++++++++ hack/license/dockerfile.txt | 14 ++++++++++++++ hack/license/go.txt | 16 ++++++++++++++++ hack/license/makefile.txt | 15 +++++++++++++++ hack/test.sh | 7 +++---- pkg/backup.go | 16 ++++++++++++++++ pkg/restore.go | 16 ++++++++++++++++ pkg/root.go | 16 ++++++++++++++++ pkg/utils.go | 16 ++++++++++++++++ 19 files changed, 251 insertions(+), 9 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/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcad7fb43..2bf932272 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,7 +27,10 @@ jobs: run: echo ${{ steps.buildx.outputs.platforms }} - name: Run checks - run: make ci + run: | + sudo apt-get -qq update + sudo apt-get install -y bzr + make ci - name: Build env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 990a98251..418868dfa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,7 @@ on: push: tags: - '*.*' + - '*.*.*' jobs: diff --git a/Dockerfile.dbg b/Dockerfile.dbg index dbd9eb711..919434c9a 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 98dca9c95..db2832fd9 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 48657cb3b..693350095 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-gen lint build unit-tests #cover +ci: verify check-license lint build unit-tests #cover .PHONY: qa qa: diff --git a/cmd/stash-mongodb/main.go b/cmd/stash-mongodb/main.go index 27d0c6793..6e217df13 100644 --- a/cmd/stash-mongodb/main.go +++ b/cmd/stash-mongodb/main.go @@ -1,3 +1,19 @@ +/* +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-mongodb/version.go b/cmd/stash-mongodb/version.go index 1f7379ff7..a8a09748f 100644 --- a/cmd/stash-mongodb/version.go +++ b/cmd/stash-mongodb/version.go @@ -1,3 +1,19 @@ +/* +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/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..b04243c16 --- /dev/null +++ b/hack/license/bash.txt @@ -0,0 +1,14 @@ +# 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..b04243c16 --- /dev/null +++ b/hack/license/dockerfile.txt @@ -0,0 +1,14 @@ +# 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..6d8cecd45 --- /dev/null +++ b/hack/license/go.txt @@ -0,0 +1,16 @@ +/* +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..e5d07beb2 --- /dev/null +++ b/hack/license/makefile.txt @@ -0,0 +1,15 @@ +# 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 cdb0edeb2..e755da466 100644 --- a/pkg/backup.go +++ b/pkg/backup.go @@ -1,3 +1,19 @@ +/* +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 f1b97dc2d..e28f83360 100644 --- a/pkg/restore.go +++ b/pkg/restore.go @@ -1,3 +1,19 @@ +/* +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 9f342d304..7f1e9356e 100644 --- a/pkg/root.go +++ b/pkg/root.go @@ -1,3 +1,19 @@ +/* +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 dd6b7e32b..abd009478 100644 --- a/pkg/utils.go +++ b/pkg/utils.go @@ -1,3 +1,19 @@ +/* +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 (