NuKeeper
NuKeeper copied to clipboard
NuKeeper reports success even if Git operation fails
🐛 Bug Report
If NuKeeper cannot perform a git operation and fails, it still reports success via errorlevel = 0. This will impact any automation system that leverages NuKeeper (in my case, Azure DevOps)
Expected behavior
If NuKeeper fails it reports as a failure so automation (such as DevOps) can correctly notify that a failure occurred.
Reproduction steps
Configure project with NuKeeper in any environment that doesn't provide it access to push. Simply denying branch creation rights should be sufficient, or putting into an ADO pipeline without token access.
Updates failed LibGit2SharpException : request failed with status code: 403
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Proxy.git_remote_push(RemoteHandle remote, IEnumerable1 refSpecs, GitPushOptions opts) at LibGit2Sharp.Network.Push(Remote remote, IEnumerable
1 pushRefSpecs, PushOptions pushOptions)
at LibGit2Sharp.Network.Push(IEnumerable1 branches, PushOptions pushOptions) at NuKeeper.Git.LibGit2SharpDriver.<>c__DisplayClass17_0.<Push>b__0() in d:\a\r1\a\drop\NuKeeper.Git\LibGit2SharpDriver.cs:line 189 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location where exception was thrown --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of stack trace from previous location where exception was thrown --- at NuKeeper.Engine.Packages.PackageUpdater.MakeUpdatePullRequests(IGitDriver git, RepositoryData repository, NuGetSources sources, SettingsContainer settings, IReadOnlyCollection
1 updates) in d:\a\r1\a\drop\NuKeeper\Engine\Packages\PackageUpdater.cs:line 85
at NuKeeper.Engine.Packages.PackageUpdater.MakeUpdatePullRequests(IGitDriver git, RepositoryData repository, IReadOnlyCollection`1 updates, NuGetSources sources, SettingsContainer settings) in d:\a\r1\a\drop\NuKeeper\Engine\Packages\PackageUpdater.cs:line 46
Configuration
nukeeper 0.26.0 x64
Platform if applicable:
- [ ] :hammer_and_wrench: NuKeeper CLI
- [ ] :sparkles: GitHub
- [X] :robot: AzureDevops
- [ ] :checkered_flag: Bitbucket
- [ ] :earth_americas: Gitlab
- [ ] :tv: Gitea
- [ ] :whale: Docker
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Should still look into this?
It will also report success if NuGet.exe throws an exit code other than 0
which is not desirable behaviour as running nukeeper on a CI agent will report a success, even though packages have not been updated properly because of an error.
Definitely should report a proper exit code if any part of the process fails. @AnthonySteele
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Has any changes been made for this so far? If not it's still relevant.
I am experiencing the same behavior when package cannot be updated for some reason Example
Updating 'Microsoft.Extensions.Configuration.Abstractions' to 3.1.8 in 8 projects
...
/tmp/NuKeeper/repo-c59bd8d6b834403694776ed8bef12eac/source/MySampleProject/MySampleProject.csproj : error NU1605: Detected package downgrade: Microsoft.Extensions.Configuration.Abstractions from 3.1.8 to 3.1.6. Reference the package directly from the project to select a different version.
...
Command dotnet failed with exit code: 1
But nukeeper exits with code 0:
$ echo $?
0
This is really important in CI scenarios, where exit code indicates whether process succeeded or failed.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Still relevant AFAIK
Still very relevant. Last week this hides several errors which I recognized yesterday.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
In my CI, I run NuKeeper from a PowerShell task and parse the results. If no packages were updated, I throw an error. Maybe this can help you. Now I need to find out why NuKeeper doesn't always find the newest package from my feed even though it is in there.
- powershell: |
git config --global user.name "Matt Edwards"
git config --global user.email "[email protected]"
$test = nukeeper update $(build.sourcesDirectory) --age 0 -v d
$match = $test -Match "Found no package updates"
echo $test
if ( $match ) { Write-Error "Error - Found no package updates" } else { Write-Output "Success - Updated project packages" }
failOnStderr: true
displayName: 'NuKeeper'
This is also an issue for me.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Still relevant