Skip to content

Commit

Permalink
[COMPLIANCE] Add copyright and license headers (#292)
Browse files Browse the repository at this point in the history
* add copywrite changes

* mod tidy?

* add back to go mod + ignores

* add --plan

* add `make tools`

* [COMPLIANCE] Add copyright and license headers

* update protobuf GH workflow

* add ignore to pb.go only

* reverted back to the original protoc version

* Update .copywrite.hcl

Co-authored-by: Brian Flad <[email protected]>

---------

Co-authored-by: Brian Flad <[email protected]>
  • Loading branch information
austinvalle and bflad authored Jun 5, 2023
1 parent cb2ab32 commit 9303150
Show file tree
Hide file tree
Showing 128 changed files with 1,275 additions and 11 deletions.
27 changes: 27 additions & 0 deletions .copywrite.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
schema_version = 1

project {
license = "MPL-2.0"
copyright_year = 2020

header_ignore = [
# changie tooling configuration and CHANGELOG entries (prose)
".changes/unreleased/*.yaml",
".changie.yaml",

# GitHub issue template configuration
".github/ISSUE_TEMPLATE/*.yml",

# GitHub Actions workflow-specific configurations
".github/labeler-*.yml",

# golangci-lint tooling configuration
".golangci.yml",

# GoReleaser tooling configuration
".goreleaser.yml",

# Release Engineering tooling configuration
".release/*.hcl",
]
}
8 changes: 8 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ attaching use cases to an issue first before raising a pull request.

- [ ] **Changelog**: Refer to the [changelog](#changelog) section for more information about how to create changelog entries.

- [ ] **License Headers**: All source code requires a license header at the top of the file, refer to [License Headers](#license-headers) for information on how to autogenerate these headers.

### Cosmetic changes, code formatting, and typos

In general we do not accept PRs containing only the following changes:
Expand Down Expand Up @@ -220,6 +222,12 @@ tfsdk: The `Example` type `Old` field has been removed since it is not necessary

``````

### License Headers

All source code files (excluding autogenerated files like `go.mod`, prose, and files excluded in [.copywrite.hcl](../.copywrite.hcl)) must have a license header at the top.

This can be autogenerated by running `make generate` or running `go generate ./...` in the [/tools](../tools) directory.

## Linting

GitHub Actions workflow bug and style checking is performed via [`actionlint`](https://github.com/rhysd/actionlint).
Expand Down
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,7 @@ updates:
- dependency-name: "github.com/hashicorp/go-hclog"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/tools"
schedule:
interval: "daily"
3 changes: 1 addition & 2 deletions .github/workflows/ci-protobuf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ jobs:
# https://github.com/arduino/setup-protoc/issues/33
version: '3.19.4'
- run: go mod download
- run: go install google.golang.org/protobuf/cmd/protoc-gen-go
- run: go install google.golang.org/grpc/cmd/protoc-gen-go-grpc
- run: make tools
- run: make protoc
- name: git diff
run: |
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/compliance.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: compliance

on:
pull_request:

permissions:
contents: read

jobs:
# Reference: ENGSRV-059
copywrite:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: hashicorp/setup-copywrite@867a1a2a064a0626db322392806428f7dc59cb3e # v1.1.2
- run: copywrite headers --plan
- run: copywrite license --plan
10 changes: 9 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ default: test
lint:
golangci-lint run ./...

tools:
go install google.golang.org/protobuf/cmd/protoc-gen-go
cd tools; go install google.golang.org/grpc/cmd/protoc-gen-go-grpc

# Protocol Buffers compilation is done outside of 'go generate' handling since
# the 'protoc' tool is not installable via 'go install'.
protoc:
Expand All @@ -26,4 +30,8 @@ protoc:
test:
go test ./...

.PHONY: default lint protoc test
# Generate copywrite headers
generate:
cd tools; go generate ./...

.PHONY: default lint protoc test tools
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,9 @@ Run `golangci-lint run ./...` or `make lint` after any changes.

Ensure the following tooling is installed:

- [`protoc`](https://github.com/protocolbuffers/protobuf): Protocol Buffers compiler.
- [`protoc-gen-go`](https://pkg.go.dev/google.golang.org/protobuf/cmd/protoc-gen-go): Go plugin for Protocol Buffers compiler. e.g. `go install google.golang.org/protobuf/cmd/protoc-gen-go`
- [`protoc-gen-go-grpc`](https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc): Go gRPC plugin for Protocol Buffers compiler. e.g. `go install google.golang.org/grpc/cmd/protoc-gen-go-grpc`
- [`protoc`](https://github.com/protocolbuffers/protobuf): Protocol Buffers compiler. This isn't Go specific tooling, so follow this [installation guide](https://github.com/protocolbuffers/protobuf#protocol-compiler-installation)
- [`protoc-gen-go`](https://pkg.go.dev/google.golang.org/protobuf/cmd/protoc-gen-go): Go plugin for Protocol Buffers compiler. Install by running `make tools`
- [`protoc-gen-go-grpc`](https://pkg.go.dev/google.golang.org/grpc/cmd/protoc-gen-go-grpc): Go gRPC plugin for Protocol Buffers compiler. Install by running `make tools`

The Protocol Buffers definitions can be found in `tfprotov5/internal/tfplugin5` and `tfprotov6/internal/tfplugin6`.

Expand Down
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ require (
github.com/mitchellh/go-testing-interface v1.14.1
github.com/vmihailenco/msgpack/v5 v5.3.5
google.golang.org/grpc v1.55.0
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0
google.golang.org/protobuf v1.30.0
)

Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,6 @@ google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s=
google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 h1:rNBFJjBCOgVr9pWD7rs/knKL4FRTKgpZmsRfV214zcA=
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0/go.mod h1:Dk1tviKTvMCz5tvh7t+fh94dhmQVHuCt2OzJB3CTW9Y=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
Expand Down
3 changes: 3 additions & 0 deletions internal/logging/context.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package logging

import (
Expand Down
3 changes: 3 additions & 0 deletions internal/logging/doc.go
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// Package logging contains shared environment variable and log functionality.
package logging
3 changes: 3 additions & 0 deletions internal/logging/environment_variables.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package logging

// Environment variables.
Expand Down
3 changes: 3 additions & 0 deletions internal/logging/keys.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package logging

// Global logging keys attached to all requests.
Expand Down
3 changes: 3 additions & 0 deletions internal/logging/protocol.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package logging

import (
Expand Down
3 changes: 3 additions & 0 deletions internal/logging/protocol_data.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package logging

import (
Expand Down
3 changes: 3 additions & 0 deletions internal/logging/provider.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package logging

import (
Expand Down
3 changes: 3 additions & 0 deletions internal/logging/provider_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package logging

import "testing"
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/data_source.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tfprotov5

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/diagnostic.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tfprotov5

import "github.com/hashicorp/terraform-plugin-go/tftypes"
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// Package tfprotov5 provides the interfaces and types needed to build a
// Terraform provider server.
//
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/dynamic_value.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tfprotov5

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/diag/diagnostics.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package diag

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/diag/diagnostics_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package diag_test

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/diag/doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// Package diag contains diagnostics helpers. These implementations are
// intentionally outside the public API.
package diag
3 changes: 3 additions & 0 deletions tfprotov5/internal/fromproto/attribute_path.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package fromproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/fromproto/data_source.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package fromproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/fromproto/diagnostic.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package fromproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/fromproto/provider.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package fromproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/fromproto/resource.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package fromproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/fromproto/schema.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package fromproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/fromproto/state.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package fromproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/fromproto/string_kind.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package fromproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/fromproto/types.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package fromproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/tf5serverlogging/context_keys.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tf5serverlogging

// Context key types.
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/tf5serverlogging/doc.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// Package tf5serverlogging contains logging functionality specific to
// tf5server and tfprotov5 types.
package tf5serverlogging
3 changes: 3 additions & 0 deletions tfprotov5/internal/tf5serverlogging/downstream_request.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tf5serverlogging

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tf5serverlogging_test

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/tfplugin5/tfplugin5.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tfprotov5/internal/tfplugin5/tfplugin5.proto
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

// Terraform Plugin RPC protocol version 5.3
//
// This file defines version 5.3 of the RPC protocol. To implement a plugin
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/tfplugin5/tfplugin5_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions tfprotov5/internal/toproto/diagnostic_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package toproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/internal/toproto/server_capabilities.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package toproto

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/provider.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tfprotov5

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/resource.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tfprotov5

import (
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/schema.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tfprotov5

import "github.com/hashicorp/terraform-plugin-go/tftypes"
Expand Down
3 changes: 3 additions & 0 deletions tfprotov5/schema_test.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: MPL-2.0

package tfprotov5_test

import (
Expand Down
Loading

0 comments on commit 9303150

Please sign in to comment.