microscopic-knife-5995
01/27/2025, 11:51 PMrun_shell_command
and going the final mile.
Hello team, I am trying to make deployment automatic from our monorepo. I have two pex targets: deployer
and deployee
. I would like to make it easy to devs to deploy from our monorepo using pants something as simple as:
pants run server:deploy
The current solution I have is to do
run_shell_command(
name="deploy",
command="$CHROOT/path.to/deployer.pex $CHROOT/path.to/deployee.pex",
execution_dependencies=[":deployee", ":deployer"],
)
Is this recommended? Somehow hard coding $CHROOT
doesn't feel right...careful-address-89803
01/29/2025, 5:19 PMrun_shell_command
.
You could write a macro to generate these. Here's an example, and the doc for adding macros will help you install it
def deployable(deployer, deployee):
run_shell_command(
name="deploy",
command=f"$CHROOT/{deployer}.pex $CHROOT/{deployee}.pex",
execution_dependencies=[f":{deployee}"],
runnable_dependencies=[f":{deployer}"]
)
If you're open to writing plugins, we've got the experimental-deploy
goal. Implementing it is currently undocumented but I did a writeup as part of an MR. There's a bit more work for packaging the deployee and including it as part of the sandbox. Honestly I think the Macro is probably easier.microscopic-knife-5995
01/29/2025, 5:21 PM