fresh-continent-76371
02/26/2024, 11:28 AMpython_artifact( )
to the wheel target... but this was clunky
⢠for docker images, by setting the "environment" variable on the outside when package / publishing the image, but lifting the value in through the ENV_VAR (as a tag) - but again - this seems clunky ..
Is there a target that can read a file, and provide the contents of that file as a {replacement} variable, or as the setting to command (say arg to a run_shell_command
or shell_command
or adhoc_...
?fresh-continent-76371
02/26/2024, 11:30 AM# BUILD
version_and_changelog()
# other targets ...
which provides a special target, pants run path/to/target:bump_version
, pants run path/to/target:gen_changelog
but I am after a more universal way of reading the "`VERSION` " file than piece-meal for each targetcurved-television-6568
02/26/2024, 2:57 PM# .pants.bootstrap
MY_VERSION=$(cat src/path/to/VERSION)
export MY_VERSION
# macros.py
MY_VERSION = env("MY_VERSION")
# pants.toml
[GLOBAL]
build_file_prelude_globs = ["macros.py"]
# some/BUILD
some_target(version=MY_VERSION, ...)
or, as default:
__defaults__({docker_image: dict(image_tags=[MY_VERSION])})
fresh-continent-76371
02/26/2024, 9:52 PM./apps/arc/VERSION
./apps/devolver/VERSION
./apps/log_manager/VERSION
./lib/finder_2000/VERSION
./lib/knohh/VERSION
./tools/containers/cicd-general/VERSION
./tools/python/acme_cicd/VERSION
./tools/python/acme_cicd/VERSION
There are two modes of operation ;
⢠pants run ... :bump_version
and
⢠pants package publish //
fresh-continent-76371
02/26/2024, 9:57 PMfind . -name VERSION -exec dirname {} \; | xargs -Ixx sh -c 'VERSION=$(cat xx/VERSION) pants package publish //xx::'
or other crazy incantations š
also.. if I can be getting "pants" to lift the version and use it inside it's packaging mechanism, then I will be able to take advantage of more native pants filtering mechanisms like changed-since
and changed-dependents
pants_command = f"""pants --level=error
--filter-target-type=archive,docker_image,pex_binary,python_distribution
--changed-since={last_commit.id}
--changed-dependents=transitive
--filter-address-regex={filter_regex} list"""
curved-television-6568
02/27/2024, 8:27 AMfresh-continent-76371
02/27/2024, 10:37 AMfresh-continent-76371
02/27/2024, 10:38 AMcurved-television-6568
02/27/2024, 11:16 AMfresh-continent-76371
02/27/2024, 8:52 PMpowerful-scooter-95162
02/27/2024, 11:45 PM