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

fix(manager/nuget): Add autoReplaceStringTemplate #26508

Merged
merged 12 commits into from
Jan 5, 2024
8 changes: 8 additions & 0 deletions lib/modules/manager/nuget/extract.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,14 @@ describe('modules/manager/nuget/extract', () => {
expect(await extractPackageFile(contents, contents, config)).toEqual({
deps: [
{
autoReplaceStringTemplate:
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
currentDigest: undefined,
depName: 'mcr.microsoft.com/dotnet/runtime',
depType: 'docker',
datasource: 'docker',
currentValue: '7.0.10',
replaceString: 'mcr.microsoft.com/dotnet/runtime:7.0.10',
},
],
packageFileVersion: '0.1.0',
Expand All @@ -102,12 +106,16 @@ describe('modules/manager/nuget/extract', () => {
expect(await extractPackageFile(contents, contents, config)).toEqual({
deps: [
{
autoReplaceStringTemplate:
'{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}',
depName: 'mcr.microsoft.com/dotnet/runtime',
depType: 'docker',
datasource: 'docker',
currentValue: '7.0.10',
currentDigest:
'sha256:181067029e094856691ee1ce3782ea3bd3fda01bb5b6d19411d0f673cab1ab19',
replaceString:
'mcr.microsoft.com/dotnet/runtime:7.0.10@sha256:181067029e094856691ee1ce3782ea3bd3fda01bb5b6d19411d0f673cab1ab19',
},
],
packageFileVersion: '0.1.0',
Expand Down
9 changes: 1 addition & 8 deletions lib/modules/manager/nuget/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import { getSiblingFileName, localPathExists } from '../../../util/fs';
import { hasKey } from '../../../util/object';
import { regEx } from '../../../util/regex';
import { DockerDatasource } from '../../datasource/docker';
import { NugetDatasource } from '../../datasource/nuget';
import { getDep } from '../dockerfile/extract';
import type {
Expand Down Expand Up @@ -52,13 +51,7 @@
const dep = getDep(child.val, true);

if (is.nonEmptyStringAndNotWhitespace(dep.depName)) {
results.push({
datasource: DockerDatasource.id,
depType: 'docker',
depName: dep.depName,
currentValue: dep.currentValue,
currentDigest: dep.currentDigest,
});
results.push({ ...dep, depType: 'docker' });

Check failure on line 54 in lib/modules/manager/nuget/extract.ts

View workflow job for this annotation

GitHub Actions / lint-other

Argument of type '{ depType: string; currentValue?: string | null | undefined; currentDigest?: string | undefined; depName?: string | undefined; fileReplacePosition?: number | undefined; groupName?: string | undefined; ... 40 more ...; managerData?: Record<...> | undefined; }' is not assignable to parameter of type 'NugetPackageDependency'.

Check failure on line 54 in lib/modules/manager/nuget/extract.ts

View workflow job for this annotation

GitHub Actions / build

Argument of type '{ depType: string; currentValue?: string | null | undefined; currentDigest?: string | undefined; depName?: string | undefined; fileReplacePosition?: number | undefined; groupName?: string | undefined; ... 40 more ...; managerData?: Record<...> | undefined; }' is not assignable to parameter of type 'NugetPackageDependency'.
}
}

Expand Down
Loading