bazelisk icon indicating copy to clipboard operation
bazelisk copied to clipboard

USE_BAZEL_VERSION with absolute path results in "invalid version unknown"

Open keith opened this issue 4 years ago • 7 comments

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?

keith avatar Oct 16 '19 18:10 keith

USE_BAZEL_VERSION refers to a dotted version, not a path to a local binary.

jin avatar Oct 16 '19 18:10 jin

I'm using bazelisk 1.1.0 https://github.com/bazelbuild/bazelisk/releases/tag/v1.1.0

keith avatar Oct 16 '19 18:10 keith

Hi @keith,

Yes, that’s exactly the problem. Bazelisk currently cannot extract the version number from a given local Bazel binary, which is why it can’t fetch the flags needed to migrate from GitHub when using that feature.

If you or others have ideas how to improve this, I’d love to hear them!

philwo avatar Oct 16 '19 19:10 philwo

@keith nice, TIL.

jin avatar Oct 16 '19 19:10 jin

Any reason Bazelisk couldn't run your Bazel to get this?

keith avatar Oct 16 '19 19:10 keith

Yeah, we could do that. I guess the format is stable enough that it shouldn’t cause issues.

philwo avatar Oct 16 '19 20:10 philwo

I recently found out that we have support for bazel --version, which does not require starting up a Bazel server or extracting the install_base, so it's very fast. We could use that to implement the version detection.

philwo avatar Jan 26 '20 12:01 philwo