Skip to content
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

feat(pip): support env var interpolation #6648

Merged
merged 3 commits into from Jul 7, 2020
Merged

feat(pip): support env var interpolation #6648

merged 3 commits into from Jul 7, 2020

Conversation

TheKevJames
Copy link
Contributor

As of Pip v10+, environment variables are supported in requirements.txt
files and will be automatically interpolated. This changeset allows
Renovate to parse registry URLs conforming to that syntax properly and
follow the same approach, eg. by interpolating the environment variables
in the same way as would pip.

Note that interpolating env vars is hidden behind the trustLevel=high
flag, as described in the Renovate docs: https://github.com/renovatebot/renovate/blob/d70b8c1f2fa999be9684a8ca5da3dda8cd2392ab/docs/usage/self-hosted-configuration.md#trustlevel

Additionally, we unconditionally strip " characters from the same
registryUrls as those are optional in the pip spec (with no behavioural
impact) but cause lookup errors for Renovate.

Copy link
Member

@viceice viceice left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need test fixes

As of Pip v10+, environment variables are supported in requirements.txt
files and will be automatically interpolated. This changeset allows
Renovate to parse registry URLs conforming to that syntax properly and
follow the same approach, eg. by interpolating the environment variables
in the same way as would pip.

Note that interpolating env vars is hidden behind the trustLevel=high
flag, as described in the Renovate docs: https://github.com/renovatebot/renovate/blob/d70b8c1f2fa999be9684a8ca5da3dda8cd2392ab/docs/usage/self-hosted-configuration.md#trustlevel

Additionally, we unconditionally strip `"` characters from the same
registryUrls as those are optional in the pip spec (with no behavioural
impact) but cause lookup errors for Renovate.
@TheKevJames
Copy link
Contributor Author

@viceice sorry about that, should have opened this as a draft. Now ready for review!

@rarkins rarkins requested a review from viceice July 3, 2020 04:10
describe('lib/manager/pip_requirements/extract', () => {
delete process.env.PIP_TEST_TOKEN;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move that into before each please. We should also remove it after each test to be sure it would not interfere any other tests in future.

Same for trustLevel.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure thing, done. FYI, I copied this construct from lib/datasource/npm/index.spec.ts, which you might want to update in the same way.

@rarkins rarkins merged commit 634e553 into renovatebot:master Jul 7, 2020
@renovate-release
Copy link
Collaborator

🎉 This PR is included in version 21.24.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@TheKevJames TheKevJames deleted the pip-env-var-interpolation branch July 7, 2020 22:33
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants