VirtusLab / bazel-steward

A bot to keep Bazel dependencies up to date
https://virtuslab.github.io/bazel-steward/
Apache License 2.0
60 stars 5 forks source link

How can we prevent major version bumps? #319

Closed dhalperi closed 7 months ago

dhalperi commented 8 months ago

Want to default all upgrades to only be same major version as current.

lukaszwawrzyk commented 8 months ago

Hi! There is no direct way to do this for all dependencies automatically. What you can do, is pin each dependency using update-rules:

update-rules:
  - dependencies: commons-io:commons-io
    pin: "2."
  - dependencies: com.typesafe.config
    pin: "3."
lukaszwawrzyk commented 7 months ago

It is now possible as a new bumping strategy. Either patch-minor - will bump to the latest patch before bumping major or minor-patch - will first bump to the latest minor+patch and only if no newer minor is available, will bump patch. Neither of these bump major.

configure it with

update-rules:
  - bumping: minor-patch

it would set this strategy for all dependencies

dhalperi commented 7 months ago

This is cool, will check it out!

dhalperi commented 6 months ago

Does this work? e.g., https://github.com/batfish/batfish/actions/runs/7886257435/job/21519127953 still seems to be trying to upgrade major versions (bazel 7.0.2).

here's the config: https://github.com/batfish/batfish/blob/master/.bazel-steward.yaml

lukaszwawrzyk commented 6 months ago

@dhalperi I am sorry for the confusion. The feature does work, the problem is with picking up your config file. Update your github actions with:

      - uses: VirtusLab/bazel-steward@latest
        with:
          configuration-path: "./.bazel-steward.yaml"

Docs are confusing, as they state that you can use {.,}bazel-steward.y{a,}ml as config name and bazel steward will pick it up. However this is only true if --configuration-path is not specified explicitly in the command line. The github action does specify a default configuration path as bazel-steward.yaml and passes it as --configuration-path to Bazel Steward, thus the default detection logic doesn't kick.

We should clean up the definition of github action to by default use the CLI app default logic rather than always pass something in the --configuration-path flag.