bazelbuild / bazelisk Goto Github PK
View Code? Open in Web Editor NEWA user-friendly launcher for Bazel.
License: Apache License 2.0
A user-friendly launcher for Bazel.
License: Apache License 2.0
I have a project which builds with bazel 0.15 but doesn't build with bazel at HEAD (I know I should have updated in between) so I have ~15 Bazel versions to test my project with. Now, it would be really great if you could tell bazelisk which version is the last known Bazel version with which my project did successfully build and bazelisk should try with each new released Bazel version since then and compile a report.
If the build fails with Bazel X and fails with Bazel X+1, then bazelisk should additionally repeat the build with the --migrate
option with Bazel version X.
Consider publishing official bazelisk docker images, aka gcr.io/whatever/bazelisk:1.0
etc (maybe versions that have bazel version A B C preinstalled too)
On our CI docker we install Bazel version from the official Debian image,
that corresponds to the .bazelversion
file, by using official Bazel version:
https://releases.bazel.build/1.0.0/rc2/bazel_1.0.0rc2-linux-x86_64.deb
In the same time we install bazelisk, version 1.0 on CI docker image.
If I run bazelisk build :release
and .bazelversion is 1.0.0rc2, and locally the right version of Bazel is installed, I would expect that Bazelisk is smart enough, to use that version.
What happens, is yet another instance of Bazel is downloaded by Bazelisk:
davido@wizball:~/projects/gerrit$ bazel version
Build label: 1.0.0rc2
Build target: bazel-out/k8-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Fri Sep 6 12:17:09 2019 (1567772229)
Build timestamp: 1567772229
Build timestamp as int: 1567772229
davido@wizball:~/projects/gerrit$ which bazel
/usr/bin/bazel
davido@wizball:~/projects/gerrit$ cat .bazelversion
1.0.0rc2
davido@wizball:~/projects/gerrit$ bazelisk build java/com/google/gerrit/server:server
2019/09/10 21:43:16 Downloading https://releases.bazel.build/1.0.0/rc2/bazel-1.0.0rc2-linux-x86_64...
INFO: Writing tracer profile to '/home/jenkins/.cache/bazel/_bazel_jenkins/4e8644684552b40c50dc624b79e09982/command.profile.gz'
INFO: Invocation ID: 3e92d1fa-39a5-4266-a806-642073c70b89
INFO: Analyzed target //java/com/google/gerrit/server:server (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target //java/com/google/gerrit/server:server up-to-date:
bazel-bin/java/com/google/gerrit/server/libserver.jar
INFO: Elapsed time: 0.625s, Critical Path: 0.21s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
And now yet additional Bazel version was downloaded by Bazelisk and is located here:
/home/davido/.cache/bazelisk/bin/bazelbuild/bazel-1.0.0rc2-linux-x86_64
As part of our continuous integration tests, we used to build Bazel from HEAD in order to catch upcoming incompatible_... flag flips that impact us. Once we found Bazelisk, we changed the test to use it w/ USE_BAZEL_VERSION=last_green. However, we are sometimes seeing bazelisk get 404s when downloading Bazel.
Example from today:
2019/06/17 15:03:58 Using unreleased version at commit c84f7d39220c88dc44e9725df68805039917d8ed
2019/06/17 15:03:58 Downloading https://storage.googleapis.com/bazel-builds/artifacts/ubuntu1404/c84f7d39220c88dc44e9725df68805039917d8ed/bazel...
2019/06/17 15:03:58 could not download Bazel: HTTP GET https://storage.googleapis.com/bazel-builds/artifacts/ubuntu1404/c84f7d39220c88dc44e9725df68805039917d8ed/bazel failed with error 404
I see that the timing lines up such that a new green commit was created at around this time (times above are UTC), and c84f7d39220c88dc44e9725df68805039917d8ed may have just become not the "last green" commit as the test was running (and since Bazelisk caches for an hour, subsequent calls to bazelisk kept trying to pull down the build for this commit).
How long are "last green" builds kept available after a new green commit is added? Could this be what caused the issue for us?
In our testing with bazelisk migrate we've noticed that bazelisk doesn't clean up enough between builds to make sure it's correct about whether or not a flag needs to be migrated.
In our specific case testing migrate with 0.27.0 we get an initial failure with all the flags:
bazel build --config=QA --apple_platform_type=ios //Modules/... --incompatible_disable_legacy_proto_provider --incompatible_disable_native_android_rules --incompatible_disable_proto_source_root --incompatible_disallow_legacy_java_provider --incompatible_disallow_legacy_javainfo --incompatible_enable_cc_toolchain_resolution --incompatible_make_thinlto_command_lines_standalone --incompatible_no_target_output_group --incompatible_remap_main_repo --incompatible_remove_legacy_whole_archive --incompatible_require_java_toolchain_header_compiler_direct --incompatible_restrict_named_params --incompatible_use_aapt2_by_default --incompatible_windows_native_test_wrapper
Loading:
Loading: 0 packages loaded
Analyzing: 2143 targets (470 packages loaded, 0 targets configured)
Analyzing: 2143 targets (715 packages loaded, 15147 targets configured)
Analyzing: 2143 targets (802 packages loaded, 21675 targets configured)
INFO: Analyzed 2143 targets (802 packages loaded, 24113 targets configured).
Building: checking cached actions
INFO: Found 2143 targets...
INFO: Deleting stale sandbox base /private/var/tmp/_bazel_iosci/4da19724c573aed48a58c78a6f864623/sandbox
[8 / 34] [Prepa] Writing file Modules/MapToastListeners/MapToastListeners.output_file_map.json
[497 / 557] Compiling Swift module GlobalSupportService; 1s local ... (12 actions, 11 running)
[579 / 638] AssetCatalogCompile Modules/CoreUI/CoreUIResources-intermediates/xcassets; 2s local ... (12 actions, 10 running)
[690 / 747] AssetCatalogCompile Modules/CoreUI/CoreUIResources-intermediates/xcassets; 4s local ... (12 actions, 11 running)
[832 / 931] AssetCatalogCompile Modules/CoreUI/CoreUIResources-intermediates/xcassets; 6s local ... (12 actions, 11 running)
[930 / 1,083] AssetCatalogCompile Modules/CoreUI/CoreUIResources-intermediates/xcassets; 9s local ... (12 actions, 11 running)
[1,062 / 1,287] AssetCatalogCompile Modules/CoreUI/CoreUIResources-intermediates/xcassets; 12s local ... (12 actions running)
[1,129 / 1,361] AssetCatalogCompile Modules/CoreUI/CoreUIResources-intermediates/xcassets; 15s local ... (12 actions running)
[1,192 / 1,407] AssetCatalogCompile Modules/CoreUI/CoreUIResources-intermediates/xcassets; 19s local ... (12 actions running)
[1,224 / 1,415] AssetCatalogCompile Modules/CoreUI/CoreUIResources-intermediates/xcassets; 24s local ... (12 actions running)
[1,270 / 1,421] Compiling Swift module StreamingService; 19s local ... (12 actions running)
ERROR: /Users/iosci/Desktop/src/iosci32/lyft/ios/Modules/MapToastListeners/BUILD:22:1: Linking of rule '//Modules/MapToastListeners:MapToastListenersTests' failed (Exit 1)
But then none of the migration flags fail with this. But if I bisect this on my own I discovered this issue is caused by --incompatible_enable_cc_toolchain_resolution
. Knowing this I can reproduce it after a clean, but then if I remove it, and add it back, the build is a no-op:
% bazelisk build --config=QA --apple_platform_type=ios //Modules/MapToastListeners:MapToastListenersTests --incompatible_enable_cc_toolchain_resolution
INFO: Analyzed target //Modules/MapToastListeners:MapToastListenersTests (99 packages loaded, 3740 targets configured).
INFO: Found 1 target...
ERROR: /Users/ksmiley/dev/lyft/Lyft-iOS/Modules/MapToastListeners/BUILD:22:1: Linking of rule '//Modules/MapToastListeners:MapToastListenersTests' failed (Exit 1)
clang: warning: using sysroot for 'MacOSX' but targeting 'iPhone' [-Wincompatible-sysroot]
ld: framework not found UIKit
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Target //Modules/MapToastListeners:MapToastListenersTests failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 105.531s, Critical Path: 62.41s
INFO: 310 processes: 310 local.
FAILED: Build did NOT complete successfully
% bazelisk build --config=QA --apple_platform_type=ios //Modules/MapToastListeners:MapToastListenersTests
INFO: Build option --incompatible_enable_cc_toolchain_resolution has changed, discarding analysis cache.
INFO: Analyzed target //Modules/MapToastListeners:MapToastListenersTests (0 packages loaded, 3742 targets configured).
INFO: Found 1 target...
Target //Modules/MapToastListeners:MapToastListenersTests up-to-date:
bazel-bin/Modules/MapToastListeners/MapToastListenersTests.zip
bazel-bin/Modules/MapToastListeners/MapToastListenersTests
INFO: Elapsed time: 6.074s, Critical Path: 5.37s
INFO: 5 processes: 5 local.
INFO: Build completed successfully, 7 total actions
% bazelisk build --config=QA --apple_platform_type=ios //Modules/MapToastListeners:MapToastListenersTests --incompatible_enable_cc_toolchain_resolution
INFO: Build option --incompatible_enable_cc_toolchain_resolution has changed, discarding analysis cache.
INFO: Analyzed target //Modules/MapToastListeners:MapToastListenersTests (0 packages loaded, 3748 targets configured).
INFO: Found 1 target...
Target //Modules/MapToastListeners:MapToastListenersTests up-to-date:
bazel-bin/Modules/MapToastListeners/MapToastListenersTests.zip
bazel-bin/Modules/MapToastListeners/MapToastListenersTests
INFO: Elapsed time: 0.635s, Critical Path: 0.02s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
This might be an implementation detail of this flag and what it does, but it surprised us that we couldn't fully trust that migrate was showing us true true results.
Hello,
I am trying to use my 32 bit controller, the BBAI, to compile some source and get tensorflow on my machine so that I can use openCV one day. I came across this idea of Bazel and Bazelisk on the tensorflow site under install.
I am stuck w/ this bunch of error messages:
The system is out of resources.
Consult the following stack trace for details.
java.lang.OutOfMemoryError: Java heap space
Is there a light version or another way to go about getting tensorflow on my Debian Stretch Distro? I saw that Buster will start to incorporate items for development. I am on kernel 4.14.x.
Seth
P.S. I know this is a RAM issue, most likely on my end, but I am reaching out nevertheless with trying to find ways to get tensorflow on the machine of choice. If you know what issues I am describing, please do reply.
bazelisk is a really nice concept - would be more useful to me by having easily able to use a particular host for bazel builds, which may not be upstream's builds (or hashes).
What might build a bridge to supporting that well? Listing providers in the .bazelversion? What about on the server side?
Executing the pre-built bazelisk binary doesn't seem to respect the value in a .bazelversion
file when executed from the directory containing the file. The binary downloads the latest version of Bazel instead. Setting USE_BAZEL_VERSION
picks up the correct version from the environment variable.
I believe the issue is that the determination of the .bazelversion
file relies on the existence of a WORKSPACE
file. For some of the "infrastructure" commands e.g. version
, help
, info
this shouldn't be required.
bazelisk-darwin-amd64
)cp bazelisk /Users/bmuschko/dev/tools/bazelisk
chmod +x /Users/bmuschko/dev/tools/bazelisk
export PATH=/Users/bmuschko/dev/tools:$PATH
mkdir my-project
cd my-project
.bazelversion
with version 0.21.0echo 0.21.0 > .bazelversion
bazelisk version
Build label: 0.24.1
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Apr 2 16:32:47 2019 (1554222767)
Build timestamp: 1554222767
Build timestamp as int: 1554222767
(Really a question more than an issue)
I'm part of a team with plans to finish a large Maven-to-Bazel migration in the next month or so. One of the last things that's been worrying me was how to handle the nice (but scarily quick) Bazel release cadence. When I saw that Bazelisk allows you to pin people to a specific version and handle the downloading/set-up, I was super excited. Would you feel comfortable rolling it out to a team of over 100 engineers at this point or do you think I should wait for it to stabilize?
Dear Philwo,
Thank you for fantastic script! I'm operating on a extremely moody network currently, and at times of slowly flying pigeons bazelisk and intellij fight against each other with this error message:
Traceback (most recent call last):
File "/home/m/bin/bazel", line 116, in <module>
sys.exit(main())
File "/home/m/bin/bazel", line 113, in main
return subprocess.Popen([bazel_path] + argv[1:], close_fds=True).wait()
File "/usr/lib/python3.6/subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "/usr/lib/python3.6/subprocess.py", line 1344, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
OSError: [Errno 26] Text file busy: '/home/m/.bazelisk/bin/bazel-0.18.0-linux-x86_64'
In addition, I'm starring at Downloading https://releases.bazel.build/0.18.0/release/bazel-0.18.0-linux-x86_64...
for a while now, and I'm wondering if it's doing anything, maybe progress bar would be nice :P
Best regards, and thank you!
big fan,
m.
I see that the "ideas for improvement" in the front page contains:
... and I have quite a dislike for Homebrew. I'd suggest to provide a native macOS installer that places this tool in the correct location instead. It's actually quite easy to do so and avoids the need to install Homebrew (which some users may not have, like me, as I use pkgsrc).
Anyway, my main goal was to let you know that the packaging script I wrote for sandboxfs may help you get started: https://github.com/bazelbuild/sandboxfs/blob/master/admin/make-macos-pkg.sh . Was going to send you an email about this, but hey, I can also send this to you via a FR.
Currently if I run bazelisk, when my PC is in offline mode, it fails to run my build/test tasks as it is not able to connect to the internet and validate that it is running the latest version.
$ ./tools/bin/bazelisk-darwin-amd64 help
2019/09/08 08:15:36 could not resolve the version 'latest' to an actual version number: could not get releases from github.com/bazelbuild/bazel: could not download list of Bazel releases from github.com/bazelbuild: could not fetch https://api.github.com/repos/bazelbuild/bazel/releases: Get https://api.github.com/repos/bazelbuild/bazel/releases: dial tcp: lookup api.github.com: no such host
$
It would be great if it could simply print a warning message about this and continue with running the bazel build/test tasks. And perhaps provide an option to run bazelisk in offline mode so that it doesn't have to print warning message.
I'm not sure if this will be controversial as an issue, but I wanted to share a challenge I've faced trying to get Bazelisk working for my codebase. It has a lot to do with the lack of interpreter hermeticity in the Python rules, which is a separate problem, so this "issue" may also resolve itself in the future.
So, what happens is: if you manage your Python by way of pyenv, the hashbang in this script (#!/usr/bin/env python3
) will resolve to the pyenv shim for python 3. This will prepend things to PATH, and spawned subprocess will inherit the mutated PATH as its environment. Further usage of python after bazelisk hands off control, then, end up getting forced onto python 3.
You could absolutely say this not Bazelisk's problem, but for what's it's worth, I worked around this by refactoring the script to be py2-compatible, and using #!/usr/bin/python
as the hashbang - this should be portable across OSX and Linux, for the time being, and I'm hopeful the Bazel Python ecosystem will continue to improve so this is not something we have to worry about outside of the python rules themselves.
My users use a combination of Linux, OS X, and Windows, but can be relied upon to have a basic python installation present. Since they may not have installed the various pips required by bazelisk, it would be useful if bazelisk were a single deployable python binary (similar to a PEX) that could be included at the root of the project.
This would provide multi-platform support easily without bloating the repo. Having a binary per platform won't work in this case, since I'm working on an Open Source project, and it's hard enough to get people to install the baseline requirements.
I am trying to install Go version as it describes in README.md
, but I got a message when I ran
go get github.com/bazelbuild/bazelisk
The message is
# github.com/bazelbuild/bazelisk
go/src/github.com/bazelbuild/bazelisk/bazelisk.go:606:24: undefined: os.UserCacheDir
I am running
Ubuntu 18.04.1 LTS
go version go1.10.4 linux/amd64
Could anyone take a look what I did wrong? Thanks.
In #18 it was mentioned that Bazelisk can fail because GitHub will rate limit IPs, which can be a problem on shared networks.
{
"message": "API rate limit exceeded for 64.235.99.100. (But here's the good news: Authenticated
requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://developer.github.com/v3/#rate-limiting"
}
We hit this in our office because we generate our WORKSPACE
in our non-Bazel build (as we migrate) and sometimes users do a clean build which deletes this file. Bazelisk will only use .bazelrc
if it's beside a WORKSPACE
file.
Our fix is to generate our Bazel build before invoking Bazel, which is totally reasonable/the right thing for us. It would still probably be good for Bazelisk to use non-GitHub infrastructure for resolving the latest version, as mentioned in #18 (it would have hidden our bug, which would suck for us, but it seems like the right thing for Bazelisk).
Incompatible flag --incompatible_no_implicit_file_export will be enabled by default in a future Bazel release [1], thus breaking Bazelisk.
The flag is documented here: bazelbuild/bazel#10225
Please check the following CI builds for build and test results:
Never heard of incompatible flags before? We have documentation that explains everything.
If you don't want to receive any future issues for Bazelisk or if you have any questions,
please file an issue in https://github.com/bazelbuild/continuous-integration
Important: Please do NOT modify the issue title since that might break our tools.
[1] The target release hasn't been determined yet. Our tool will update the issue title once the flag flip has been scheduled.
Bazel release candidates and releases are accompanied by PGP signatures:
$ wget -q 'https://releases.bazel.build/0.20.0/rc1/bazel-0.20.0rc1-darwin-x86_64'
$ wget -q 'https://releases.bazel.build/0.20.0/rc1/bazel-0.20.0rc1-darwin-x86_64.sig'
$ gpg --verify ./bazel-0.20.0rc1-darwin-x86_64.sig
gpg: assuming signed data in './bazel-0.20.0rc1-darwin-x86_64'
gpg: Signature made Mon 05 Nov 2018 06:16:24 AM PST
gpg: using RSA key 71A1D0EFCFEB6281FD0437C93D5919B448457EE0
gpg: Good signature from "Bazel Developer (Bazel APT repository key) <[email protected]>" [full]
$ wget -q 'https://releases.bazel.build/0.21.0/release/bazel-0.21.0-linux-x86_64'
$ wget -q 'https://releases.bazel.build/0.21.0/release/bazel-0.21.0-linux-x86_64.sig'
$ gpg --verify ./bazel-0.21.0-linux-x86_64.sig
gpg: assuming signed data in './bazel-0.21.0-linux-x86_64'
gpg: Signature made Wed 19 Dec 2018 05:58:23 AM PST
gpg: using RSA key 71A1D0EFCFEB6281FD0437C93D5919B448457EE0
gpg: Good signature from "Bazel Developer (Bazel APT repository key) <[email protected]>" [full]
Would you be interested in a pull request to make Bazelisk additionally
download and verify these signatures? (Signature verification is fast:
about a second on my machine.)
The Bazel team public key would be hard-coded into the repository, and
we can use
$ gpg --no-default-keyring --keyring ./bazel-release.pub.gpg \
> --trust-model always --verify "${SIGNATURE}" "${BINARY}"
to verify the binary. (This requires the bazel-release.pub.gpg
key to
be dearmored, but that’s easy to do.)
We have been using //tools/bazel to execute bazelisk and then that picks up which version to run via .bazelversion.
Change #53 broke this.
Would it be possible to add a cmd line flag to disable this feature?
This may be just a bazel release issue, but wanted to check here first ...
We've (kythe) been successfully using "last_green", but yesterday the fetch to
fails with a 403. Is this "just" a bazel automation problem?
There's a mismatch with the CI: https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/37#6dc0f493-7763-47c2-9ff0-5d9ba95e86e5
For example, notice that the CI lists incompatible_no_transitive_loads
in the list of flags, but Bazelisk doesn't use it when calling Bazel.
The list of flags we use come from: https://api.github.com/search/issues?q=repo:bazelbuild/bazel+label:migration-0.23
It surprinsingly doesn't include incompatible_no_transitive_loads (bazelbuild/bazel#5636)
We recently switched to using Bazelisk in many tests that run on bazel-toolchains repo using GCB triggers. Today we're seeing some of our builds fail with the following error:
Step #0: 2019/06/28 17:42:34 could not download Bazel: could not copy from https://releases.bazel.build/0.27.0/release/bazel-0.27.0-linux-x86_64 to /root/.cache/bazelisk/bin/download895442339: stream error: stream ID 1; INTERNAL_ERROR
Seems to be flakiness, as retrying the test usually succeeds
Seeing a 404 for binary assets as part of the v0.0.6 release.
https://github.com/bazelbuild/bazelisk/releases/download/v0.0.6/bazelisk-darwin-amd64
The .bazelversion
file should allow developers to specify the SHAs of the files downloaded so that we can rest easy knowing that the bazel used by bazelisk is, well, not tainted.
One feature that I'm missing, is a way to troubleshoot if a user is using bazelisk
vs the raw bazel
.
This is especially useful if the bazelisk
binary is installed as bazel
.
My proposal is that bazelisk
should intercept bazelisk version
and prepend or append the bazelisk version to the output, like so:
$ bazelisk version
Bazelisk version: 0.0.5
Build label: 0.26.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue May 28 08:38:24 2019 (1559032704)
Build timestamp: 1559032704
Build timestamp as int: 1559032704
bazelisk
--migrate is now showing bazel version and github issue which is great. I love that this got added!
I think the bazel versions it shows are wrong though. Where are they grabbed from? Is it just because the tags are wrong in github?
On my codebase, if I run bazelisk --migrate
with .bazelversion
set to 1.2.0
, I get this:
+++ Result
Command was successful with the following flags:
--incompatible_disable_depset_items (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/9017)
--incompatible_disable_native_android_rules (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/8391)
--incompatible_disable_target_provider_fields (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/9014)
--incompatible_disallow_dict_lookup_unhashable_keys (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/9184)
--incompatible_enable_cc_toolchain_resolution (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/7260)
--incompatible_load_cc_rules_from_bzl (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/8743)
--incompatible_load_proto_rules_from_bzl (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/8922)
--incompatible_prohibit_aapt1 (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/10000)
--incompatible_remap_main_repo (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/7130)
--incompatible_remove_native_maven_jar (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/6799)
--incompatible_run_shell_command_string (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/5903)
Migration is needed for the following flags:
--incompatible_disallow_empty_glob (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/8195)
--incompatible_load_java_rules_from_bzl (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/8746)
--incompatible_load_python_rules_from_bzl (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/9006)
--incompatible_no_implicit_file_export (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/10225)
--incompatible_restrict_string_escapes (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/8380)
--incompatible_use_platforms_repo_for_constraints (Bazel 1.2: https://github.com/bazelbuild/bazel/issues/8622)
Looking at one of the issues from the failed flags:
https://github.com/bazelbuild/bazel/issues/8195)
--incompatible_load_java_rules_from_bzl (Bazel 1.2:
It looks like it is currently set to be a breaking change when upgrading to 3.0.0
so I would ideally like to see (Bazel 3.0.0) listed as the bazel version. Instead it says Bazel 1.2, which was actually the CURRENT version of bazel so that doesnt even make sense right?. Every single flag was listed as 1.2 as well.
When doing this:
% USE_BAZEL_VERSION=$PWD/tmp/bazel/versions/1.0.0-darwin/bin/bazel bazelisk --migrate build //...
2019/10/16 11:41:45 could not get the list of incompatible flags: invalid version unknown
Is this because my bazel binary doesn't have the version in the binary name itself?
We use a fork for Bazel at Lucid Software because we utilize features in Bazel that are still in code review or are too premature for a pull request to the main Bazel repo.
We would like to be able to use Bazelisk with our fork of the Bazel repo, so we can manage Bazel upgrades while on a custom version of Bazel.
Currently Bazelisk only supports downloading official releases.
fmt.Sprintf("https://releases.bazel.build/%s/%s/%s", version, kind, filename)
It would be nice to have an option to choose between the normal GitHub release URL like
fmt.Sprintf("https://github.com/%s/bazel/releases/download/%s/%s", remote, version, filename)
We already have a prototype. We are happy to draft a PR or draft a design document. Thanks for your consideration.
I control-c'd during the download of a new bazel version, and the next time I ran bazelisk I was hit with:
% bazelisk test //test/exe:main_common_test --define=google_grpc=disabled --define=signal_trace=disabled --define=tcmalloc=disabled
WARNING: The following rc files are no longer being read, please transfer their contents or import their path into one of the standard rc files:
/home/keith/dev/envoy/tools/bazel.rc
file is invalid or corrupted (missing end of central directory record)
Cannot find central directory
FATAL: Failed to open Bazel as a zip file: (error: 5): Input/output error
In order to fix this I had to rm -rf ~/.bazelisk
and run it again
What do you think about having files with native shell scripts like gradle wrapper have? Somthing like this:
#!/usr/bin/env sh
##############################################################################
##
## Bazel start up script for UN*X (based on gradlew script from gradle wrapper project)
##
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="bazelisk"
APP_BASE_NAME=`basename "$0"`
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
## Determine OS.
darwin=false
linux=false
case "`uname`" in
Darwin* )
darwin=true
;;
Linux* )
linux=true
;;
esac
BINARY_PATH=""
if $darwin; then
BINARY_PATH=bazelisk-darwin-amd64
elif $linux; then
BINARY_PATH=bazelisk-linux-amd64
else
die "UNSUPPORTED OS! Command 'uname' says: `uname`. 'darwin' = $darwin and 'linux' = $linux"
fi
exec "$APP_HOME/bazelisk/$BINARY_PATH" "$@"
while having bazelisk binaries inside VCS repo?
It seems bazelisk installs a bazel version that doesn't use the bazel.sh
wrapper found in the standard distribution. It also doesn't add a bazel-real
to the PATH
. This prevents //tools/bazel
wrappers from working.
Dear developers,
Background:
I try to build tensorflow from source for my old laptop (there is no binary for my architechture).
Tensorflow recommends using bazelisk, which sounds good to me because I remember having had hard time with bazel earlier. I'm typically using python only and do not remember how to compile programs.
Wish:
I could not easily understand from bazelisk documantion how to build the binary by reading README.md
I guessed
bazelisk build //..
followed by
sudo cp /home/mka/.cache/bazel/_bazel_mka/5fc3e201f16bb551d14b225bd588a7bf/execroot/__main__/bazel-out/k8-fastbuild/bin/linux_amd64_stripped/bazelisk /usr/local/bin/bazel
So could you add to README.md very basic usage example
(for instance for compiling tensorflow in mind)
Go seems to be available vie snap in ubuntu 18.04 which you also could mention.
Final Failure:
(tf2) mka@mkaHemLap:~/git/tensorflow$ ./configure
2019/11/10 10:56:13 Downloading https://releases.bazel.build/0.26.1/release/bazel-0.26.1-linux-x86_64...
Extracting Bazel installation...
WARNING: --batch mode is deprecated. Please instead explicitly shut down your Bazel server using the command "bazel shutdown".
You have bazel 0.26.1 installed.
Please upgrade your bazel installation to version 0.27.1 or higher to build TensorFlow!
terveisin, Markus
Since bazelisk downloads entire binaries, autocomplete scripts are not accessible. bazelisk could potentially also download the autocomplete scripts to a predetermined location to make it easier invoke.
When running bazelisk --migrate test -- //:tests
, Bazelisk adds incompatible flags after --
, which makes Bazel think --incompatible_**
is a target name.
This is causing failures in https://buildkite.com/bazel/bazelisk-plus-incompatible-flags/builds/5#45409a0d-2175-4452-aac9-a37ccbce2466
bazel --output_user_root=D:/b test --flaky_test_attempts=3 --build_tests_only --local_test_jobs=8 --show_progress_rate_limit=5 --curses=yes --color=yes --verbose_failures --keep_going --jobs=32 --announce_rc --experimental_multi_threaded_digest --experimental_build_event_json_file_path_conversion=false --build_event_json_file=D:\temp\tmpcpd4np6y\test_bep.json --remote_timeout=60 --disk_cache= --remote_max_connections=200 --host_platform_remote_properties_override=properties:{name:"platform" value:"windows"} --google_default_credentials --remote_http_cache=https://storage.googleapis.com/bazel-untrusted-buildkite-cache --enable_runfiles --test_env=LocalAppData -- //:tests -//extra_actions_base_proto:extra_actions_base.gen.pb.go_checkshtest --incompatible_disable_deprecated_attr_params
--
| INFO: Invocation ID: d82f2406-8403-498d-a56d-638ea5a7a3b1
| INFO: Options provided by the client:
| Inherited 'common' options: --isatty=0 --terminal_columns=80
| INFO: Options provided by the client:
| Inherited 'build' options: --python_path=C:/python3/python.exe
| DEBUG: Rule 'bazel_skylib' modified arguments {"shallow_since": "1528913834 -0400"}
| ERROR: Skipping '-incompatible_disable_deprecated_attr_params': no such target '//:-incompatible_disable_deprecated_attr_params': target '-incompatible_disable_deprecated_attr_params' not declared in package '' defined by D:/b/bk-windows-java8-88vj/bazel-downstream-projects/buildtools/BUILD.bazel
Will there be a release soon? Eagerly awaiting the //tools/bazel support. Thanks!
We should write some simple tests for Bazelisk and then test it via Buildkite on Linux, macOS and Windows.
Currently we have both python and Go versions; looks like they are losing feature parity. Let's keep just one (I guess the Go version?)
Would it be easy to set the executable bits on the release binaries so that they don't have to be chmod'd after downloading?
It would be awesome if bazelisk had an option to bisect build failures locally, like it's proposed in the Ideas for the future
section of the readme.
As a starting point, we could limit it to last_green
versions of Bazel where we already have a compiled binary. That should hopefully narrow it down to a sufficiently small range of commits so see the culprint.
Just a random thought, this seems a great approach for handling bazel version issue in a non-managed environment but asking users to install this is still a challenge.
Given that bazel will try to invoke //tools/bazel if exists, so how about placing a shell script there to download and run the proper version of bazel instead?
Hi @philwo. I've been working on junit-team/junit5-samples#93 recently, where I'm thinking of incorporating Bazelisk to allow users of that project to run Bazel-based JUnit 5 samples without needing to install Bazel beforehand. But in doing so, I saw a couple of bugs:
amd64
and AMD64
as aliases of x86_64
, so it incorrectly throws an exception when running of machines that advertise such architecture IDs (as mine does).https://github.com/bazelbuild/bazel/releases/download/<version>/bazel-<version>-windows-x86_64
, which AFAICT doesn't exist and instead should be https://github.com/bazelbuild/bazel/releases/download/<version>/bazel-<version>-windows-x86_64.exe
. (The former is missing the .exe
.)I have a fix for both these bugs on my machine, but I wanted to gauge interest in me submitting a PR before I do so.
Thoughts? :)
Bazel 0.18.1 was released after 0.19.0 and now when there is no .bazelversion
supplied bazeilsk is trying to download 0.18.1. My feeling would be that we would want it to download 0.19.0. But what do you think?
Right now bazelisk fetches binary distributions via github releases, I'm curious if adding support for source based fetching + building is something being considered or would be okay to contribute?
Perhaps some extra syntax in .bazelversion
that instructs bazelisk to fetch a zip of some given sha/tag and build a release of bazel locally, and use that as the underlying bazel binary.
Incompatible flag --incompatible_use_platforms_repo_for_constraints will break Bazelisk once Bazel 1.2.1 is released.
Please see the following CI builds for more information:
Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration
Important: Please do NOT modify the issue title since that might break our tools.
If you're on a shared network, you can sometimes see messages like this from the API:
$ curl https://api.github.com/repos/bazelbuild/bazel/releases
{
"message": "API rate limit exceeded for 123.45.67.89. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
"documentation_url": "https://developer.github.com/v3/#rate-limiting"
}
Homebrew (for instance) has support for supplying a token via HOMEBREW_GITHUB_API_TOKEN
, making it more likely that the API request won't get rate limited. It would be nice for bazelisk
to support this as well, perhaps via a similar convention (BAZELISK_GITHUB_API_TOKEN
) to perform authenticated requests instead.
Are there any plans to support using bazel-watcher through bazelisk?
Adding something like a "--watch" option to bazelisk would be awesome in my opinion.
I'd be happy to try and contribute it myself if given a few pointers on what the solution should look like :)
$ USE_BAZEL_VERSION=0.24.1 ../bazelisk-linux-amd64 --strict build ...
ERROR: Unrecognized option: --incompatible_windows_style_arg_escaping
bazelbuild/bazel#7454 is marked for migration. I assume the unrecognized option is because the flag is windows-only.
Issue:
The "go get" command in README.md doesn't function when go.mod is parsed
go get github.com/bazelbuild/bazelisk
This effect was recreated with three out of four users trying to install bazelisk, so it's somewhat flaky.
Behavior:
$ go get github.com/bazelbuild/bazelisk
go: github.com/bazelbuild/[email protected]: parsing go.mod: unexpected module path "github.com/philwo/bazelisk"
go: error loading module requirements
Possible Cause:
I believe that the go.mod file is referencing the wrong repository
Incompatible flag --incompatible_no_implicit_file_export will break Bazelisk once Bazel 1.2.1 is released.
Please see the following CI builds for more information:
Questions? Please file an issue in https://github.com/bazelbuild/continuous-integration
Important: Please do NOT modify the issue title since that might break our tools.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.