Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
renovate
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
GitHub Mirror
Renovate Bot
renovate
Commits
a9af34cf
Unverified
Commit
a9af34cf
authored
1 year ago
by
bjuraga
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix(manager/nuget): don't bump version if already done (#23546)
parent
d4679f75
Branches
Branches containing commit
Tags
36.24.4
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/modules/manager/nuget/update.spec.ts
+19
-0
19 additions, 0 deletions
lib/modules/manager/nuget/update.spec.ts
lib/modules/manager/nuget/update.ts
+10
-7
10 additions, 7 deletions
lib/modules/manager/nuget/update.ts
with
29 additions
and
7 deletions
lib/modules/manager/nuget/update.spec.ts
+
19
−
0
View file @
a9af34cf
...
@@ -7,6 +7,10 @@ const minimumContent =
...
@@ -7,6 +7,10 @@ const minimumContent =
'
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><Version>1</Version></PropertyGroup></Project>
'
;
'
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><Version>1</Version></PropertyGroup></Project>
'
;
const
prereleaseContent
=
const
prereleaseContent
=
'
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><Version>1.0.0-1</Version></PropertyGroup></Project>
'
;
'
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><Version>1.0.0-1</Version></PropertyGroup></Project>
'
;
const
issue23526InitialContent
=
'
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><Version>4.9.0</Version></PropertyGroup></Project>
'
;
const
issue23526ExpectedContent
=
'
<Project Sdk="Microsoft.NET.Sdk"><PropertyGroup><Version>4.10.0</Version></PropertyGroup></Project>
'
;
describe
(
'
modules/manager/nuget/update
'
,
()
=>
{
describe
(
'
modules/manager/nuget/update
'
,
()
=>
{
describe
(
'
bumpPackageVersion
'
,
()
=>
{
describe
(
'
bumpPackageVersion
'
,
()
=>
{
...
@@ -36,6 +40,21 @@ describe('modules/manager/nuget/update', () => {
...
@@ -36,6 +40,21 @@ describe('modules/manager/nuget/update', () => {
expect
(
bumpedContent
).
toEqual
(
bumpedContent2
);
expect
(
bumpedContent
).
toEqual
(
bumpedContent2
);
});
});
it
(
'
issue 23526 does not bump version incorrectly
'
,
()
=>
{
const
{
bumpedContent
}
=
bumpPackageVersion
(
issue23526InitialContent
,
'
4.9.0
'
,
'
minor
'
);
const
{
bumpedContent
:
bumpedContent2
}
=
bumpPackageVersion
(
bumpedContent
!
,
'
4.9.0
'
,
'
minor
'
);
expect
(
bumpedContent2
).
toEqual
(
issue23526ExpectedContent
);
});
it
(
'
does not bump version if version is not a semantic version
'
,
()
=>
{
it
(
'
does not bump version if version is not a semantic version
'
,
()
=>
{
const
{
bumpedContent
}
=
bumpPackageVersion
(
const
{
bumpedContent
}
=
bumpPackageVersion
(
minimumContent
,
minimumContent
,
...
...
This diff is collapsed.
Click to expand it.
lib/modules/manager/nuget/update.ts
+
10
−
7
View file @
a9af34cf
...
@@ -31,14 +31,23 @@ export function bumpPackageVersion(
...
@@ -31,14 +31,23 @@ export function bumpPackageVersion(
try
{
try
{
const
project
=
new
XmlDocument
(
content
);
const
project
=
new
XmlDocument
(
content
);
const
versionNode
=
project
.
descendantWithPath
(
'
PropertyGroup.Version
'
)
!
;
const
versionNode
=
project
.
descendantWithPath
(
'
PropertyGroup.Version
'
)
!
;
const
currentProjVersion
=
versionNode
.
val
;
const
startTagPosition
=
versionNode
.
startTagPosition
;
const
startTagPosition
=
versionNode
.
startTagPosition
;
const
versionPosition
=
content
.
indexOf
(
versionNode
.
val
,
startTagPosition
);
const
versionPosition
=
content
.
indexOf
(
currentProjVersion
,
startTagPosition
);
const
newProjVersion
=
semver
.
inc
(
currentValue
,
bumpVersion
as
ReleaseType
);
const
newProjVersion
=
semver
.
inc
(
currentValue
,
bumpVersion
as
ReleaseType
);
if
(
!
newProjVersion
)
{
if
(
!
newProjVersion
)
{
throw
new
Error
(
'
semver inc failed
'
);
throw
new
Error
(
'
semver inc failed
'
);
}
}
if
(
currentProjVersion
===
newProjVersion
)
{
logger
.
debug
(
'
Version was already bumped
'
);
return
{
bumpedContent
};
}
logger
.
debug
(
`newProjVersion:
${
newProjVersion
}
`
);
logger
.
debug
(
`newProjVersion:
${
newProjVersion
}
`
);
bumpedContent
=
replaceAt
(
bumpedContent
=
replaceAt
(
content
,
content
,
...
@@ -46,12 +55,6 @@ export function bumpPackageVersion(
...
@@ -46,12 +55,6 @@ export function bumpPackageVersion(
currentValue
,
currentValue
,
newProjVersion
newProjVersion
);
);
if
(
bumpedContent
===
content
)
{
logger
.
debug
(
'
Version was already bumped
'
);
}
else
{
logger
.
debug
(
'
project version bumped
'
);
}
}
catch
(
err
)
{
}
catch
(
err
)
{
logger
.
warn
(
logger
.
warn
(
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment