Skip to content

Minimal changes to enable a Go workspace #19423

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

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ivanvc
Copy link
Member

@ivanvc ivanvc commented Feb 15, 2025

This pull request is a follow-up on #19314.

It introduces minimal changes to enable a workspace in the project. We can iterate on it later to remove the script nuances of looping over the modules to execute commands, as they can now be executed from the top level of the repository.

Part of #18409.

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

@k8s-ci-robot
Copy link

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: ivanvc
Once this PR has been reviewed and has the lgtm label, please assign ahrtr for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link

codecov bot commented Feb 15, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 68.88%. Comparing base (ab98cdd) to head (d61efa2).
Report is 3 commits behind head on main.

Current head d61efa2 differs from pull request most recent head a56793e

Please upload reports for the commit a56793e to get more accurate results.

Additional details and impacted files

see 34 files with indirect coverage changes

@@            Coverage Diff             @@
##             main   #19423      +/-   ##
==========================================
+ Coverage   68.60%   68.88%   +0.27%     
==========================================
  Files         418      421       +3     
  Lines       35722    35857     +135     
==========================================
+ Hits        24508    24701     +193     
+ Misses       9766     9735      -31     
+ Partials     1448     1421      -27     

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d486871...a56793e. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ivanvc
Copy link
Member Author

ivanvc commented Feb 15, 2025

/test all

@ivanvc ivanvc force-pushed the introduce-a-min-workspace branch 2 times, most recently from d555146 to b7e86a4 Compare February 18, 2025 06:03
@ivanvc ivanvc changed the title [do not review] Go workspace Minimal changes to enable a Go workspace Feb 18, 2025
@ivanvc ivanvc force-pushed the introduce-a-min-workspace branch from b7e86a4 to eb81e5b Compare February 18, 2025 06:26
@ivanvc ivanvc marked this pull request as ready for review February 18, 2025 06:45
@ivanvc
Copy link
Member Author

ivanvc commented Feb 18, 2025

/cc @ahrtr @serathius

@@ -14,7 +14,7 @@ function bom_fixlet {
# shellcheck disable=SC2207
modules=($(modules_for_bom))

if GOFLAGS=-mod=mod run_go_tool "github.com/appscodelabs/license-bill-of-materials" \
Copy link
Member

Choose a reason for hiding this comment

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

GOFLAGS=-mod=mod is this even a correct flag? Could we remove it regardless of workspace migration?

Copy link
Member Author

@ivanvc ivanvc Feb 22, 2025

Choose a reason for hiding this comment

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

Yes, I think so. This should predate Go 1.1113.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, never mind. Actually, I believe, due to the note in bom_pass, we may need to leave the -mod=mod flag in the tests. But you're right. There's no need for it to be here, as test_lib.sh doesn't define a GOFLAGS=-mod that we need to override. I'll open a pull request for this change.

@ahrtr
Copy link
Member

ahrtr commented Feb 21, 2025

I will review this PR after we officially release v3.6.0, thx

@ivanvc ivanvc force-pushed the introduce-a-min-workspace branch from 9ed8ecc to d3c2c0b Compare March 8, 2025 06:33
@ivanvc ivanvc force-pushed the introduce-a-min-workspace branch from d3c2c0b to ba87efb Compare March 13, 2025 06:11
@ivanvc
Copy link
Member Author

ivanvc commented Mar 13, 2025

/test all

@ivanvc ivanvc force-pushed the introduce-a-min-workspace branch from ba87efb to ffa3c8a Compare March 13, 2025 06:25
@ivanvc
Copy link
Member Author

ivanvc commented Mar 13, 2025

/test all

@ivanvc
Copy link
Member Author

ivanvc commented Apr 4, 2025

/test all

@ivanvc ivanvc force-pushed the introduce-a-min-workspace branch from e34b154 to d61efa2 Compare April 4, 2025 08:30
@ivanvc
Copy link
Member Author

ivanvc commented Apr 4, 2025

/test pull-etcd-release-tests pull-etcd-verify

@ivanvc
Copy link
Member Author

ivanvc commented Apr 4, 2025

/test all

@ivanvc ivanvc force-pushed the introduce-a-min-workspace branch from d61efa2 to bfcaa23 Compare April 5, 2025 06:36
ivanvc and others added 4 commits April 5, 2025 07:37
Introduce a new Go workspace that references all the current submodules.
To preserve the current behavior, point all of the current
FORBIDDEN_DEPENCENCY virtual dependencies to the same path.

Add scripts/update_go_workspace.sh that generates the Go workspace file
(go.work) based on the submodules found in the project (excluding the
tools) and creates the go.work.sum file after running go mod download.
Added this script to the fix Makefile target. Even though, the number of
modules in the etcd repository is small, by adding an automated way of
updating the go.work modules future proofs the project in case there are
new modules or removal of them.

Point all forbidden dependencies to a common virtual place (top-level
FORBIDDEN_DEPENDENCY). For the workspace to function we need all
dependencies to be consistent across the repository. That means that the
current approach with FORBIDDEN_DEPENDENCY doesn't work, because they
are pointing to different directories. Set the fictional v3.999.999
version for these dependencies, so they are consitent, and they don't
clash with the actual depdendencies references in other modules.

Co-authored-by: Tim Hockin <[email protected]>
Signed-off-by: Ivan Valdes <[email protected]>
Introduce a new `verify-go-workspace` make target executed by the
`verify` target. The pull-etcd-verify presubmit prow job will execute
it. It ensures that the Go workspace (`go.work` and `go.work.sum`) is in
sync.

Signed-off-by: Ivan Valdes <[email protected]>
Add checking for the Go toolchain directive in the go.work file too.

Signed-off-by: Ivan Valdes <[email protected]>
Remove `GOFLAGS=-mod=mod` from the execution of
license-bill-of-materials.

Signed-off-by: Ivan Valdes <[email protected]>
@ivanvc ivanvc force-pushed the introduce-a-min-workspace branch from bfcaa23 to a56793e Compare April 5, 2025 06:38
@ivanvc
Copy link
Member Author

ivanvc commented Apr 5, 2025

/test pull-etcd-release-tests pull-etcd-verify

@k8s-ci-robot
Copy link

@ivanvc: The following tests failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-etcd-release-tests a56793e link true /test pull-etcd-release-tests
pull-etcd-verify a56793e link unknown /test pull-etcd-verify

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants