From 46a6a22b6d02f32f2ee668a61fb355f8ec98d021 Mon Sep 17 00:00:00 2001 From: Jacob Bohanon Date: Fri, 14 Jul 2023 12:47:55 -0400 Subject: [PATCH 1/6] check proto files; use newer changed-files action and don't try to check deleted files --- .github/workflows/codegen.yaml | 4 ++-- ci/do-not-submit.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/codegen.yaml b/.github/workflows/codegen.yaml index d332b0bcaa0..0b5f9f245ed 100644 --- a/.github/workflows/codegen.yaml +++ b/.github/workflows/codegen.yaml @@ -19,6 +19,6 @@ jobs: ./ci/check-generated-code.sh - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v35 + uses: tj-actions/changed-files@v37 - name: Check for DO_NOT_SUBMIT - run: ./ci/do-not-submit.sh ${{ steps.changed-files.outputs.all_modified_files }} \ No newline at end of file + run: ./ci/do-not-submit.sh ${{ steps.changed-files.outputs.all_changed_files }} diff --git a/ci/do-not-submit.sh b/ci/do-not-submit.sh index 736ffb9b020..10252a99c93 100755 --- a/ci/do-not-submit.sh +++ b/ci/do-not-submit.sh @@ -22,7 +22,7 @@ DO_NOT_SUBMIT_REGEX="[[:space:]]*//[[:space:]]*DO_NOT_SUBMIT" file_count=0 for filename in "$@"; do # Only check *.go files for now - if [[ "$filename" == *".go" || "$filename" == *"go.mod" ]]; then + if [[ "$filename" == *".go" || "$filename" == *"go.mod" || "$filename" == *".proto" ]]; then ((file_count++)) line_number=1 while IFS= read -r line; do @@ -40,4 +40,4 @@ if [[ "$OUTPUT" == "" ]]; then else echo "$OUTPUT" exit -1 -fi \ No newline at end of file +fi From c52db0afafc92b37f37f74eafcb4e946cecf63d9 Mon Sep 17 00:00:00 2001 From: Jacob Bohanon Date: Fri, 14 Jul 2023 12:50:53 -0400 Subject: [PATCH 2/6] add changelog --- changelog/v1.15.0-beta21/do-not-submit-fixes.yaml | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 changelog/v1.15.0-beta21/do-not-submit-fixes.yaml diff --git a/changelog/v1.15.0-beta21/do-not-submit-fixes.yaml b/changelog/v1.15.0-beta21/do-not-submit-fixes.yaml new file mode 100644 index 00000000000..e754c9ec7c7 --- /dev/null +++ b/changelog/v1.15.0-beta21/do-not-submit-fixes.yaml @@ -0,0 +1,6 @@ +changelog: +- type: NON_USER_FACING + description: >- + Check .proto files for DO_NOT_SUBMIT and do not attempt to check deleted files + skipCI-kube-tests:true + skipCI-docs-build:true From 56fd649b226e048ea0c6f995910a38e50e679d7d Mon Sep 17 00:00:00 2001 From: Jacob Bohanon Date: Fri, 14 Jul 2023 12:53:42 -0400 Subject: [PATCH 3/6] add comment for action docs --- .github/workflows/codegen.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/codegen.yaml b/.github/workflows/codegen.yaml index 0b5f9f245ed..566b7462a7b 100644 --- a/.github/workflows/codegen.yaml +++ b/.github/workflows/codegen.yaml @@ -21,4 +21,6 @@ jobs: id: changed-files uses: tj-actions/changed-files@v37 - name: Check for DO_NOT_SUBMIT + # documentation for where we get the list of files to pass into the script: + # https://github.com/marketplace/actions/changed-files?version=v37#outputs run: ./ci/do-not-submit.sh ${{ steps.changed-files.outputs.all_changed_files }} From a27f6c328cda6284783998f60e5eee503534745a Mon Sep 17 00:00:00 2001 From: Jacob Bohanon Date: Fri, 14 Jul 2023 13:25:24 -0400 Subject: [PATCH 4/6] fix comment --- ci/do-not-submit.sh | 4 ++-- .../gloo/api/v1/options/proxy_protocol/proxy_protocol.proto | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/do-not-submit.sh b/ci/do-not-submit.sh index 10252a99c93..c3730975875 100755 --- a/ci/do-not-submit.sh +++ b/ci/do-not-submit.sh @@ -4,7 +4,7 @@ # of those files for comments including the DO_NOT_SUBMIT keyword. If the # keyword is present, the script exits with -1. # -# This initial implementation only checks *.go files for single-line comments +# This implementation checks go.mod, *.go, and *.proto files for single-line comments # (i.e. starting with // rather than /* ... */). # # This script is invoked by .github/workflows/do-not-submit.yaml @@ -18,7 +18,7 @@ NEWLINE=$'\n' OUTPUT="" DO_NOT_SUBMIT_REGEX="[[:space:]]*//[[:space:]]*DO_NOT_SUBMIT" -# Keeps track of number of *.go files (as opposed to all files provided) +# Keeps track of number of go.mod, *.go, and *.proto files (as opposed to all files provided) file_count=0 for filename in "$@"; do # Only check *.go files for now diff --git a/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto b/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto index 39ec52ec704..6b25cd89adf 100644 --- a/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto +++ b/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto @@ -10,6 +10,7 @@ option (extproto.clone_all) = true; import "validate/validate.proto"; +// DO_NOT_SUBMIT: this should make codegen fail message ProxyProtocol { message KeyValuePair { From 012737bbb5184cad403752f91e8ea188fe784d70 Mon Sep 17 00:00:00 2001 From: Jacob Bohanon Date: Fri, 14 Jul 2023 13:39:56 -0400 Subject: [PATCH 5/6] codegen --- .../api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md | 3 ++- .../pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md b/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md index 35f2e27d5bc..9a4c465f422 100644 --- a/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md +++ b/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md @@ -27,7 +27,8 @@ weight: 5 --- ### ProxyProtocol - + +DO_NOT_SUBMIT: this should make codegen fail ```yaml "rules": []proxy_protocol.options.gloo.solo.io.ProxyProtocol.Rule diff --git a/projects/gloo/pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go b/projects/gloo/pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go index e10bb4d9c2b..4f1d2414752 100644 --- a/projects/gloo/pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go +++ b/projects/gloo/pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go @@ -23,6 +23,7 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) +// DO_NOT_SUBMIT: this should make codegen fail type ProxyProtocol struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache From 84f21e811849a5f6d2a8327ac61f19b01d7b7ca9 Mon Sep 17 00:00:00 2001 From: Jacob Bohanon Date: Fri, 14 Jul 2023 13:56:42 -0400 Subject: [PATCH 6/6] remove deliberate failure --- .../api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md | 3 +-- .../gloo/api/v1/options/proxy_protocol/proxy_protocol.proto | 1 - .../pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md b/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md index 9a4c465f422..35f2e27d5bc 100644 --- a/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md +++ b/docs/content/reference/api/github.com/solo-io/gloo/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto.sk.md @@ -27,8 +27,7 @@ weight: 5 --- ### ProxyProtocol - -DO_NOT_SUBMIT: this should make codegen fail + ```yaml "rules": []proxy_protocol.options.gloo.solo.io.ProxyProtocol.Rule diff --git a/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto b/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto index 6b25cd89adf..39ec52ec704 100644 --- a/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto +++ b/projects/gloo/api/v1/options/proxy_protocol/proxy_protocol.proto @@ -10,7 +10,6 @@ option (extproto.clone_all) = true; import "validate/validate.proto"; -// DO_NOT_SUBMIT: this should make codegen fail message ProxyProtocol { message KeyValuePair { diff --git a/projects/gloo/pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go b/projects/gloo/pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go index 4f1d2414752..e10bb4d9c2b 100644 --- a/projects/gloo/pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go +++ b/projects/gloo/pkg/api/v1/options/proxy_protocol/proxy_protocol.pb.go @@ -23,7 +23,6 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// DO_NOT_SUBMIT: this should make codegen fail type ProxyProtocol struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache