mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-13 15:36:25 +00:00
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: Rhys Arkins <rhys@arkins.net> Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
This commit is contained in:
parent
75e7675662
commit
30765fbd1e
4 changed files with 9 additions and 3 deletions
|
@ -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', () => {
|
||||||
'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 {
|
||||||
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(
|
||||||
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
|
||||||
|
|
||||||
- `--generate-hashes`
|
- `--generate-hashes`
|
||||||
- `--allow-unsafe`
|
- `--allow-unsafe`
|
||||||
|
- `--no-emit-index-url`
|
||||||
|
|
Loading…
Reference in a new issue