diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7791786..ae86e27 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,9 @@ jobs: - name: Lint run: DOCKER_BUILDKIT=1 make lint + - name: Check licenses + run: DOCKER_BUILDKIT=1 make check-license + - name: Build run: make build diff --git a/Makefile b/Makefile index c2abfc0..f4e2f08 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,17 @@ +# Copyright 2020 The Compose Specification 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. + .DEFAULT_GOAL := help PACKAGE=github.com/compose-spec/compose-ref @@ -25,6 +39,10 @@ build-validate-image: lint: build-validate-image docker run --rm $(IMAGE_PREFIX)validate bash -c "golangci-lint run --config ./golangci.yml ./" +.PHONY: check-license +check-license: build-validate-image + docker run --rm $(IMAGE_PREFIX)validate bash -c "./scripts/validate/fileheader" + .PHONY: setup setup: ## Setup the precommit hook @which pre-commit > /dev/null 2>&1 || (echo "pre-commit not installed see README." && false) diff --git a/ci/Dockerfile b/ci/Dockerfile index cfc9652..8c14b43 100644 --- a/ci/Dockerfile +++ b/ci/Dockerfile @@ -1,3 +1,17 @@ +# Copyright 2020 The Compose Specification 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 golang:1.14 WORKDIR /go/src diff --git a/compose-ref.go b/compose-ref.go index f3d0754..2b01dba 100644 --- a/compose-ref.go +++ b/compose-ref.go @@ -1,3 +1,19 @@ +/* + Copyright 2020 The Compose Specification 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/internal/container.go b/internal/container.go index 31c40c2..03cf53a 100644 --- a/internal/container.go +++ b/internal/container.go @@ -1,3 +1,19 @@ +/* + Copyright 2020 The Compose Specification 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 internal import ( diff --git a/internal/labels.go b/internal/labels.go index 97937a1..df974c6 100644 --- a/internal/labels.go +++ b/internal/labels.go @@ -1,3 +1,19 @@ +/* + Copyright 2020 The Compose Specification 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 internal const ( diff --git a/internal/network.go b/internal/network.go index 8189f04..d221839 100644 --- a/internal/network.go +++ b/internal/network.go @@ -1,3 +1,19 @@ +/* + Copyright 2020 The Compose Specification 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 internal import ( diff --git a/internal/volume.go b/internal/volume.go index 3d8bf99..7f18285 100644 --- a/internal/volume.go +++ b/internal/volume.go @@ -1,3 +1,19 @@ +/* + Copyright 2020 The Compose Specification 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 internal import ( diff --git a/scripts/validate/fileheader b/scripts/validate/fileheader new file mode 100755 index 0000000..5144210 --- /dev/null +++ b/scripts/validate/fileheader @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Copyright The Compose Specification 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 + +BASEPATH="${1-}" + +ltag -t "${BASEPATH}scripts/validate/template" --excludes "validate vendor" --check -v diff --git a/scripts/validate/template/bash.txt b/scripts/validate/template/bash.txt new file mode 100644 index 0000000..6b06a7c --- /dev/null +++ b/scripts/validate/template/bash.txt @@ -0,0 +1,14 @@ +# Copyright 2020 The Compose Specification 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/scripts/validate/template/dockerfile.txt b/scripts/validate/template/dockerfile.txt new file mode 100644 index 0000000..6b06a7c --- /dev/null +++ b/scripts/validate/template/dockerfile.txt @@ -0,0 +1,14 @@ +# Copyright 2020 The Compose Specification 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/scripts/validate/template/go.txt b/scripts/validate/template/go.txt new file mode 100644 index 0000000..8503c40 --- /dev/null +++ b/scripts/validate/template/go.txt @@ -0,0 +1,16 @@ +/* + Copyright 2020 The Compose Specification 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/scripts/validate/template/makefile.txt b/scripts/validate/template/makefile.txt new file mode 100644 index 0000000..6b06a7c --- /dev/null +++ b/scripts/validate/template/makefile.txt @@ -0,0 +1,14 @@ +# Copyright 2020 The Compose Specification 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. +