Compare commits

...

7 commits

Author SHA1 Message Date
Oluf Lorenzen
2cbe2541e7
Merge 174eb59d44 into 2c75a8d4f7 2025-01-07 22:41:59 +05:30
Pascal Berger
2c75a8d4f7
feat(presets): Add redirect URL for SkiaSharp NuGet packages (#33452)
Some checks are pending
Build / setup-build (push) Waiting to run
Build / setup (push) Waiting to run
Build / prefetch (push) Blocked by required conditions
Build / lint-eslint (push) Blocked by required conditions
Build / lint-prettier (push) Blocked by required conditions
Build / lint-docs (push) Blocked by required conditions
Build / lint-other (push) Blocked by required conditions
Build / (push) Blocked by required conditions
Build / codecov (push) Blocked by required conditions
Build / coverage-threshold (push) Blocked by required conditions
Build / test-success (push) Blocked by required conditions
Build / build (push) Blocked by required conditions
Build / build-docs (push) Blocked by required conditions
Build / test-e2e (push) Blocked by required conditions
Build / release (push) Blocked by required conditions
Code scanning / CodeQL-Build (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
whitesource-scan / WS_SCAN (push) Waiting to run
2025-01-07 16:13:55 +00:00
Michael Kriese
ac9ddf3266
fix(manager/github-actions): preserve full depName (#33450) 2025-01-07 15:17:38 +00:00
Michael Kriese
37c05dc72f
fix(datasource/docker): handle empty newValue in getDigest (#33449) 2025-01-07 14:23:56 +00:00
Oluf Lorenzen
174eb59d44
add missing fixture 2024-06-17 15:41:22 +02:00
Oluf Lorenzen
051680027e
autoformat code 2024-06-17 15:40:53 +02:00
Oluf Lorenzen
b2f23ecc3c
feat(manager/pip_requirements): allow = as extra-url separator 2024-06-17 15:21:52 +02:00
8 changed files with 64 additions and 19 deletions

View file

@ -505,7 +505,10 @@
"shiki": "https://github.com/shikijs/shiki",
"shopify-app-bridge": "https://github.com/Shopify/app-bridge",
"sitecore-jss": "https://github.com/Sitecore/jss",
"skiasharp": "https://github.com/mono/SkiaSharp",
"skiasharp": [
"https://github.com/mono/SkiaSharp",
"https://go.microsoft.com/fwlink/?linkid=868515"
],
"slack-net": "https://github.com/soxtoby/SlackNet",
"slf4j": "https://github.com/qos-ch/slf4j",
"slim-message-bus": "https://github.com/zarusz/SlimMessageBus",

View file

@ -98,10 +98,13 @@ describe('modules/datasource/docker/index', () => {
.reply(200, { token: 'some-token' });
hostRules.find.mockReturnValue({});
const res = await getDigest({
datasource: 'docker',
packageName: 'some-dep',
});
const res = await getDigest(
{
datasource: 'docker',
packageName: 'some-dep',
},
'',
);
expect(res).toBe('some-digest');
});

View file

@ -831,7 +831,7 @@ export class DockerDatasource extends Datasource {
// TODO: types (#22198)
`getDigest(${registryHost}, ${dockerRepository}, ${newValue})`,
);
const newTag = newValue ?? 'latest';
const newTag = is.nonEmptyString(newValue) ? newValue : 'latest';
let digest: string | null = null;
try {
let architecture: string | null | undefined = null;

View file

@ -467,7 +467,7 @@ describe('modules/manager/github-actions/extract', () => {
build:
steps:
- name: "test1"
uses: https://github.com/actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # tag=v3.1.1
uses: https://github.com/actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # tag=v4.2.0
- name: "test2"
uses: https://code.forgejo.org/actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # v3.1.1
- name: "test3"
@ -479,14 +479,18 @@ describe('modules/manager/github-actions/extract', () => {
expect(res).toMatchObject({
deps: [
{
currentDigest: '56337c425554a6be30cdef71bf441f15be286854',
currentValue: 'v3.1.1',
depName: 'https://github.com/actions/cache',
packageName: 'actions/cache',
currentDigest: '1bd1e32a3bdc45362d1e726936510720a7c30a57',
currentValue: 'v4.2.0',
replaceString:
'https://github.com/actions/setup-node@56337c425554a6be30cdef71bf441f15be286854 # tag=v3.1.1',
'https://github.com/actions/cache/save@1bd1e32a3bdc45362d1e726936510720a7c30a57 # tag=v4.2.0',
datasource: 'github-tags',
registryUrls: ['https://github.com/'],
},
{
depName: 'https://code.forgejo.org/actions/setup-node',
packageName: 'actions/setup-node',
currentDigest: '56337c425554a6be30cdef71bf441f15be286854',
currentValue: 'v3.1.1',
replaceString:

View file

@ -19,7 +19,7 @@ import type { Workflow } from './types';
const dockerActionRe = regEx(/^\s+uses\s*: ['"]?docker:\/\/([^'"]+)\s*$/);
const actionRe = regEx(
/^\s+-?\s+?uses\s*: (?<replaceString>['"]?(?<registryUrl>https:\/\/[.\w-]+\/)?(?<depName>[\w-]+\/[.\w-]+)(?<path>\/.*)?@(?<currentValue>[^\s'"]+)['"]?(?:(?<commentWhiteSpaces>\s+)#\s*(((?:renovate\s*:\s*)?(?:pin\s+|tag\s*=\s*)?|(?:ratchet:[\w-]+\/[.\w-]+)?)@?(?<tag>([\w-]*-)?v?\d+(?:\.\d+(?:\.\d+)?)?)|(?:ratchet:exclude)))?)/,
/^\s+-?\s+?uses\s*: (?<replaceString>['"]?(?<depName>(?<registryUrl>https:\/\/[.\w-]+\/)?(?<packageName>[\w-]+\/[.\w-]+))(?<path>\/.*)?@(?<currentValue>[^\s'"]+)['"]?(?:(?<commentWhiteSpaces>\s+)#\s*(((?:renovate\s*:\s*)?(?:pin\s+|tag\s*=\s*)?|(?:ratchet:[\w-]+\/[.\w-]+)?)@?(?<tag>([\w-]*-)?v?\d+(?:\.\d+(?:\.\d+)?)?)|(?:ratchet:exclude)))?)/,
);
// SHA1 or SHA256, see https://github.blog/2020-10-19-git-2-29-released/
@ -74,6 +74,7 @@ function extractWithRegex(
if (tagMatch?.groups) {
const {
depName,
packageName,
currentValue,
path = '',
tag,
@ -90,12 +91,13 @@ function extractWithRegex(
}
const dep: PackageDependency = {
depName,
...(packageName !== depName && { packageName }),
commitMessageTopic: '{{{depName}}} action',
datasource: GithubTagsDatasource.id,
versioning: dockerVersioning.id,
depType: 'action',
replaceString,
autoReplaceStringTemplate: `${quotes}${registryUrl}{{depName}}${path}@{{#if newDigest}}{{newDigest}}${quotes}{{#if newValue}}${commentWhiteSpaces}# {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}${quotes}{{/unless}}`,
autoReplaceStringTemplate: `${quotes}{{depName}}${path}@{{#if newDigest}}{{newDigest}}${quotes}{{#if newValue}}${commentWhiteSpaces}# {{newValue}}{{/if}}{{/if}}{{#unless newDigest}}{{newValue}}${quotes}{{/unless}}`,
...(registryUrl
? detectDatasource(registryUrl)
: customRegistryUrlsPackageDependency),

View file

@ -0,0 +1,10 @@
# Repositories
--index-url=https://artifactory.company.com/artifactory/api/pypi/python/simple --trusted-host artifactory.company.com --default-timeout 600
--extra-index-url=http://example.com/private-pypi/
# Packages
Django[argon2]==2.0.12
celery [redis]==4.1.1
foo [bar] == 3.2.1 # handles extra white space
some-package==0.3.1
some-other-package==1.0.0
not_semver==1.9

View file

@ -33,13 +33,23 @@ export function extractPackageFileFlags(
const additionalRequirementsFiles: string[] = [];
const additionalConstraintsFiles: string[] = [];
content.split(newlineRegex).forEach((line) => {
if (line.startsWith('-i ') || line.startsWith('--index-url ')) {
registryUrls = [line.split(' ')[1]];
} else if (line.startsWith('--extra-index-url ')) {
const extraUrl = line
.substring('--extra-index-url '.length)
.split(' ')[0];
additionalRegistryUrls.push(extraUrl);
if (line.startsWith('-i ') || line.startsWith('--index-url')) {
// parameters can be separated by space or =, same below for --extra-index-url
if (line.includes('=')) {
registryUrls = [line.split('=')[1]];
} else {
registryUrls = [line.split(' ')[1]];
}
} else if (line.startsWith('--extra-index-url')) {
if (line.includes('=')) {
const extraUrl = line.split('=')[1];
additionalRegistryUrls.push(extraUrl);
} else {
const extraUrl = line
.substring('--extra-index-url '.length)
.split(' ')[0];
additionalRegistryUrls.push(extraUrl);
}
} else if (line.startsWith('-r ')) {
additionalRequirementsFiles.push(line.split(' ')[1]);
} else if (line.startsWith('-c ')) {

View file

@ -10,6 +10,7 @@ const requirements5 = Fixtures.get('requirements5.txt');
const requirements6 = Fixtures.get('requirements6.txt');
const requirements7 = Fixtures.get('requirements7.txt');
const requirements8 = Fixtures.get('requirements8.txt');
const requirements9 = Fixtures.get('requirements9.txt');
const requirementsWithEnvMarkers = Fixtures.get('requirements-env-markers.txt');
const requirementsGitPackages = Fixtures.get('requirements-git-packages.txt');
@ -120,6 +121,18 @@ some-package==0.3.1`;
expect(res?.deps).toHaveLength(6);
});
it('handles index urls with = as separator', () => {
const res = extractPackageFile(requirements9);
expect(res).toMatchSnapshot();
expect(res?.registryUrls).toEqual([
'https://artifactory.company.com/artifactory/api/pypi/python/simple',
]);
expect(res?.additionalRegistryUrls).toEqual([
'http://example.com/private-pypi/',
]);
expect(res?.deps).toHaveLength(6);
});
it('handles extra index url and defaults without index to config', () => {
const res = extractPackageFile(requirements6);
expect(res).toMatchSnapshot();