Skip to content
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

Prune matching replace directives in staging repos more effectively #77753

Merged
merged 3 commits into from
May 11, 2019

Conversation

liggitt
Copy link
Member

@liggitt liggitt commented May 10, 2019

What type of PR is this?
/kind cleanup

What this PR does / why we need it:
As more of our dependencies add go.mod files, it exposed a gap in the part of update-vendor.sh that prunes replace directives from staging go.mod files.

As a reminder:

  • replace directives pin to a specific version of dependencies
  • they are not effective in library modules, only the main module being built gets to declare effective replace directives
  • we prune replace directives that match the naturally required version in our staging go.mod files to highlight where we are pinning to different versions than what is preferred, and try to trend the number of replace directives to zero

#77370 exposed a gap in the way we detected the naturally preferred version was the same as our pinned version.

go mod tidy will completely drop require directives for transitive dependencies we don't actually use any packages from. After those require directives are dropped, go list -m -json all will report the version of those transitive dependencies our direct dependencies prefer (even though it doesn't really matter for purposes of the build, since we're not using any packages from that dependency).

Moving the pruning step before go mod tidy allows us to drop unneeded replace directives for these unused transitive dependencies correctly.

Does this PR introduce a user-facing change?:

NONE

/cc @dims @apelisse

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label May 10, 2019
@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. area/apiserver area/cloudprovider area/code-generation area/dependency Issues or PRs related to dependency changes sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. approved Indicates a PR has been approved by an approver from all required OWNERS files. and removed needs-sig Indicates an issue or PR lacks a `sig/foo` label and requires one. labels May 10, 2019
@dims
Copy link
Member

dims commented May 10, 2019

/approve
/lgtm

good to see that the unnecessary golang.org/x/text replace from code-generator is gone. thanks @liggitt

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 10, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: dims, liggitt

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

The pull request process is described 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

@fejta-bot
Copy link

/retest
This bot automatically retries jobs that failed/flaked on approved PRs (send feedback to fejta).

Review the full test history for this PR.

Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@k8s-ci-robot k8s-ci-robot merged commit 6f6890b into kubernetes:master May 11, 2019
@liggitt liggitt deleted the prune-replace branch May 13, 2019 12:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. area/apiserver area/cloudprovider area/code-generation area/dependency Issues or PRs related to dependency changes cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. sig/cli Categorizes an issue or PR as relevant to SIG CLI. sig/cloud-provider Categorizes an issue or PR as relevant to SIG Cloud Provider. sig/cluster-lifecycle Categorizes an issue or PR as relevant to SIG Cluster Lifecycle. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants