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

Support overriding go_sdk versions #202

Merged
merged 2 commits into from
Jul 23, 2020

Conversation

justaugustus
Copy link
Member

@justaugustus justaugustus commented Jul 23, 2020

(Suggested in #197 (comment).)

I've roughly borrowed this pattern from rules_go (h/t @jayconrod).
See: https://github.com/bazelbuild/rules_go/blob/9dc42edc13c67d8a70a14e262a7b128ed26a3e54/go/private/sdk.bzl#L23-L28 and https://github.com/bazelbuild/rules_go/blob/9dc42edc13c67d8a70a14e262a7b128ed26a3e54/go/private/sdk_list.bzl#L19

Here we extend the configure function in repos.bzl to accept an override_go_version parameter.

If override_go_version is specified, configure will make a call to go_download_sdk as follows:

go_download_sdk(name = "go_sdk", sdks = OVERRIDE_GO_VERSIONS[override_go_version])

OVERRIDE_GO_VERSIONS is a map that can contain multiple alternate go_sdk versions.
This PR populates the map with go1.15beta1 / 1.15.0-beta.1, which can be used to test the kubernetes/kubernetes upgrade to go1.15 in kubernetes/kubernetes#93264.

A consumer can leverage this new functionality as follows:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "io_k8s_repo_infra",
    strip_prefix = "repo-infra-0.0.8",
    sha256 = "2a86a60706c1f9b2d87f25d2bc1d107d823908ec3fb895735c8aa9a4b239d10e",
    urls = [
        "https://github.com/kubernetes/repo-infra/archive/v0.0.8.tar.gz",
    ],
)

load("@io_k8s_repo_infra//:load.bzl", repo_infra_repositories = "repositories")

repo_infra_repositories()

load("@io_k8s_repo_infra//:repos.bzl", repo_infra_configure = "configure", repo_infra_go_repositories = "go_repositories")

repo_infra_configure(
    override_go_version = "1.15.0-beta.1",
    minimum_bazel_version = "2.2.0",
)

repo_infra_go_repositories()

You can see a test of this functionality in kubernetes/kubernetes#93395.

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jul 23, 2020
@k8s-ci-robot k8s-ci-robot added sig/release Categorizes an issue or PR as relevant to SIG Release. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 23, 2020
@justaugustus justaugustus force-pushed the override-go branch 2 times, most recently from e52115b to 8bf157a Compare July 23, 2020 22:45
@justaugustus
Copy link
Member Author

/check-cla

Signed-off-by: Stephen Augustus <saugustus@vmware.com>
Signed-off-by: Stephen Augustus <saugustus@vmware.com>
@justaugustus justaugustus changed the title [WIP][DO NOT MERGE] Override go versions Support overriding go_sdk versions Jul 23, 2020
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 23, 2020
@justaugustus
Copy link
Member Author

/hold
/assign @fejta @liggitt @Verolop
cc: @kubernetes/release-engineering

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 23, 2020
)
load(
"@io_k8s_repo_infra//go:sdk_versions.bzl",
"OVERRIDE_GO_VERSIONS",
Copy link
Contributor

Choose a reason for hiding this comment

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

Any reason to put this in a different file rather than in here?

Copy link
Member Author

Choose a reason for hiding this comment

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

@fejta -- Mostly long-term maintenance. This puts us on a path to support Go pre-releases and that list is going to get pretty long. I didn't want to clutter up our primary logic with all of the pre-release tuples.

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: fejta, justaugustus

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

@justaugustus
Copy link
Member Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jul 23, 2020
@k8s-ci-robot k8s-ci-robot merged commit 950e715 into kubernetes:master Jul 23, 2020
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. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. sig/release Categorizes an issue or PR as relevant to SIG Release. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants