Skip to content

chore: Fix protobuf CI#570

Merged
austinvalle merged 11 commits intomainfrom
av/update-diff-ci
Oct 8, 2025
Merged

chore: Fix protobuf CI#570
austinvalle merged 11 commits intomainfrom
av/update-diff-ci

Conversation

@austinvalle
Copy link
Copy Markdown
Member

@austinvalle austinvalle commented Sep 25, 2025

Related Issue

Ref: #569
Ref: #566

Description

This PR makes a couple changes, but the general theme is just fixing up our protobuf automation, changes made:

  • Adjusted the original blanket git diff command to detect only protocol changes that have not been regenerated, since there isn't really a need to check the entire repo for differences (like the go.sum for example)
  • Remove the go.work and go.work.sum files, which aren't supported by dependabot and will drift over time unless we manually update them: Go: Support workspaces dependabot/dependabot-core#6012
    • Adjusted the make file and compile logic to just run within the tools module
  • Fixed the compile script which had an incredibly subtle bug which resulted in CI errors as well as local machine errors if you don't have these tools installed in your PATH:
image

To prove the CI is working as expected, I modified the protocol without regenerating in this commit:

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

No

@austinvalle austinvalle requested a review from a team as a code owner September 25, 2025 14:16
@austinvalle austinvalle marked this pull request as draft September 25, 2025 14:23
@austinvalle austinvalle changed the title chore: Update protobuf diff CI to only detect changes in the proto generated files chore: Fix protobuf CI Sep 25, 2025
cmd := &exec.Cmd{
Path: cmdLine[0],
Args: cmdLine[1:],
Args: cmdLine,
Copy link
Copy Markdown
Member Author

@austinvalle austinvalle Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the bug fix, Args must always include the actual executable name/path as the first index. So the first index here (an actual argument!) was always being ignored 😆

This bug actually exists in TF core as well, but it seems the same --plugin path is duplicated, meaning that the first duplicate --plugin argument is actually ignored 😆. Core doesn't use protoc-gen-go-grpc (despite the variable naming), so it just duplicates the same path for protoc-gen-go.

In terraform-plugin-go we actually use both protoc-gen-go and protoc-gen-go-grpc, so after I fixed the variable/duplicate above, the first argument (protoc-gen-go) was being ignored, resulting in the "not found" error above.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a contributor to the problem in core is some refactoring that arose after linting 🙈

I've proposed equivalent fixes on the Core side.

log.Fatal(err)
}
protocGenGoGrpcExec, err := filepath.Abs(protocGenGoExec)
protocGenGoGrpcExec, err = filepath.Abs(protocGenGoGrpcExec)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the other part of the bug fix mentioned here

@austinvalle austinvalle marked this pull request as ready for review September 25, 2025 20:08
// go.mod, as with all other Go dependencies. If you want to switch to a newer
// version of either tool then you can upgrade their modules in the usual way.
const protocGenGoPackage = "github.com/golang/protobuf/protoc-gen-go"
const protocGenGoPackage = "google.golang.org/protobuf/cmd/protoc-gen-go"
Copy link
Copy Markdown
Member Author

@austinvalle austinvalle Sep 25, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This isn't directly related to the bug fix, but the github Go module is the deprecated version which the main Go module doesn't use: https://pkg.go.dev/github.com/golang/protobuf/protoc-gen-go

Copy link
Copy Markdown
Member

@SarahFrench SarahFrench left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, and thanks again for finding the issues with the original script!

Copy link
Copy Markdown
Contributor

@stephybun stephybun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good stuff! LGTM 🦒

@austinvalle austinvalle merged commit 9ec53f0 into main Oct 8, 2025
109 checks passed
@austinvalle austinvalle deleted the av/update-diff-ci branch October 8, 2025 13:56
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants