workaround and fixes for MPL and copywrite bot (#18775)

This commit is contained in:
modrake
2023-10-17 00:02:13 -07:00
committed by GitHub
parent 349c032369
commit 51ffe4208e
12 changed files with 82 additions and 6 deletions

View File

@@ -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.

View File

@@ -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

View File

@@ -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

8
api/.copywrite.hcl Normal file
View File

@@ -0,0 +1,8 @@
schema_version = 1
project {
license = "MPL-2.0"
copyright_year = 2023
header_ignore = []
}

View File

@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package api
import (

View File

@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0
package api
import (

8
demo/.copywrite.hcl Normal file
View File

@@ -0,0 +1,8 @@
schema_version = 1
project {
license = "MPL-2.0"
copyright_year = 2023
header_ignore = []
}

View File

@@ -0,0 +1,8 @@
schema_version = 1
project {
license = "MPL-2.0"
copyright_year = 2023
header_ignore = []
}

8
jobspec/.copywrite.hcl Normal file
View File

@@ -0,0 +1,8 @@
schema_version = 1
project {
license = "MPL-2.0"
copyright_year = 2023
header_ignore = []
}

8
jobspec2/.copywrite.hcl Normal file
View File

@@ -0,0 +1,8 @@
schema_version = 1
project {
license = "MPL-2.0"
copyright_year = 2023
header_ignore = []
}

8
plugins/.copywrite.hcl Normal file
View File

@@ -0,0 +1,8 @@
schema_version = 1
project {
license = "MPL-2.0"
copyright_year = 2023
header_ignore = []
}

14
scripts/copywrite-exceptions.sh Executable file
View File

@@ -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