wooden-baker-63668
01/11/2023, 10:38 AMwitty-crayon-22786
01/11/2023, 5:28 PMpantsd
exits: if you’re seeing otherwise, please definitely file an issue, ideally with a reprowooden-baker-63668
01/12/2023, 5:55 AMpantsd
running on the environment, just a script which executes the pex file built outside in a CI/CD.
We decided to use a pex file because it makes bundling dependencies easier.
We execute the pex file multiple times throughout the container’s lifecycle because it bundles a CLI tool which we execute periodically through a script running inside the container.wooden-baker-63668
01/12/2023, 5:59 AMwooden-baker-63668
01/12/2023, 6:09 AMpantsd
the only tool responsible/capable of cleaning up the temporary files left behind by an .pex
file when it unpacks itself in /tmp
or is there another tool or configuration that can be used to make sure those files are deleted?
I can always create a bash script to do this, but if there is a tool in pantsbuild arsenal for the job, I’d rather use it for this purpose.
Once again, thanks for any help.careful-address-89803
01/12/2023, 8:24 AMhappy-kitchen-89482
01/12/2023, 12:45 PMhappy-kitchen-89482
01/12/2023, 12:46 PMhappy-kitchen-89482
01/12/2023, 12:46 PMhappy-kitchen-89482
01/12/2023, 12:47 PMenough-analyst-54434
01/12/2023, 1:56 PMwooden-baker-63668
01/12/2023, 5:04 PMfind /tmp -name 'PEX-INFO' | cut -d '/' -f 1-3 | xargs rm -r;
… after the pex execution. It should suffice for now. But I might test it with dirname
instead of the cut
. Probably more robust approach.enough-analyst-54434
01/12/2023, 5:05 PMenough-analyst-54434
01/12/2023, 5:06 PMwooden-baker-63668
01/12/2023, 6:06 PMenough-analyst-54434
01/12/2023, 6:11 PMwooden-baker-63668
01/13/2023, 6:00 PMPEX-INFO
includes the following (I’ve removed the bootstrap_hash
, code_hash
and distributions
, please let me know you need them).
{
"build_properties": {
"pex_version": "2.1.111"
},
"emit_warnings": true,
"entry_point": "kapitan",
"ignore_errors": false,
"includes_tools": false,
"inherit_path": "false",
"inject_args": [],
"inject_env": {},
"interpreter_constraints": [],
"pex_hash": "3f81ccc94c8c170878d2be24b312593d8b4293b8",
"pex_path": "",
"pex_paths": [],
"requirements": [
"grafanalib==0.5.12",
"httplib2==0.19.1",
"kapitan==0.30.0"
],
"strip_pex_env": true,
"venv": false,
"venv_bin_path": "false",
"venv_copies": false,
"venv_site_packages_copies": false
}
As I mentioned above, and re-iterate now but with more detail, the pex file (named kapitan
) is executed directly from a script that is similar to;
for f in *.yml; do (...); done | kapitan refs --reveal -f -;
this script is executed with /bin/sh -c
, the only process running on the container.
This leads me to believe that maybe pants is not involved at all with any clean-up process because it is not running on the container, unless kapitan
executes it somehow.enough-analyst-54434
01/13/2023, 6:03 PMenough-analyst-54434
01/13/2023, 6:05 PMenough-analyst-54434
01/13/2023, 6:06 PMkapitan
PEX runs in?enough-analyst-54434
01/13/2023, 6:11 PM$ pex pex==2.1.111 -cpex -- --resolver-version pip-2020-resolver grafanalib==0.5.12 httplib2==0.19.1 kapitan==0.30.0 -o kapitan -c kapitan
$ sudo rm -rf /tmp/*
[sudo] password for jsirois:
$ ls -lrt /tmp/
total 0
$ echo $PEX_ROOT
$ echo $HOME
/home/jsirois
$ ./kapitan
usage: kapitan [-h] [--version] {eval,e,compile,c,inventory,i,searchvar,sv,secrets,s,refs,r,lint,l,init,validate,v} ...
Generic templated configuration management for Kubernetes, Terraform and other things
positional arguments:
{eval,e,compile,c,inventory,i,searchvar,sv,secrets,s,refs,r,lint,l,init,validate,v}
commands
eval (e) evaluate jsonnet file
compile (c) compile targets
inventory (i) show inventory
searchvar (sv) show all inventory files where var is declared
secrets (s) (DEPRECATED) please use refs
refs (r) manage refs
lint (l) linter for inventory and refs
init (i) initialize a directory with the recommended kapitan project skeleton.
validate (v) validates the compile output against schemas as specified in inventory
options:
-h, --help show this help message and exit
--version show program's version number and exit
$ ls -lrt /tmp/
total 0
enough-analyst-54434
01/13/2023, 6:12 PM/tmp
. The only way it could is if you exported PEX_ROOT=/tmp
or HOME
was in /tmp
.wooden-baker-63668
01/13/2023, 6:41 PMPEX_ROOT
or HOME
are present in the environment and if they are set to /tmp
. Thanks for the help so far.wooden-baker-63668
01/17/2023, 6:07 PMmkdir -p /tmp/.pex
and PEX_ROOT='/tmp/.pex/' kapitan ...
wooden-baker-63668
01/17/2023, 6:07 PMenough-analyst-54434
01/17/2023, 6:09 PMenough-analyst-54434
01/17/2023, 6:10 PMwooden-baker-63668
01/17/2023, 6:11 PMwooden-baker-63668
01/17/2023, 6:12 PM/tmp/.pex/XXX
enough-analyst-54434
01/17/2023, 6:12 PMwooden-baker-63668
01/17/2023, 6:12 PMenough-analyst-54434
01/17/2023, 6:12 PMenough-analyst-54434
01/17/2023, 6:12 PMwooden-baker-63668
01/17/2023, 6:12 PMwooden-baker-63668
01/17/2023, 6:13 PM