Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registry push failed; received status code 'PreconditionFailed' #582

Open
Varorbc opened this issue Jul 15, 2024 · 4 comments
Open

Registry push failed; received status code 'PreconditionFailed' #582

Varorbc opened this issue Jul 15, 2024 · 4 comments
Labels
Area: Errors Area: Registries Tasks/Issues around communicating with asset registries

Comments

@Varorbc
Copy link

Varorbc commented Jul 15, 2024

When I push multiple images, I receive a PreconditionFailed error. Can you add--skip-duplicateoption like nuget to treat the error as a warning so that other image packages can push successfully

@baronfel
Copy link
Member

baronfel commented Oct 9, 2024

@Varorbc if you can reproduce this, could you add more error logging and/or a binlog so we can get a sense of how the pushes are failing specifically?

@baronfel baronfel added Area: Registries Tasks/Issues around communicating with asset registries Area: Errors labels Oct 9, 2024
@Varorbc
Copy link
Author

Varorbc commented Oct 9, 2024

@baronfel

/dotnet/sdk/8.0.300/Containers/build/Microsoft.NET.Build.Containers.targets(242,5): error : Containerize: error CONTAINER004: CONTAINER1005: Registry push failed; received status code 'PreconditionFailed'. 
/dotnet/sdk/8.0.300/Containers/build/Microsoft.NET.Build.Containers.targets(242,5): error : URI: https://***/manifests/*** 
/dotnet/sdk/8.0.300/Containers/build/Microsoft.NET.Build.Containers.targets(242,5): error :    at Microsoft.NET.Build.Containers.DefaultManifestOperations.PutAsync(String repositoryName, String reference, ManifestV2 manifest, CancellationToken cancellationToken) in /_/src/Containers/Microsoft.NET.Build.Containers/Registry/DefaultManifestOperations.cs:line 52 
/dotnet/sdk/8.0.300/Containers/build/Microsoft.NET.Build.Containers.targets(242,5): error :    at Microsoft.NET.Build.Containers.Registry.PushAsync(BuiltImage builtImage, SourceImageReference source, DestinationImageReference destination, Boolean pushTags, CancellationToken cancellationToken) in /_/src/Containers/Microsoft.NET.Build.Containers/Registry/Registry.cs:line 491 
/dotnet/sdk/8.0.300/Containers/build/Microsoft.NET.Build.Containers.targets(242,5): error :    at Microsoft.NET.Build.Containers.Tasks.CreateNewImage.PushToRemoteRegistryAsync(BuiltImage builtImage, SourceImageReference sourceImageReference, DestinationImageReference destinationImageReference, CancellationToken cancellationToken) in /_/src/Containers/Microsoft.NET.Build.Containers/Tasks/CreateNewImage.cs:line 227 

@baronfel
Copy link
Member

baronfel commented Oct 9, 2024

Sorry, another question - when you are pushing multiple images, are you pushing

  • multiple applications that have the same base images
  • same application, different TFMs
  • some mix-and-match of the above?

My suspicion is that because the publish is done on a per-project basis there's the possibility that multiple projects have shared layers and pushing the same layer to the registry simultaneously is what's causing the failure.

If that's the case, then for multi-project publishes (i.e. at solution level or Traversal props level) we'd need a more sophisticated system than we have today. We'd have to create all of the specific layers and report them back to some central process that could deduplicate and push each layer at most once.

@Varorbc
Copy link
Author

Varorbc commented Oct 9, 2024

I'm pushing a bunch of app images that all have the same base image to the registry. Sometimes, things don't go perfectly smooth, and I end up only getting some of them pushed successfully while others fail. Now, when I try again, I get an error saying it failed because I've set up rules in Harbor to stop duplicate pushes. That's why I'm thinking it'd be sweet if we could add an option like --skip-duplicate that they use with NuGet pushes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Errors Area: Registries Tasks/Issues around communicating with asset registries
Projects
None yet
Development

No branches or pull requests

2 participants