Skip to content

[Feature] Investigate dependabot package upgrade failure #3445

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 2 tasks
dentiny opened this issue Apr 21, 2025 · 9 comments · Fixed by #3470
Open
1 of 2 tasks

[Feature] Investigate dependabot package upgrade failure #3445

dentiny opened this issue Apr 21, 2025 · 9 comments · Fixed by #3470
Labels
enhancement New feature or request go Pull requests that update Go code

Comments

@dentiny
Copy link
Contributor

dentiny commented Apr 21, 2025

Search before asking

  • I had searched in the issues and found no similar feature requirement.

Description

A detailed failure case:

The only difference lies in golang and golang toolchain upgrade.
It would be nice (and somehow necessary) to investigate how to configure dependabot properly, otherwise we have to manually fix all the upgrade breakage ourselves.

Use case

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!
@dentiny dentiny added enhancement New feature or request go Pull requests that update Go code labels Apr 21, 2025
@kenmcheng
Copy link
Contributor

kenmcheng commented Apr 21, 2025

In #3396, the protobuf version for the apiserver was v1.36.5 whereas v1.36.6 in #3443.

While PR #3396 was for bumping protobuf version for ./proto, go mod download in the workflow bumped up the version in the ./apiserver as well (v1.36.5 -> v1.36.6). However, go mod download didn't handle the protobuf version in the go.mod correctly which led to a build failure.

The version bump wasn't required in #3443, the breakage was avoided.
I can successfully build apiserver by running go mod tidy instead.

Repro steps:

  1. Checkout on commit d40d1f6
  2. cd apiserver
  3. go mod download
  4. go build ./..., and the output is
% go mod download
% go build ./...
$HOME/go/pkg/mod/google.golang.org/grpc@v1.65.0/credentials/credentials.go:33:2: missing go.sum entry for module providing package google.golang.org/protobuf/proto (imported by github.com/ray-project/kuberay/apiserver/test/e2e); to add:
        go get github.com/ray-project/kuberay/apiserver/test/e2e
$HOME/go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/pretty/pretty.go:27:2: missing go.sum entry for module providing package google.golang.org/protobuf/encoding/protojson (imported by github.com/ray-project/kuberay/apiserver/cmd); to add:
        go get github.com/ray-project/kuberay/apiserver/cmd
$HOME/go/pkg/mod/google.golang.org/grpc@v1.65.0/internal/pretty/pretty.go:28:2: missing go.sum entry for module providing package google.golang.org/protobuf/protoadapt (imported by google.golang.org/grpc/encoding/proto); to add:
        go get google.golang.org/grpc/encoding/proto@v1.65.0
$HOME/go/pkg/mod/google.golang.org/grpc@v1.65.0/binarylog/grpc_binarylog_v1/binarylog.pb.go:28:2: missing go.sum entry for module providing package google.golang.org/protobuf/reflect/protoreflect (imported by github.com/grpc-ecosystem/grpc-gateway/v2/runtime); to add:
        go get github.com/grpc-ecosystem/grpc-gateway/v2/runtime@v2.20.0
...

run go mod tidy instead:
3. go mod tidy
4. go build ./...

% go mod tidy
% go build ./...
%  # no error message

The difference was that protobuf version wasn't updated correctly in the go.mod

go mod download
Image

go mod tidy
Image

I think using go mod tidy is a more robust way if it doesn't break other dependencies.

@dentiny
Copy link
Contributor Author

dentiny commented Apr 21, 2025

I think using go mod tidy is a more robust way if it doesn't break other dependencies.

Thanks for the thorough investigation and experiment! Do you think it's possible to add go mod tidy to dependabot?

@kenmcheng
Copy link
Contributor

Thanks for the thorough investigation and experiment! Do you think it's possible to add go mod tidy to dependabot?

The behavior is configured in the .github/workflows/test-job.yaml. We may rather change that file.

- name: Get dependencies
run: go mod download
working-directory: ${{env.working-directory}}
- name: Build
run: go build ./...
working-directory: ${{env.working-directory}}

Image

@kenmcheng
Copy link
Contributor

kenmcheng commented Apr 23, 2025

Update: By default, dependabot performs go mod tidy for each update.
reference: https://github.blog/changelog/2020-10-19-dependabot-go-mod-tidy-and-vendor-support/

However, this isssue occurred when the sub-project was being checked was different from the sub-project that the PR targeted at, leading to a mismatch in the library version in the go.sum after running go mod download.

--

Another solution is adding grouping configuration such as:

      google-golang:
        patterns:
          - "google.golang.org/*"

The related updates will be grouped into one PR which avoids inconsistency across sub-projects.

@dentiny
Copy link
Contributor Author

dentiny commented Apr 24, 2025

Re-open this issue, because I've seen a few more upgrade failure cases.

@dentiny
Copy link
Contributor Author

dentiny commented Apr 28, 2025

@kenmcheng Are you willing to put out a PR? Currently I think manually resolve dependency issue is too labor intensive.

@kenmcheng
Copy link
Contributor

Hi @dentiny, I have to take a deeper look into this issue since PRs came with different fail reasons. For instance, there was a codegen issue in #3472 which may not have a simple fix of modifying dependabot config file. (maybe adjusting github action workflow would help)
We may try our best effort to mitigate but hardly eradicate the issue.

@dentiny
Copy link
Contributor Author

dentiny commented Apr 28, 2025

We may try our best effort to mitigate but hardly eradicate the issue.

Thank you @kenmcheng for the help! I really appreciate and admire your technical skill to reduce upgrade PR, and the methodology to approach the problem!

My personal opinion is as long as we're going towards the right direction we're good, so no need to propose a perfect solution.
If you want a discussion I'm here anytime, I want to learn more from you genius!

@kenmcheng
Copy link
Contributor

#3509 another codegen fail.

The following reference from the k8s-sigs may solve the codegen issue from the dependabot PRs.
https://github.com/kubernetes-sigs/cluster-api-provider-azure/blob/9e05057d543263fc0fbfa4dedc568def72db7897/.github/workflows/dependabot-code-gen.yml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request go Pull requests that update Go code
Projects
None yet
2 participants