Not sure how to resolve this issue, at least until...
# general
w
Not sure how to resolve this issue, at least until the ansible plugin is ready. Using ansible to deploy a bunch of pexes. After packaging, they end up in
dist/...
- however, to deploy them from my ansible role, I need them in specific locations. I haven't been able to resolve symlinks (it just uploads the symlink to the target). Is there a Pantsian way to manipulate the host filesystem?
1
My thought was to package, and then run a script to transfer to them to their expected locations - but wondering if this is something I can do from pants
h
would it help if we didn't write to
dist
and instead wrote to your project? I'm trying to remember why we did
dist/
in the first place
w
Maybe the
shell
target?
Well, I have 10 packages, that need to be split up to several locations... Oh,
outputpath
?
h
Oh, outputpath?
yeah, but still writes to
dist/
. I'm wondering if we changed it so you could write anywhere (in the repo)
w
I thought I recalled a way to change the root dist dir - I could just make it my project root
👍 1
1
h
yep you can, the
--distdir
option. or maybe it's
--pants-distdir
w
Very silly question, but I look for this all the time, and struggle to find it. Is there a
pants.toml
api page somewhere?
h
yeah
w
Gotta say, for being one of the most important files - it's really hard to find in the docs. That link was on page 2 of the search for
pants.toml
Ummm, possibly a bug or a feature here
pants_distdir = "."
Packaging puts my pexes alongside their sources, in whatever subdir that is. I cannot use
pants_distdir = "/"
because it complains about
" InvalidDistDir: When set to an absolute path,
--pants-distdir
must be relative to the build root.You set it to /. Instead, use a relative path or an absolute path relative to the build root."
So, this behaviour is inconsistent with source roots, where this is a good thing:
Copy code
[source]
root_patterns = ["/"]
h
Maybe add a special case so that
/
gets converted to
.
?
w
But
.
is relative to source paths of the files, apparently. So, not sure how to get my project root. Weird though, that
pants_dir = "build"
IS relative to my project root...
... Oh wait...
Hmmm.... maybe it IS relative to my project root, but output path auto-adds the parent folders
1
Phew, okay, that got nutty
Copy code
pants_distdir = "."
Copy code
pex_binary(
    name="configurator",
    entry_point="configurator.py",
    output_path="deployment/roles/app/files/configurator.pex"
)
h
are you going to permenantly set
pants_distdir
, or only when building this? It will impact things like
./pants export-codegen
w
I dont have any codegen in this project, just a whole bunch of shell and python scripts.
I think this is all placeholder until we land the ansible plugin - which can then auto-pick up the packages as needed
👍 1
c
many ansible tasks have an option to follow symlinks which is false by default. eg ansible.builtin.copy, it's p annoying.
w
Whoa, weird - why wasn't it working then.....? I was so sure there was a way to resolve them, but never had luck
I wonder if I had some weird filesystem setup while doing this, maybe - because only my symlinks ended up on target
c
it's off by default, so the default is to copy the symlinks
w
Looks like default on - however, this is a good point that I should check BOTH follow and local_follow - I actually don't know which ones I've been using 🤦‍♂️
I think the pex output_path is still good, however, for all my bash scripts, I would prefer to keep them in the local source dirs and then symlink