pantsbuild / setup

Scripts for setting up Pants in your repo
Apache License 2.0
13 stars 30 forks source link

Add version bootstrap tool subcommand, for capability checking #129

Closed huonw closed 1 year ago

huonw commented 1 year ago

This expands on #128 to add another bootstrap tool subcommand: bootstrap-version. This is designed to just be a simple number that's bumped whenever there's a feature scripts might need to query for. The version number is also automatically checked against the (numeric) value of the PANTS_BOOTSTRAP_TOOLS key.

For instance, suppose the bootstrap tools already existed (at version 1), and then bootstrap-cache-key command was added, the version number would be bumped to 2, and then a consumer (such as https://github.com/pantsbuild/actions/pull/6) could run something like:

PANTS_BOOTSTRAP_CACHE_KEY=$(PANTS_BOOTSTRAP_TOOLS=2 ./pants bootstrap-cache-key)

Notes:

benjyw commented 1 year ago

I think it's fine - window is small.

  • The checking could be packaged into the bootstrap script itself: the bootstrap script check that SCRIPT_VERSION >= PANTS_BOOTSTRAP_TOOLS, i.e. the example scenario above could be collapsed to just: PANTS_BOOTSTRAP_CACHE_KEY=$(PANTS_BOOTSTRAP_TOOLS=2 ./pants bootstrap-cache-key). Thoughts?

That could be neat! So the script runs if it's later than PANTS_BOOTSTRAP_TOOLS and fails otherwise?

huonw commented 1 year ago

That could be neat! So the script runs if it's later than PANTS_BOOTSTRAP_TOOLS and fails otherwise?

Yeah, exactly. I've implemented something along those lines.

huonw commented 1 year ago

Oops, thanks for that.