Description
During the publish stage, the publishImageInfo
command is invoked to update the image info file in the versions repo. This command clones the repo, makes the file changes, and pushes back to the repo. The push can end up failing if another pipeline has already made a change to the repo between it time it took for the original pipeline to clone and push. It gets this error:
Unhandled exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> LibGit2Sharp.NonFastForwardException: cannot push because a reference that you are trying to update on the remote contains commits that are not present locally.
at LibGit2Sharp.Core.Ensure.HandleError(Int32 result)
at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result)
at LibGit2Sharp.Core.Proxy.git_remote_push(RemoteHandle remote, IEnumerable`1 refSpecs, GitPushOptions opts)
at LibGit2Sharp.Network.Push(Remote remote, IEnumerable`1 pushRefSpecs, PushOptions pushOptions)
at LibGit2Sharp.Network.Push(Remote remote, String pushRefSpec, PushOptions pushOptions)
at LibGit2Sharp.Network.Push(IEnumerable`1 branches, PushOptions pushOptions)
at LibGit2Sharp.Network.Push(Branch branch, PushOptions pushOptions)
at Microsoft.DotNet.ImageBuilder.Commands.PublishImageInfoCommand.UpdateGitRepos(String imageInfoContent, String repoPath, IRepository repo) in /image-builder/src/Commands/PublishImageInfoCommand.cs:line 110
at Microsoft.DotNet.ImageBuilder.Commands.PublishImageInfoCommand.ExecuteAsync() in /image-builder/src/Commands/PublishImageInfoCommand.cs:line 76
at Microsoft.DotNet.ImageBuilder.Commands.Command`2.<GetCliCommand>b__9_0(TOptions options) in /image-builder/src/Commands/Command.TOptions.cs:line 46
This has been showing up in the https://github.com/dotnet/dotnet-buildtools-prereqs-docker repo because there are multiple pipelines which all end up writing to the same image info file. So they can conflict with each other if the publish stages are running at the same time amongst them.
Manually retrying the build can resolve the problem. But the command should be updated so that it attempts to retry automatically.
Metadata
Metadata
Assignees
Type
Projects
Status