Skip to content
Snippets Groups Projects
Unverified Commit 30765fbd authored by Christoph Brand's avatar Christoph Brand Committed by GitHub
Browse files

feat(manager): no-emit-index-url in pip compile (#15367)


* feat(manager): no-emit-index-url in pip compile

Add support for no-emit-index-url to avoid sharing
confident credentials in the generated requirements.txt
file.

* chore: linting fixes

* chore: update docs

* chore: code review fixes

Co-authored-by: default avatarRhys Arkins <rhys@arkins.net>
Co-authored-by: default avatarMichael Kriese <michael.kriese@visualon.de>
parent 75e76756
No related branches found
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
# This file is autogenerated by pip-compile with python 3.9 # This file is autogenerated by pip-compile with python 3.9
# To update, run: # To update, run:
# #
# pip-compile --allow-unsafe --generate-hashes --output-file=requirements.txt requirements.in # pip-compile --allow-unsafe --generate-hashes --no-emit-index-url --output-file=requirements.txt requirements.in
# #
attrs==21.2.0 \ attrs==21.2.0 \
--hash=sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1 \ --hash=sha256:149e90d6d8ac20db7a955ad60cf0e6881a3f20d37096140088356da6c716b0b1 \
......
...@@ -182,7 +182,7 @@ describe('modules/manager/pip-compile/artifacts', () => { ...@@ -182,7 +182,7 @@ describe('modules/manager/pip-compile/artifacts', () => {
'subdir/requirements.txt' 'subdir/requirements.txt'
) )
).toBe( ).toBe(
'pip-compile --allow-unsafe --generate-hashes --output-file=requirements.txt requirements.in' 'pip-compile --allow-unsafe --generate-hashes --no-emit-index-url --output-file=requirements.txt requirements.in'
); );
}); });
......
...@@ -47,6 +47,11 @@ function getPipToolsConstraint(config: UpdateArtifactsConfig): string { ...@@ -47,6 +47,11 @@ function getPipToolsConstraint(config: UpdateArtifactsConfig): string {
const constraintLineRegex = regEx( const constraintLineRegex = regEx(
/^(#.*?\r?\n)+# {4}pip-compile(?<arguments>.*?)\r?\n/ /^(#.*?\r?\n)+# {4}pip-compile(?<arguments>.*?)\r?\n/
); );
const allowedPipArguments = [
'--allow-unsafe',
'--generate-hashes',
'--no-emit-index-url',
];
export function constructPipCompileCmd( export function constructPipCompileCmd(
content: string, content: string,
...@@ -58,7 +63,7 @@ export function constructPipCompileCmd( ...@@ -58,7 +63,7 @@ export function constructPipCompileCmd(
if (headers?.groups) { if (headers?.groups) {
logger.debug({ header: headers[0] }, 'Found pip-compile header'); logger.debug({ header: headers[0] }, 'Found pip-compile header');
for (const argument of split(headers.groups.arguments)) { for (const argument of split(headers.groups.arguments)) {
if (['--allow-unsafe', '--generate-hashes'].includes(argument)) { if (allowedPipArguments.includes(argument)) {
args.push(argument); args.push(argument);
} else if (argument.startsWith('--output-file=')) { } else if (argument.startsWith('--output-file=')) {
const file = upath.parse(outputFileName).base; const file = upath.parse(outputFileName).base;
......
...@@ -47,3 +47,4 @@ Renovate reads the `requirements.txt` file and extracts these `pip-compile` argu ...@@ -47,3 +47,4 @@ Renovate reads the `requirements.txt` file and extracts these `pip-compile` argu
- `--generate-hashes` - `--generate-hashes`
- `--allow-unsafe` - `--allow-unsafe`
- `--no-emit-index-url`
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment