Browse Source

Run copyright after running deep-copy as part of the Makefile/CI (#18741)

* execute copyright headers after performing deep-copy generation.

* fix copyright install

* Apply suggestions from code review

Co-authored-by: Semir Patel <semir.patel@hashicorp.com>

* Apply suggestions from code review

Co-authored-by: Semir Patel <semir.patel@hashicorp.com>

* rename steps to match codegen naming

* remove copywrite install category

---------

Co-authored-by: Semir Patel <semir.patel@hashicorp.com>
pull/18747/head
Dhia Ayachi 1 year ago committed by GitHub
parent
commit
b1688ad856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 48
      .github/workflows/go-tests.yml
  2. 6
      Makefile
  3. 3
      agent/config/config.deepcopy.go
  4. 3
      agent/proxycfg-sources/catalog/config_source_oss.go
  5. 3
      agent/proxycfg/config_snapshot_glue.go
  6. 3
      agent/proxycfg/config_snapshot_glue_test.go
  7. 29
      build-support/scripts/devtools.sh
  8. 3
      command/resource/testdata/demo.hcl
  9. 3
      command/resource/testdata/invalid.hcl
  10. 3
      command/resource/testdata/invalid_type.hcl
  11. 3
      command/resource/testdata/nested_data.hcl
  12. 3
      internal/mesh/internal/cache/sidecarproxycache/destinations_cache.go
  13. 3
      internal/mesh/internal/cache/sidecarproxycache/destinations_cache_test.go
  14. 3
      internal/mesh/internal/controllers/xds/proxy_tracker_watch.go
  15. 3
      internal/mesh/proxy-snapshot/proxy_snapshot.go
  16. 3
      internal/mesh/proxy-tracker/proxy_state_exports.go
  17. 3
      logging/logfile_bsd.go
  18. 3
      logging/logfile_linux.go
  19. 3
      logging/logfile_solaris.go
  20. 3
      logging/logfile_windows.go
  21. 6
      test-integ/go.mod
  22. 8
      test-integ/go.sum

48
.github/workflows/go-tests.yml

@ -96,29 +96,28 @@ jobs:
- name: Notify Slack
if: ${{ failure() }}
run: .github/scripts/notify_slack.sh
# Temporarily changing until the situation with license headers in the generated code can be worked out
# check-generated-deep-copy:
# needs:
# - setup
# runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }}
# steps:
# - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
# # NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
# - name: Setup Git
# if: ${{ endsWith(github.repository, '-enterprise') }}
# run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
# - uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
# with:
# go-version-file: 'go.mod'
# - run: make --always-make deep-copy
# - run: |
# if ! git diff --exit-code; then
# echo "Generated code was not updated correctly"
# exit 1
# fi
# - name: Notify Slack
# if: ${{ failure() }}
# run: .github/scripts/notify_slack.sh
check-codegen:
needs:
- setup
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
- name: Setup Git
if: ${{ endsWith(github.repository, '-enterprise') }}
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
- uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version-file: 'go.mod'
- run: make --always-make codegen
- run: |
if ! git diff --exit-code; then
echo "Generated code was not updated correctly"
exit 1
fi
- name: Notify Slack
if: ${{ failure() }}
run: .github/scripts/notify_slack.sh
lint-enums:
needs:
@ -486,8 +485,7 @@ jobs:
needs:
- conditional-skip
- setup
# Reenable later
#- check-generated-deep-copy
- check-codegen
- check-generated-protobuf
- check-go-mod
- lint-consul-retry

6
Makefile

@ -19,6 +19,7 @@ MOG_VERSION='v0.4.0'
PROTOC_GO_INJECT_TAG_VERSION='v1.3.0'
PROTOC_GEN_GO_BINARY_VERSION="v0.1.0"
DEEP_COPY_VERSION='bc3f5aa5735d8a54961580a3a24422c308c831c2'
COPYWRITE_TOOL_VERSION='v0.16.4'
MOCKED_PB_DIRS= pbdns
@ -427,12 +428,13 @@ lint-tools: ## Install tools for linting
codegen-tools: ## Install tools for codegen
@$(SHELL) $(CURDIR)/build-support/scripts/devtools.sh -codegen
.PHONY: deep-copy
deep-copy: codegen-tools ## Deep copy
.PHONY: codegen
codegen: codegen-tools ## Deep copy
@$(SHELL) $(CURDIR)/agent/structs/deep-copy.sh
@$(SHELL) $(CURDIR)/agent/proxycfg/deep-copy.sh
@$(SHELL) $(CURDIR)/agent/consul/state/deep-copy.sh
@$(SHELL) $(CURDIR)/agent/config/deep-copy.sh
copywrite headers
print-% : ; @echo $($*) ## utility to echo a makefile variable (i.e. 'make print-GOPATH')

3
agent/config/config.deepcopy.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
// generated by deep-copy -pointer-receiver -o ./config.deepcopy.go -type RuntimeConfig ./; DO NOT EDIT.
package config

3
agent/proxycfg-sources/catalog/config_source_oss.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
//go:build !consulent
// +build !consulent

3
agent/proxycfg/config_snapshot_glue.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package proxycfg
import (

3
agent/proxycfg/config_snapshot_glue_test.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package proxycfg
import (

29
build-support/scripts/devtools.sh

@ -149,14 +149,30 @@ function lint_install {
}
function codegen_install {
local deep_copy_version
deep_copy_version="$(make --no-print-directory print-DEEP_COPY_VERSION)"
deepcopy_install
copywrite_install
}
function deepcopy_install {
local deep_copy_version
deep_copy_version="$(make --no-print-directory print-DEEP_COPY_VERSION)"
install_versioned_tool \
'deep-copy' \
'github.com/globusdigital/deep-copy' \
"${deep_copy_version}" \
'github.com/globusdigital/deep-copy'
}
function copywrite_install {
local copywrite_version
copywrite_version="$(make --no-print-directory print-COPYWRITE_TOOL_VERSION)"
install_versioned_tool \
'deep-copy' \
'github.com/globusdigital/deep-copy' \
"${deep_copy_version}" \
'github.com/globusdigital/deep-copy'
'copywrite' \
'github.com/hashicorp/copywrite' \
"${copywrite_version}" \
'github.com/hashicorp/copywrite'
}
function tools_install {
@ -164,6 +180,7 @@ function tools_install {
lint_install
proto_tools_install
codegen_install
copywrite_install
return 0
}

3
command/resource/testdata/demo.hcl vendored

@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
ID {
Type = gvk("demo.v2.Artist")
Name = "korn"

3
command/resource/testdata/invalid.hcl vendored

@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
ID {
Type = gvk("demo.v2.Artist")
Name = "korn"

3
command/resource/testdata/invalid_type.hcl vendored

@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
D {
Type = gvk("demo.v2.Artist")
Tenancy {

3
command/resource/testdata/nested_data.hcl vendored

@ -1,3 +1,6 @@
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: BUSL-1.1
ID {
Type = gvk("mesh.v1alpha1.Upstreams")
Name = "api"

3
internal/mesh/internal/cache/sidecarproxycache/destinations_cache.go vendored

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package sidecarproxycache
import (

3
internal/mesh/internal/cache/sidecarproxycache/destinations_cache_test.go vendored

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package sidecarproxycache
import (

3
internal/mesh/internal/controllers/xds/proxy_tracker_watch.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package xds
import (

3
internal/mesh/proxy-snapshot/proxy_snapshot.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package proxysnapshot
import "github.com/hashicorp/consul/acl"

3
internal/mesh/proxy-tracker/proxy_state_exports.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package proxytracker
import (

3
logging/logfile_bsd.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
//go:build darwin || freebsd || netbsd || openbsd
// +build darwin freebsd netbsd openbsd

3
logging/logfile_linux.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
//go:build dragonfly || linux
// +build dragonfly linux

3
logging/logfile_solaris.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
//go:build solaris
// +build solaris

3
logging/logfile_windows.go

@ -1,3 +1,6 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package logging
import (

6
test-integ/go.mod

@ -90,7 +90,7 @@ require (
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.11.3 // indirect
github.com/hashicorp/consul v0.0.0-00010101000000-000000000000 // indirect
github.com/hashicorp/consul v1.16.1 // indirect
github.com/hashicorp/consul-awsauth v0.0.0-20220713182709-05ac1c5c2706 // indirect
github.com/hashicorp/consul-net-rpc v0.0.0-20221205195236-156cfab66a69 // indirect
github.com/hashicorp/consul/envoyextensions v0.4.1 // indirect
@ -204,7 +204,7 @@ require (
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/atomic v1.9.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b // indirect
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
@ -213,7 +213,7 @@ require (
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.11.1 // indirect
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230726155614-23370e0ffb3e // indirect

8
test-integ/go.sum

@ -853,8 +853,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b h1:r+vk0EmXNmekl0S0BascoeeoHk/L7wmaW2QF90K+kYI=
golang.org/x/exp v0.0.0-20230801115018-d63ba01acd4b/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@ -1126,8 +1126,8 @@ golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.6-0.20210726203631-07bc1bf47fb2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.11.1 h1:ojD5zOW8+7dOGzdnNgersm8aPfcDjhMp12UfG93NIMc=
golang.org/x/tools v0.11.1/go.mod h1:anzJrxPjNtfgiYQYirP2CPGzGLxrH2u2QBhn6Bf3qY8=
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 h1:Vve/L0v7CXXuxUmaMGIEK/dEeq7uiqb5qBgQrZzIE7E=
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846/go.mod h1:Sc0INKfu04TlqNoRA1hgpFZbhYXHPr4V5DzpSBTPqQM=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=

Loading…
Cancel
Save