How to remove a specific version of a package on a TeamCity Nuget feed?

Does anyone know to uninstall a specific version of a package on Feed Team Nortel TeamCity?

+53
nuget teamcity nuget-package nuget-server
Apr 18 '12 at 21:29
source share
9 answers

This is now supported through the web user interface.

Just remove the offensive build by opening the build and choosing Actions > Remove . This removes the assembly from the list in TeamCity, and also removes all assembly artifacts from that particular assembly from the Nuget feed .

+40
Oct 09 '15 at 10:38
source share

I know this was asked a long time ago, but I run into this problem all the time every time and again, and I always forget how to do it, so I decided that I would post my solution, which, I think, might be a little easier ( depending on how you look at it).

Basically, I launched the TeamCity build, which, unfortunately, created a duff version of a third-party package that I tried to recreate, but with a few modifications. This did not work, but it meant that I was always provided with this duff package in the package manager, and it will remain so until a third party releases a newer version. So I wanted to remove the package from the TeamCity Nuget server, and the only way I could find it was to remove the assembly, which would also remove the artifacts (Duff Nuget package in this case).

Now I could not see a way to remove the assembly, except using the REST API, so I used it (I hope I'm not stupid, and in fact this is an easy way to remove assemblies from the user interface). I used fiddler to create a DELETE command. This was achieved simply by sending a delete request, similar to the one shown below:

From fiddler, go to the Composer window. Select "DELETE" instead of "GET" and enter the TeamCity URL in the form below:

 http://<server>:<port>/httpAuth/app/rest/builds/<build ID> 

You can find the build ID simply by checking the URL when choosing the build you want to remove from TeamCity (look for the number after the "buildId" query parameter). The only other step was to add an authorization header to the command. Type the following in the line below "User-Agent" in the request header window.

 Authorization: Basic (Username:Password encoded as base64) 

To encode your username / password as base64, go to Tools-> Text Wizard as a violinist and enter TeamCity data in this format - Username: Password. Finally, you must select the “Run” button, and everything will be fine, the assembly will be removed along with the Nuget package.

This worked for me, but obviously be careful when doing all this, since you don't want to remove the wrong assembly. It may be prudent to back up / snapshot the TeamCity server.

Hope this helps someone.

+33
Aug 13 2018-12-12T00:
source share

First, it seems that uninstalling NuGet ad-hoc packages is not supported directly in TeamCity. There is an open issue with JetBrains, but there is currently no fix. However, we developed a workaround that made us go through our specific problem and could help you.

We had a series of nupkg files that used the incorrect (accelerated) version. Thus, they turned out to be “newer” than the packages that we are currently creating. Without a way to remove only incorrect versions, we install each individual TeamCity “Clear artifacts” configuration in a short window (2 days) and start cleaning. To do this, you will need system administrator rights.

This removed any artifacts one day older than the last artifact and cleared all our bad packages. We tested this with the NuGet List command line command. Since more recent packages are true, we now only advertise good packages on our NuGet channel.

Admittedly, this is an "accurate nuclear weapon" option and may not work for everyone. I hope TeamCity fully supports the NuGet command-line API in the near future.

+16
May 14 '12 at 19:57
source share

The third time I find this post, because I have a similar problem. It turns out that the ticket with jetbrains was closed for a long time - and TeamCity now (at least our version 9.1) directly supports this, opening the details for a specific assembly, click the "Actions" drop-down menu and select "Delete ...". This will remove the build from TeamCity, as well as artifacts from the nuget package repository - thus completely eliminating the need to call REST api in slightly confusing ways.

Having laid it out, I could even remember it myself, the next time I need to do this.

+8
Aug 13 '15 at 9:28
source share

I created a powershell script to do this according to King Rogers answer.

Save this script as tc_deletebuild.ps1 ...

 param($build, $teamcityhost, $username, $password) $encodedcredentials = [System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($username+":"+$password)) Invoke-WebRequest -Uri "http://$teamcityhost/httpAuth/app/rest/builds/id:$build" -Method Delete -Headers @{"Authorization"="Basic $encodedcredentials"} 

... and execute from powershell with

 .\tc_deletebuild.ps1 <buildid> <host> <username> <password> 
+4
Sep 24 '14 at 7:16
source share

Extending King Roger's response ... expanding the client chrome of the REST client is an easy way to achieve this with a little tooling.

 > HTTP GET to http://servername:port/httpAuth/app/rest/builds/ 

The result will look like

 <builds count="100" nextHref="/httpAuth/app/rest/builds?count=100&amp;start=100"> <build id="48459" number="1.0.187-nightly" ... etc 

Find the output of your build ID, in the same tag as the build number you see in teamcity, then

 > HTTP DELETE to http://servername:port/httpAuth/app/rest/builds/*theid* 

I don’t need authorization tags or any other headers, perhaps when I was registered with teamcity in another window or we configured teamcity to be open inside, but you may need to insert them in the URL and headers.

+2
Jan 12 '15 at 2:41
source share

As already mentioned, the proposed JetBrains solution is to remove the assembly that created the artifact, that is, the NuGet package — which you want to remove.

With curl 7.3x (found on ubuntu and Git for Windows / msysgit), the following command removes build number 42:

 curl -v -u <username>:<password> -X DELETE http://teamcity:8111/httpAuth/app/rest/builds/42 
  • Note the use of short options ( -X instead of -request , -u instead of -user ); long options didn't work for me.
  • Omit :<password> if you want to receive a password request.
  • An HTTP/1.1 204 No Content response indicates success.

Full documentation: http://confluence.jetbrains.com/display/TCD8/REST+API#RESTAPI-Generalinformation

+1
Nov 28 '14 at 22:11
source share

In continuation of King Roger's answer, I used a slightly different way to compose a request in Fiddler. I made a Get request to a specific Teamcity assembly and grabbed the http headers from the Chrome developer tool. Copied and pasted into the Fiddler request header field. Thus, I did not need to encode the username and password.

0
May 15 '14 at 10:44
source share

The TeamCity channel built into NuCet uses the TeamCity artifact storage as the storage of NuGet packages, so manually deleting an artifact from the artifact storage should also remove it from the channel. The default location for storing artifacts is / system / artifacts. Source: https://youtrack.jetbrains.com/issue/TW-19959

0
Jan 28 '19 at 8:54
source share



All Articles