bitter-ability-32190
06/20/2023, 3:51 PM--isolated
so no support for the "recommend" AWS way for having aws
CLI set pip
config file.
◦ Therefore you have to use the Env Var method:
▪︎ export CODEARTIFACT_AUTH_TOKEN=aws codeartifact get-authorization-token --domain ...
▪︎ Then use the index URL: <https://aws>:$CODEARTIFACT_AUTH_TOKEN@<URL>/pypi/pypi-store/simple/
• That relies on your terminal expanding the env var. Therefore https://www.pantsbuild.org/docs/reference-python-repos#indexes won't work
◦ In fact, I can't find any way to get this working. I think I just can't run generate-lockfiles
. I'll have to lock manually
• For downloading, I also can't seem to get the auth env var working. Again, the index is passed as $CODEARTIFACT_AUTH_TOKEN
verbatim. Even removing that, I keep getting 401 Unauth errors
◦ This is even with [subprocess-environment].env_vars = ["CODEARTIFACT_AUTH_TOKEN"]
. I'm running in the sandbox directly to test it out.
So, that's a brick wall. This also doesn't touch on the asinine timeout AWS tokens have at a maximum of 12 hours. But that's not Pants' fault (although Pants could do a sneaky sneaky to refresh the env var)bitter-ability-32190
06/20/2023, 4:00 PMrefined-addition-53644
06/20/2023, 4:32 PMexport PIP_EXTRA_INDEX_URL="<https://aws>:${CODEARTIFACT_AUTH_TOKEN}@<org>-<account_id>.d.codeartifact.<region>.<http://amazonaws.com/pypi/<repo>/simple/|amazonaws.com/pypi/<repo>/simple/>"
export PANTS_PYTHON_REPOS_INDEXES="+['${PIP_EXTRA_INDEX_URL}']"
bitter-ability-32190
06/20/2023, 4:34 PMrefined-addition-53644
06/20/2023, 4:35 PMchilly-holiday-77415
06/20/2023, 4:36 PMbitter-ability-32190
06/20/2023, 4:37 PMchilly-holiday-77415
06/20/2023, 4:37 PMrefined-addition-53644
06/20/2023, 4:38 PMCODEARTIFACT_AUTH_TOKEN
every time you want to run pants.bitter-ability-32190
06/20/2023, 4:50 PMbitter-ability-32190
06/20/2023, 5:15 PMbitter-ability-32190
06/20/2023, 5:45 PMlate-battery-88991
06/21/2023, 6:14 AMbored-soccer-37961
10/26/2023, 4:30 AMCODEARTIFACT_AUTH_TOKEN
so pants ends up rebuilding all of our pex binaries every run instead of pulling them from our remote cachebitter-ability-32190
10/26/2023, 11:15 AMbored-soccer-37961
10/26/2023, 2:54 PM--use-pip-config
flag in every PEX invocation.
Also in case anybody else comes across this thread, I ran into this project https://github.com/sktan/aws-codeartifact-proxy which could be another solution for folks who don't mind adding another piece of infrastructurebitter-ability-32190
10/26/2023, 2:55 PMkind-traffic-20936
03/27/2024, 12:50 PMkind-traffic-20936
03/27/2024, 12:51 PM[python-repos]
indexes = ["<https://aws>:%(env.CODEARTIFACT_AUTHORIZATION_TOKEN)s@something.d.codeartifact.us-east-1.amazonaws.com/pypi/pyro/simple/"]
Could it cause pants not re-using the cache for pexes?
(unlike the original post, we did get it working -- pants connects to that repo without issues if the env var is present -- however it looks like subsequent CI runs on different machines waste time rebuilding PEX files, which should be cached in our remote cache?)gentle-flower-25372
03/27/2024, 1:22 PMgentle-flower-25372
03/27/2024, 1:22 PMkind-traffic-20936
05/09/2024, 2:17 PMgentle-flower-25372
05/09/2024, 3:01 PMkind-traffic-20936
05/09/2024, 4:10 PMchilly-holiday-77415
05/09/2024, 4:28 PMkind-traffic-20936
05/09/2024, 4:31 PM