Azure DevOps : not possible to publish again a deleted artifact - azure-devops

I have a deleted artifact in a feed (and no more visible in the recycle bin, because permently deleted) :
And I can't republish the same artifact, because It seems still present in the feed :
I tried also to create a new feed :
And I tried to publish the same artifact in the new feed, but I have the following error message :
Could you tell me how can I republish the artifact please?
Regards,
Yannick

Azure DevOps : not possible to publish again a deleted artifact
This is the default behavior.
I understand how frustrating this is for you. But this is what Azure Artifacts deliberately designed to ensure the correctness of the build results.
Check the document: Understand immutability of packages.
Once you publish a particular version of a package to a feed, that
version number is permanently reserved. You cannot upload a newer
revision package with that same version number, or delete it and
upload a new package at the same version.
You could check my previous thread for the reason for this design.
To resolve this issue, you could try to publish the artifact with another version. If you do not want to change the version, you need to upload this artifact to another feed, and add this feed as package source.

Related

Is there a way to skip checking if package exists when publishing artifact to feed?

I have an azure pipeline that at the end creates azure artifacts out of my deliverables.
I then publish them to azure feeds so other pipelines can use them.
I have been facing error An unexpected error occurred while trying to push the package. Exit code(17).
Looking at the log I can see it claims The package myPackage 1.0122.0 already exists in myUuidString.
Is there a way to bypass the check whether the package exists or not ? In other words, is not there a way to overwrite a package in case it exists?
Is there a way to clear/delete the contents of a feed before publishing?
Could not find neither answer in the docs.
Is there a way to skip checking if package exists when publishing artifact to feed?
For the Universal Package task, I am farid there is no such way to skip checking if package exists when publishing artifact to feed at this moment.
Unlike the nuget push task, there is currently no such option for the Universal Package task to allow duplicates to be skipped:
Besides, since the document: Understand immutability of packages:
Once you publish a particular version of a package to a feed, that
version number is permanently reserved. You cannot upload a newer
revision package with that same version number, or delete it and
upload a new package at the same version.
So, we could not updalod the same version to the feed.
As workaround, we could publish the package with a new version. And we could add a user voice for the same option Allow duplicates to be skipped on the Github.

Nuget package is not listed on ADO Artifacts, but I can't upload because it already exists?

I have a newly created Feed in Azure DevOps where I'm hosting my Nuget packages. I uploaded a bunch, but when I tried to download My.Package.1.0.4 it isn't listed in the feed; neither in VS nor on the web portal. My.Package.1.0.5-beta-2 is there, but even in the version list 1.0.4 is not shown.
I figured it just didn't get uploaded - so tried again; when I do, I get the error Response status code does not indicate success: 409 (Conflict - The feed already contains 'My.Package 1.0.4'.
My question is: where is it hiding? It doesn't show up in the feed anywhere, but it apparently uploaded successfully. What do I do now?
It could happen when package was deleted:
When you publish a particular version of a package to a feed, that version number is permanently reserved. You cannot upload a newer revision package with that same version number, or delete it and upload a new package at the same version.
You can check it here:

Unable to replace package in azure Artifact

I have uploaded a package(com.test:project0.1) in azure devops Artifact, however when I am making changes in code, the pipeline is getting successful but unable to replace the old package.
Can anyone please assist me.
If you used another nuget package to replace the old one, also, you have set the same version as the old before, then you should remove the old nuget caches first to remove the old one.
You should check the option Disable Local Cache option.
Then, re-run to check that.
Also, if you push a version number for the nuget package, you should modify the nugrt version under csproj file to the new one.

Previous versions of an artifact in Azure Artifact

I am new to Azure Devops. I want to use Azure artifact to publish my build artifacts there so that we can use them as a Maven dependency. The issue I am facing is when I deploy a newer version of my artifact, it overrides the previous version. This can lead to issues for the user of my artifacts.
Is there any specific settings using which I can change this behaviour?
According to your description you are using the Azure Artifact feed, right?
If it is, then the old version of packages will not be overwritten by the new versions. By default we can see the latest version of packages in the feed home page. However we can click the specific package, then switch to the Versions tab to check the old versions of that package.
Then you can reference the specific version of the packages in your project.

How to update a maven dependency with a same version number in Azure Artifacts

We changed our maven private repository Nexus to Azure Artifacts.
And when we upload a private maven dependency with a some version, it told us below info:
[ERROR] Failed to execute goal
org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy
(default-deploy) on project HmapBasic: Failed to deploy artifacts:
Could not transfer artifact com.hand:HmapBasic:pom:3.0.3-RELEASE
from/to dev-azure-com-kohlerdevops-konnect-unified
(https://pkgs.dev.azure.com/KohlerDevOps/_packaging/Konnect-Unified/maven/v1/):
Failed to transfer file:
https://pkgs.dev.azure.com/KohlerDevOps/_packaging/Konnect-Unified/maven/v1/com/hand/HmapBasic/3.0.3-RELEASE/HmapBasic-3.0.3-RELEASE.pom.
Return code is: 409
I searched the code 409 error. It means we have already uploaded the dependency with this version and we can't upload this again.
We want to use the new dependency cover the old one without changing version(because if we change the version, all of our projects need to change pom.xml)
how can we do that in Azure Artifacts?
How to update a maven dependency with a same version number in Azure Artifacts
I am afraid you have to change the pom.xml, I understand how frustrating this is for you. But this is what Azure Artifacts deliberately designed to ensure the correctness of the build results.
Check the document: Understand immutability of packages.
Once you publish a particular version of a package to a feed, that
version number is permanently reserved. You cannot upload a newer
revision package with that same version number, or delete it and
upload a new package at the same version.
The reason for this design:
That because many package clients, including NuGet, keep a local cache
of packages on your machine. Once a client has cached a particular
package#version, it will return that copy on future install/restore
requests. If, on the server, you replace package#version (rev 1) with
a new package#version (rev 2), the client is unable to tell the
difference. the client still use the old version in cache. This can lead to indeterminate build results from
different machines.
So we could not overwrite all packages that have already been
uploaded, even we could not delete them and re-uploaded. To resolve
this issue, the only way is that upload the packages with a new
version.
Check my another thread for some more info.
Hope this helps.
I just made a test on Azure DevOps and if you use the "SNAPSHOT" suffix it will overwrite the previous package/artifact. For instance 2.0.0-SNAPSHOT.