Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Azure DevOps running "org" command fails to create the PR, throws NullReferenceException #1110

Open
1 of 7 tasks
spr0ut opened this issue May 17, 2021 · 5 comments
Open
1 of 7 tasks

Comments

@spr0ut
Copy link

spr0ut commented May 17, 2021

🐛 Bug Report

When running nukeeper with the "org" command in Azure DevOps (hosted agent), the branch(es) are created and pushed, but NuKeeper fails to create the PR and throws a NullReferenceException.

Git commit with message '📦 Automatic update of CsvHelper to 27.0.2'
Git push to nukeeper_push/nukeeper-update-CsvHelper-to-27.0.2
GetGitRepositories: Requesting version-test/_apis/git/repositories?api-version=4.1
GetPullRequests: Requesting version-test/_apis/git/repositories/1eb94f14-1adb-45e0-ada9-1ac873db1df3/pullrequests?searchCriteria.sourceRefName=refs%2fheads%2fnukeeper-update-CsvHelper-to-27.0.2&searchCriteria.targetRefName=refs%2fheads%2fmain&api-version=4.1
Updates failed NullReferenceException : Object reference not set to an instance of an object.
   at NuKeeper.Engine.Packages.PackageUpdater.MakeUpdatePullRequests(IGitDriver git, RepositoryData repository, NuGetSources sources, SettingsContainer settings, IReadOnlyCollection`1 updates) in D:\a\r1\a\_NuKeeper PR Build\drop\NuKeeper\Engine\Packages\PackageUpdater.cs:line 140
   at NuKeeper.Engine.Packages.PackageUpdater.MakeUpdatePullRequests(IGitDriver git, RepositoryData repository, IReadOnlyCollection`1 updates, NuGetSources sources, SettingsContainer settings) in D:\a\r1\a\_NuKeeper PR Build\drop\NuKeeper\Engine\Packages\PackageUpdater.cs:line 65
Attempted 3 updates and did 0

Expected behavior

PR's are created.

Reproduction steps

Create sample repo(s) with minimal cs proj file as contents.
Create YAML pipeline - run nukeeper install and org with PAT token

steps:
- script: dotnet tool install nukeeper --global
- script: |
    git config --global user.email [email protected]
    git config --global user.name NuKeeper
- script: nukeeper org version-test $(PAT) --api https://dev.azure.com/ORG_NAME -v D

Observe errror.

Configuration

Version: 0.34.0

Platform if applicable:

  • 🛠️ NuKeeper CLI
  • ✨ GitHub
  • 🤖 AzureDevops
  • 🏁 Bitbucket
  • 🌎 Gitlab
  • 📺 Gitea
  • 🐳 Docker
@stale
Copy link

stale bot commented Aug 15, 2021

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.

@stale stale bot added the wontfix label Aug 15, 2021
@spr0ut
Copy link
Author

spr0ut commented Aug 26, 2021

bump

@stale stale bot removed the wontfix label Aug 26, 2021
@adlanelm
Copy link

This fails due to settings.SourceControlServerSettings.Repository value being null.
Looks like the value will be set only when executing a command that operates on a single repo.

Depending on where the authors want to go with the design of this I see a couple of alternatives how this can be solved.

  1. Run settings.SourceControlServerSettings.Repository = repository while iterating through discovered repos either in CollaborationEngine.Run() or GitRepositoryEngine.Run()
  2. Remove Repository from SourceControlServerSettings and instead always pass around RepositorySettings separately.

What suits future plans best?
Any other ideas?

@CumpsD
Copy link

CumpsD commented Nov 5, 2021

Same with Github it seems.

Checking if PR exists onto 'https://api.github.com/ xxx/xxx: main <= nukeeper-update-14-packages-DC1C0BF46CE1C6EC900BE0E1A13D0037
Failed on repo xxx NullReferenceException : Object reference not set to an instance of an object.

@raunaknarooka
Copy link

raunaknarooka commented Nov 20, 2021

I have the same issue while running nukeeper org in github actions.

Failed on repo xx NullReferenceException : Object reference not set to an instance of an object.
   at NuKeeper.Engine.Packages.PackageUpdater.MakeUpdatePullRequests(IGitDriver git, RepositoryData repository, NuGetSources sources, SettingsContainer settings, IReadOnlyCollection`1 updates) in D:\a\r1\a\_NuKeeper PR Build\drop\NuKeeper\Engine\Packages\PackageUpdater.cs:line 157

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants