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

add BAZEL_VERSION env to kubekins, check it in caching config #8516

Merged
merged 3 commits into from
Jun 30, 2018

Conversation

BenTheElder
Copy link
Member

  • add $BAZEL_VERSION with the version we're installing as an env instead of just an arg
  • check for it in create_bazel_cache_rcs.sh so we can configure bazel 0.15.0 with a max concurrent connections for the remote cache (if this goes well the next patch release will have it as the default and we won't need to detect other versions)
  • fix shellcheck lints in create_bazel_cache_rcs.sh

xref: bazelbuild/bazel#5047

@BenTheElder BenTheElder requested a review from krzyzacy as a code owner June 30, 2018 00:00
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Jun 30, 2018
@BenTheElder
Copy link
Member Author

/assign @krzyzacy @ixdy @cjwagner

}

# look up a binary with which and return the debian package it belongs to
command_to_package () {
local binary_path=$(readlink -f $(which $1))
local binary_path
binary_path=$(readlink -f "$(which "$1")")
Copy link
Member

Choose a reason for hiding this comment

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

humm this is from shell lint?

Copy link
Member

Choose a reason for hiding this comment

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

yeah, I don't like this new style, unless you also go and move all of the local definitions to the top of the function, c-style.

Copy link
Member Author

Choose a reason for hiding this comment

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

yes, if you don't do assignment from subshells separately from local / export it masks the exit code https://github.com/koalaman/shellcheck/wiki/SC2155

Copy link
Member

Choose a reason for hiding this comment

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

TIL. bash is the worst.

Copy link
Member Author

@BenTheElder BenTheElder Jun 30, 2018

Choose a reason for hiding this comment

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

I'm not a fan of this style either, but the shellcheck lint seems convincing. I'm not sure the c style would be better, especially since this is only relevant to assignment which uses subshells, not literals / string formation

echo "build --remote_http_cache=${cache_url}"
# specifically for bazel 0.15.0 we want to set this flag
Copy link
Member

Choose a reason for hiding this comment

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

do we think a fix might be cherry-picked for 0.15.1? or should we do this for all bazel 0.15 patch releases?

Copy link
Member Author

Choose a reason for hiding this comment

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

this is a temporary check, we expect a fix to be in 0.15.1 if the fix is confirmed. I thought this would be good enough for now and avoid the question of handling semver. The goal of this PR is to make it possible to start testing this fix using a canary job and a :latest-experimental image

Copy link
Member Author

Choose a reason for hiding this comment

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

we probably could match semver in bash and match a specific range with some regex though :^)

# specifically for bazel 0.15.0 we want to set this flag
# our docker image now sets BAZEL_VERSION with the bazel version as installed
# https://github.com/bazelbuild/bazel/issues/5047#issuecomment-401295174
if [[ -z "${BAZEL_VERSION+x}" && "${BAZEL_VERSION}" -eq "0.15.0" ]]; then
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't the first check be -n "${BAZEL_VERSION+}"?

right now I think it'll always be false.

Copy link
Member

Choose a reason for hiding this comment

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

though I don't think you need it at all, really. just do something like

if [[ "${BAZEL_VERSION:-}" -eq "0.15.0" ]]; then
...

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, shellcheck can't fix my misuse of -z / -n / -d :/
fixing

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed this

Copy link
Member Author

Choose a reason for hiding this comment

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

so actually this was right but your suggestion is better. "${BAZEL_VERSION+x}" is zero if it evaluates to x and nonzero if bazel_version is actually set.

Copy link
Member Author

@BenTheElder BenTheElder Jun 30, 2018

Choose a reason for hiding this comment

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

what we really want is:
if [[ "${BAZEL_VERSION:-}" = "0.15.0" ]]; then

@ixdy
Copy link
Member

ixdy commented Jun 30, 2018

/lgtm

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

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: BenTheElder, ixdy

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

@k8s-ci-robot k8s-ci-robot merged commit 46fd70b into kubernetes:master Jun 30, 2018
@BenTheElder BenTheElder deleted the bazel-experiments branch June 30, 2018 01:14
@BenTheElder
Copy link
Member Author

I'll push a :latest-experimental image with 0.15.0 and start soak testing next

@BenTheElder BenTheElder added the area/greenhouse Issues or PRs related to code in /greenhouse (our remote bazel cache) label Sep 5, 2018
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/greenhouse Issues or PRs related to code in /greenhouse (our remote bazel cache) 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. 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