NuKeeperDotNet / NuKeeper-AzureDevops-extension

NuKeeper AzureDevops and VSTS extension
12 stars 15 forks source link

Cannot checkout when using NuKeeper extension on a branch with slash #37

Open thomasmktong opened 5 years ago

thomasmktong commented 5 years ago

When running NuKeeper extension on a branch with slash, e.g. bug/31386-xxx I found that only the last segment of the branch is sent to NuKeeper, i.e. 31386-xxx without bug/

##[debug]Build.SourceBranchName=31386-xxx
##[debug]arguments=--maxpackageupdates 1000 --change minor --consolidate --verbosity detailed --exclude MathNet
:\Program Files\dotnet\dotnet.exe" C:\vsts_agent_integration\_work\_tool\nukeeper\0.21.3\x64\NuKeeper.dll repo C:\vsts_agent_integration\_work\35\s *** --targetBranch origin/31386-xxx --maxpackageupdates 1000 --change minor --consolidate --verbosity detailed
Git checkout 'origin/31386-xxx'
Updates failed NuKeeperException : Git Cannot checkout branch: the branch named 'origin/31386-xxx' doesn't exist
   at NuKeeper.Git.LibGit2SharpDriver.Checkout(String branchName) in /home/vsts/work/r1/a/drop/NuKeeper.Git/LibGit2SharpDriver.cs:line 96
   at NuKeeper.Engine.Packages.PackageUpdater.MakeUpdatePullRequests(IGitDriver git, RepositoryData repository, NuGetSources sources, SettingsContainer settings, IReadOnlyCollection`1 updates) in /home/vsts/work/r1/a/drop/NuKeeper/Engine/Packages/PackageUpdater.cs:line 70
   at NuKeeper.Engine.Packages.PackageUpdater.MakeUpdatePullRequests(IGitDriver git, RepositoryData repository, IReadOnlyCollection`1 updates, NuGetSources sources, SettingsContainer settings) in /home/vsts/work/r1/a/drop/NuKeeper/Engine/Packages/PackageUpdater.cs:line 46
Attempted 134 updates and did 0
Done at 2019-06-01T04:15:58Z

I think somehow the VSTS build variable Build.SourceBranchName was used as that one only has last segment of a branch name, ref: https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml

MaxMommersteeg commented 5 years ago

I think you are right: https://github.com/NuKeeperDotNet/NuKeeper-AzureDevops-extension/blob/master/nukeeper/src/NuKeeper.ts#L18

Could you give me the exact arguments you are using? I can try to replicate and fix the issue later today.

thomasmktong commented 5 years ago

Thanks. I just run the task with these

--maxpackageupdates 1000 --change minor --consolidate --verbosity detailed

image it this what you are looking for?

MaxMommersteeg commented 5 years ago

Yep, thanks. Is bug/31386-xxx the default branch, or do you target that one in the pipeline?

For reference: https://github.com/Microsoft/azure-pipelines-agent/issues/838

MaxMommersteeg commented 5 years ago

I opened up a PR, I think that code change will fix the issue you're experiencing.

thomasmktong commented 5 years ago

thanks very much, it was the branch that i targeted

MaxMommersteeg commented 5 years ago

@thomasmktong Could you try again, new version of extension should be live.