Skip to content
This repository was archived by the owner on Feb 6, 2024. It is now read-only.

Add new kubectl toolchain rule #206

Merged
merged 5 commits into from
Oct 25, 2018

Conversation

alex1545
Copy link
Contributor

Creating a toolchain rule with a single attribute that is a path to the kubectl tool

@alex1545
Copy link
Contributor Author

/assign @nlopezgi

@alex1545
Copy link
Contributor Author

/assign xingao267

@smukherj1
Copy link
Contributor

/ok-to-test

@smukherj1
Copy link
Contributor

/joke

@k8s-ci-robot
Copy link

@smukherj1: Never take advice from electrons. They are always negative.

In response to this:

/joke

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/test-infra repository.

@alex1545
Copy link
Contributor Author

/retest

Copy link
Contributor

@erain erain left a comment

Choose a reason for hiding this comment

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

LGTM.

Copy link
Contributor

@nlopezgi nlopezgi left a comment

Choose a reason for hiding this comment

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

lgtm, minor nit

@k8s-ci-robot k8s-ci-robot removed the lgtm label Oct 25, 2018
Copy link
Contributor

@fejta fejta left a comment

Choose a reason for hiding this comment

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

Once there is an easy way to build kubectl from source (without checking out the entire kubectl repo), would you consider using this rather than the one on PATH?

Aka check out k8s.io/kubectl and build it (not yet supported though unfortunately) https://github.com/kubernetes/kubectl

@alex1545
Copy link
Contributor Author

/retest

@nlopezgi
Copy link
Contributor

@fejta
yes, the plan is to work towards supporting better ways of using the kubectl tool, ideally this will eventually mean pulling it hermetically as part of the build. For now, this is just the start of refactoring the whole repo to work properly with toolchain rules.

@fejta
Copy link
Contributor

fejta commented Oct 25, 2018

Very cool, there have been some recent requests about this (how to pull kubectl into the build) in the kubernetes.slack.com #bazel channel

Copy link
Contributor

@smukherj1 smukherj1 left a comment

Choose a reason for hiding this comment

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

Requesting some changes from lessons learnt while I was working on bazelbuild/rules_docker#559

WORKSPACE Outdated

# Register the default kubectl toolchain that expects the 'kubectl'
# executable to be in the PATH
register_toolchains(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be moved to the k8s_repositories macro in k8s/k8s.bzl so that users of the k8s repo automatically get this toolchain registered for them. See bazelbuild/rules_docker#559

tools/BUILD Outdated
load(":kubectl_toolchain.bzl", "kubectl_toolchain")

# kubectl toolchain type
toolchain_type(name = "toolchain_type_kubectl")
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename this to "toolchain_type" instead of "toolchain_type_kubectl". See bazelbuild/rules_docker#559

The recommended flow is to use the label of the package to figure out the specific type of the toolchain. Recommend creating a "//toolchains/kubectl" directory and this entire file and kubectl_toolchain.bzl there. See my PR for reference

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: erain, nlopezgi, smukherj1

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

@nlopezgi
Copy link
Contributor

/retest

1 similar comment
@nlopezgi
Copy link
Contributor

/retest

@nlopezgi nlopezgi merged commit 5e10698 into bazelbuild:master Oct 25, 2018
@alex1545 alex1545 deleted the kubectl-via-toolchains branch October 30, 2018 19:56
@smukherj1 smukherj1 added the new_rule Indicates whether a PR adds a new rule label Dec 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved lgtm new_rule Indicates whether a PR adds a new rule size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants