Skip to content
Sean Escriva edited this page Jul 3, 2015 · 1 revision

Batali resolve

The resolve command will resolve all dependencies and generate the manifest file batali.manifest

Available options for the resolve command can be viewed with the help flag.

$ batali resolve -h
Usage: batali resolve [options]
    -c, --config              Configuration file path
    -V, --verbose             Enable verbose output
    -D, --debug               Enable debug mode
    -f, --file                Path to Batali file
    -d, --dry-run             Print changes
    -l, --least-impact        Update cookbooks with minimal version impact (default: true)
    -I, --infrastructure      Resolve infrastructure cookbooks
    -h, --help                Display this help message.

Resolve options

  • -c, --config optionally override the path to the config file, default is .batali
  • -V, --verbose provide more output during resolution, such as file paths
  • -D, --debug provide even more output during resolution, such as cache path, checksums, unit addition and scoring
  • -f, --file optionally override the path the Batali file
  • -d, --dry-run print what would be done but don't actually make any changes
  • -l, --least-impact use minimal version impact, the default behavior
  • -I, --infrastructure resolve for the full infrastructure

Least impact updates

Once a batali.manifest file has been generated, further attempts to resolve will update cookbook versions using a "least impact" approach. This means that by default if the Batali file has not changed, running a batali resolve will be a noop, even if new versions of cookbooks may be available.

This is by design and is much safer than optimistically selecting a newer version. This helps to reduce unintended upgrades that may break things due to a required cookbook update. This behavior can be disabled if really desired by setting least_impact to false in the config file.

Allowing a cookbook to be updated is done simply by explicitly adding it to the resolve request:

$ batali resolve example

This will only update the version of the example cookbook, and any dependency cookbooks that must be updated to provide resolution. Dependency cookbooks that require an upgrade based on constraints will attempt to upgrade with the least impact possible by attempting to satisfy constraints within the minimum version segement possible. For example, if our Batali file contains the following:

Batali.define do
  source 'https://example.com'
  cookbook 'soup'
end

and after resolving we have two cookbooks in our manifest:

soup <1.0.0>
salad <0.1.4>

Some time passes and a new version of soup is released, version 1.0.2. In that time multiple new versions of the salad cookbook have been released, with new features and with some breaking changes. For this example, lets assume available versions of the salad cookbook are:

<0.1.4>
<0.1.6>
<0.1.8>
<0.2.0>
<0.2.2>
<0.3.0>
<1.0.0>

and the soup cookbook has updated its salad dependency:

# soup metadata.rb
depends 'salad', '> 0.2'

Due to the behavior of existing solvers, we may expect the resolved manifest to include salad at the latest possible version: 1.0.0. This is a valid solution, since the dependency is simply stating the constraint requires salad be greater than 0.2 and nothing more. However, this is a very large jump from what we currently have defined within our manifest, and jumps a major and minor version. The possibility of breaking changes being introduced is extremely high.

Since Batali has the least impact feature enabled by default, it will only upgrade salad to the 0.2.2 version. This is due to the fact that the least impact feature prefers the latest cookbook available within the closest version segement of the cookbook version currently defined within the manifest. Since thew new soup dependency contraint requires versions > 0.2, no > 0.1 versions are acceptable. Batali then looks to the next available segment 0.2 and attempts to use the latest version: 0.2.2. This solves the constraint, and is used for the new solution.

Multiple cookbooks can be listed for upgrade:

$ batali resolve example ipsum lorem

or this feature can be disabled to allow everything to be updated to the latest possible versions:

$ batali resolve --no-least-impact