Is there a way I can write a custom "bootstrap" sc...
# general
f
Is there a way I can write a custom "bootstrap" script for
pants
? I use CodeArtifact for a private PyPi repository, so I need
CODEARTIFACT_AUTH_TOKEN
to be set in the environment. It'd be pretty cool if I could somehow hook into the bootstrap process to: • check if the
CODEARTIFACT_AUTH_TOKEN
environment variable is set. ◦ if so, continue ◦ if not, set it ▪︎ upon failure, throw an error message telling the dev what to do Is this possible? Thanks!
f
The
,/pants
script can always be customized for your reposiory.
f
Oh, interesting. I was thinking about this as a "vendored" script (e.g., don't touch it)
l
you can also use
.pants.bootstrap
👀 1
which gets sourced by the default
./pants
script
f
I didn't even know that. learned something new! 🙂
l
i can't find docs for it right now
maybe its a 2.15 thing?
f
The
./pants
script lives in its own repo: https://github.com/pantsbuild/setup/blob/gh-pages/pants
so maybe docs are in that repo?
although we then link people back to https://www.pantsbuild.org/docs/installation so maybe time to add some docs to the docs site
b
FWIW when we switch to `scie-pants`that may or may not get ported. I think the current assumption is it is just for env vars (similar to .env)
e
It's already ported
f
This is working great for me - thanks for the pointer!
Btw, the default/recommended
.gitignore
excludes this file: https://www.pantsbuild.org/docs/initial-configuration (see step 4 which recommends):
Copy code
# Pants workspace files
/.pants.*
/dist/
/.pids
I updated it locally to use this:
Copy code
# Pants workspace files
/.pants.*
!.pants.bootstrap
/dist/
/.pids
Should the docs be updated?
l
It depends - we use it in such a way that we want it checked in (contains no secrets).
f
Ah, sure. Makes sense that sometimes you wouldn't want it tracked.
b
The glob predates that file. Might need updating
f
I guess it depends on which one is less like a "foot gun". Track by default, opting out if you have secrets in there, or vice versa.
e
Leaking secrets is always a bigger footgun than ~anything.
f
Sure. if the intention is that the bootstrap file will usually contain secrets, then it's probably safest to exclude it. In my case, it does not contain secrets.
e
And there's a difference between footguns and handholding. I trust devs to not really need handholding.
f
Is the handholding you're referencing "knowing how to use .gitignore"?
In any case, I don't feel strongly either way. I just wanted to bring it up since I knew it's a new file and I ran into it ¯\_(ツ)_/¯
e
Yeah, I trust devs to know how to use .gitignore.
👌 1