-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
"sam build" feedback: Support private PyPi repositories #794
Comments
In addition to passing the options directly in the sam build command line, pip has a couple of ways of storing the information so you don't have to explicitly pass it in via each command line: Config fileThe pypi user and password can be stored in a config file in some specific locations (e.g. Environment VariablesYou can now use environment variables within a requirements.txt with pip 10+. This could allow you to do something like...
With this I can now run |
@sanathkr you reckon we could add an additional argument to the build command to pass in environment variables to the build container?
Should be fairly easy to hook up as the BuildContainer uses Container class which already allows env vars to be passed in. Thanks! |
@billyshambrook I wonder if we just pass system env vars into the container instead? I have had this conversation with @sthulb about the Go builders some time back. I am not sure why we don't pass the env vars into the container already (maybe some security reason?) but I think it makes sense for build to pass the system env vars into the container by default. Here is the code where we made the decision right now: https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/local/docker/lambda_build_container.py#L87 @sanathkr Thoughts? |
We did not pass environment variables to provide isolation. When you build inside the container, the environment is not tainted by configuration you have set in your terminal. However, I think it is a good idea to pass through standard environment variables used by package managers. @billyshambrook Do you know which env vars are standard to Python Packaging (Twine, PyPi) etc? We could make a change to automatically pass those through, if available. |
So we would have to keep a mapping of what each package manager to "standard" environment variables? That sounds like more configuration we have to keep track of and another point for customers to get confused by ("I can build locally but not in the container"). I don't see why we can't pass the system env vars. I don't agree that it taints the configuration. I should be able to define env vars to configure things in the container or locally. |
Yes, it is another set of configs to maintain, but in reasonable time we will get good coverage of the standard envvars. I think we should set clear expectations of building locally vs container. This where the confusion is. Based on how we define we could go one way or the other |
It’s too constraining. If we don’t want to mount system env vars, we should at least provide a way for customers to configure. Keeping this mapping does not scale. Provided runtimes, plugin builders, etc. I am strongly against having SAM CLI maintain and updating what env vars map to what container. It’s just another “X introduced Y” that we have to keep track of. |
I had the same issue with env vars and setting specific build parameters for the pip install (CFLAGS, etc) would not make sense something like it was suggested above by @billyshambrook |
We'd like to pass
file:
Output:
Is there any workaround or another approach to pass these settings to pip in |
Is there any more work on this? We are facing a similar problem where we want to include private repos into our requirements.txt file but would need to hardcode user and passwords into the file to get them. |
Hi @jfuss just wanted to check whether you have any recent updates on this? My use case is slightly different as I have private github repos so I'd need to pass in a github token (or ssh key) and build within the container. This is essentially the same to the question I've found on stack overflow here |
Any updates on this issue? How have people installed private packages into their lambdas? |
This is a direct need to any customers that have private packages. Not sure why this wasnt included in the 1.0 release. |
We have the same issue, is there any way to install private python package ? EDIT
SAM error message is very unfriendly... |
We have a workaround. Since SAM is using PIP under the covers. We just generate as part of the build system a pip.conf in the correct directory. When SAM runs, and pip is called, it loads the pip.conf. We are using artifactory virtual repositories to allow us to pull from both public pip via pip remote and local repositories within artifactory Using a jenkins library:
|
Relates to: #2144 |
Something that worked for us was to have the extra-index-url in the requirements.txt itself The requirements.txt looks like this
|
@shivambats yes, but if you UPDATE:Now you can, with the parameter |
This issue has been open for quite some time. Its seems this is a common enough use case and problem that it should be addressed. |
This has been wrecking my day. Guess I'll be hard-coding some URLs for a bit. 😭 |
Also run into this problem. It's extra inconvenient if your private repository has temporary credentials, e.g. CodeArtifact. |
We're facing currently the same issue as @naxxfish at the company: trying to build an application, with python depenencies in CodeArtifact with |
👍 to @liszi - I'm exploring CodeArtifact for private packages and trying to reconcile local builds using containers with this. A way to leverage |
Be warned that it can be a pain in the butt to keep regenerating your token for local development. |
@timbedard the auth tokens can go up to 12 hours so not too concerned there. More an issue of guidance to my devs on reusing tokens and not grabbing new ones every time. |
This. Please. Not sure why this isn't fully supported, especially with CodeArtifact. |
Description:
Some companies host their own internal Pypi servers. They install requirements thru something like:
sam build
needs to support passing extra options to PIP in this caseThe text was updated successfully, but these errors were encountered: