diff --git a/.copywrite.hcl b/.copywrite.hcl index 5ab4adb7a..aa8c50664 100644 --- a/.copywrite.hcl +++ b/.copywrite.hcl @@ -7,11 +7,8 @@ project { header_ignore = [ "command/asset/*.hcl", "command/agent/bindata_assetfs.go", - # licensed under MPL - ignoring for now until the copywrite tool can support - # multiple licenses per repo. - "api/**", - "drivers/shared/**", - "plugins/**", + "ui/node_modules", + // Enterprise files do not fall under the open source licensing. OSS-ENT // merge conflicts might happen here, please be sure to put new OSS // exceptions above this comment. diff --git a/.github/workflows/copywrite.yml b/.github/workflows/copywrite.yml index 6a225c92f..21e737b43 100644 --- a/.github/workflows/copywrite.yml +++ b/.github/workflows/copywrite.yml @@ -14,6 +14,6 @@ jobs: version: v0.16.4 archive-checksum: c299f830e6eef7e126a3c6ef99ac6f43a3c132d830c769e0d36fa347fa1af254 - name: Check Header Compliance - run: copywrite headers --plan + run: make copywriteheaders permissions: contents: read diff --git a/GNUmakefile b/GNUmakefile index 521bd0013..aa702fbe0 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -428,3 +428,14 @@ test: ## Use this target as a smoke test -count=1 \ -tags "$(GO_TAGS)" \ $(GOTEST_PKGS) + +.PHONY: copywriteheaders +copywriteheaders: + copywrite headers --plan + # Special case for MPL headers in /api, /drivers/shared, /plugins, /jobspec, /jobspec2, and /demo + cd api && $(CURDIR)/scripts/copywrite-exceptions.sh + cd drivers/shared && $(CURDIR)/scripts/copywrite-exceptions.sh + cd plugins && $(CURDIR)/scripts/copywrite-exceptions.sh + cd jobspec && $(CURDIR)/scripts/copywrite-exceptions.sh + cd jobspec2 && $(CURDIR)/scripts/copywrite-exceptions.sh + cd demo && $(CURDIR)/scripts/copywrite-exceptions.sh diff --git a/api/.copywrite.hcl b/api/.copywrite.hcl new file mode 100644 index 000000000..9c88e2373 --- /dev/null +++ b/api/.copywrite.hcl @@ -0,0 +1,8 @@ +schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2023 + + header_ignore = [] +} diff --git a/api/deployments_test.go b/api/deployments_test.go index c3bf046e1..7875c99d4 100644 --- a/api/deployments_test.go +++ b/api/deployments_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package api import ( diff --git a/api/retry_test.go b/api/retry_test.go index c59d3dd9a..4a232f107 100644 --- a/api/retry_test.go +++ b/api/retry_test.go @@ -1,3 +1,6 @@ +// Copyright (c) HashiCorp, Inc. +// SPDX-License-Identifier: MPL-2.0 + package api import ( diff --git a/demo/.copywrite.hcl b/demo/.copywrite.hcl new file mode 100644 index 000000000..9c88e2373 --- /dev/null +++ b/demo/.copywrite.hcl @@ -0,0 +1,8 @@ +schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2023 + + header_ignore = [] +} diff --git a/drivers/shared/.copywrite.hcl b/drivers/shared/.copywrite.hcl new file mode 100644 index 000000000..9c88e2373 --- /dev/null +++ b/drivers/shared/.copywrite.hcl @@ -0,0 +1,8 @@ +schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2023 + + header_ignore = [] +} diff --git a/jobspec/.copywrite.hcl b/jobspec/.copywrite.hcl new file mode 100644 index 000000000..9c88e2373 --- /dev/null +++ b/jobspec/.copywrite.hcl @@ -0,0 +1,8 @@ +schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2023 + + header_ignore = [] +} diff --git a/jobspec2/.copywrite.hcl b/jobspec2/.copywrite.hcl new file mode 100644 index 000000000..9c88e2373 --- /dev/null +++ b/jobspec2/.copywrite.hcl @@ -0,0 +1,8 @@ +schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2023 + + header_ignore = [] +} diff --git a/plugins/.copywrite.hcl b/plugins/.copywrite.hcl new file mode 100644 index 000000000..9c88e2373 --- /dev/null +++ b/plugins/.copywrite.hcl @@ -0,0 +1,8 @@ +schema_version = 1 + +project { + license = "MPL-2.0" + copyright_year = 2023 + + header_ignore = [] +} diff --git a/scripts/copywrite-exceptions.sh b/scripts/copywrite-exceptions.sh new file mode 100755 index 000000000..0e55acb40 --- /dev/null +++ b/scripts/copywrite-exceptions.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +# Used as a stopgap for copywrite bot in MPL-licensed subdirs, detects BUSL licensed +# headers and deletes them, then runs the copywrite bot to utilize local subdir config +# to inject correct headers. + +find . -type f -name '*.go' | while read line; do + if grep "SPDX-License-Identifier: BUSL-1.1" $line; then + sed -i '/SPDX-License-Identifier: BUSL-1.1/d' $line + sed -i '/Copyright (c) HashiCorp, Inc./d' $line + fi +done + +copywrite headers --plan