pantsbuild / setup

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

Add 'bootstrap tools' (bootstrap-cache-key) via PANTS_BOOTSTRAP_TOOLS=1 #128

Closed huonw closed 2 years ago

huonw commented 2 years ago

This adds functionality that can introspect the bootstrapping process, similar to PEX_TOOLS=1 ./some.pex ... being able to introspect a PEX file.

The motivating tool, added here, is PANTS_BOOTSTRAP_TOOLS=1 ./pants bootstrap-cache-key that prints a somewhat opaque string designed to be used as a key for CI caching systems. This is designed to help with https://github.com/pantsbuild/actions/issues/5, and is prompted by the discussion in https://github.com/pantsbuild/actions/pull/6#discussion_r978745702.

For example, on my system:

$ PANTS_BOOTSTRAP_TOOLS=1 ./pants bootstrap-cache-key
os_name=Darwin arch=arm64 python_path=/Users/huon/.pyenv/shims/python3.9 python_version=Python 3.9.10 pex_version=2.1.103 virtualenv_requirements_sha256=80b5a45ee3ee507e268799305d4e5e347c7e8346df6551b6a83df05396b3d941 pants_version=2.13.0

(This PR is a quick sketch, please lemme know if it doesn't make sense!)

huonw commented 2 years ago

Thanks for merging. Based on your comment about adding new subcommands in future, I was prompted to think about versioning for scripts, and thus opened https://github.com/pantsbuild/setup/pull/129.

huonw commented 2 years ago

Ah, and I discovered a small bug: https://github.com/pantsbuild/setup/pull/130