rules_python icon indicating copy to clipboard operation
rules_python copied to clipboard

[Bazel CI] Fix: Update MODULE.bazel.lock file to support latest Bazel version

Open sgowroji opened this issue 1 year ago • 4 comments

CI: https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/4075#01917d6d-0272-46ce-8094-fea6e559eede

Platform: Ubuntu

Logs:

ERROR: [0mThe version of MODULE.bazel.lock is not supported by this version of Bazel. Please run `bazel mod deps --lockfile_mode=update` to update your lockfile.

CC Greenteam @wyverald

sgowroji avatar Aug 23 '24 04:08 sgowroji

Well, that was fast. :joy:

Is there any trick to have a lock file that is compatible with both 7.x and head?

If not, then we'll have to remove --lockfile=error from the bzlmod example and figure out another way to test.

cc @aignas

rickeylev avatar Aug 23 '24 05:08 rickeylev

I think for the latest bazel version runs we could just use --lockfile_mode=update. Is it possible to configure something like this?

aignas avatar Aug 23 '24 10:08 aignas

I looked through the CI docs, but nothing looked promising.

bazelrc files can't do version detection, so we can't do it that way.

Could we modify the CI config to run a bit of shell before the example runs? e.g. [[ <if bazel head> ]] echo "--lockfileupdate >> .bazelrc" ?

Otherwise, the two options i can think of are:

  • Separate CI job. Set the skip_in_downstream_baze:true setting
  • Bazel-in-bazel integration test

rickeylev avatar Aug 23 '24 16:08 rickeylev

I think for now just skipping the examples/bzlmod would be cleanest, however, I realised that we are using this example in publishing the module to BCR, so the current situation is not great. I'll change the .bazelrc to --update as a quickfix, because I think having --lockfile_mode=error is more painful for the time being.

aignas avatar Aug 24 '24 09:08 aignas