How do we stop TeamCity publishing to the wrong feed?

ismeisme Posts: 119
edited November 29, 2013 8:58AM in Deployment Manager
Hey RG,

We use the Red Gate (SQL Server) build step for TeamCity to publish a package to RGDM.

Our build log shows that the TeamCity tries and fails to publish to a feed hosted on MyGet.
[18:55:02]Publishing database package ApiServices-backend-database version 0.87 to https://www.myget.org/F/f4k3f33dl1nk/ (2s)
[18:55:05]##teamcity[buildStatus status='FAILURE' text='Publishing database package ApiServices-backend-database version 0.87 to https://www.myget.org/F/f4kef33dl1nk/ failed with error InvalidOperationException']
[18:55:05]sqlCI error occurred: System.InvalidOperationException: Failed to process request. 'OK'. 

Some feed details are faked for security, but the output is otherwise unmodified.

We only want to publish to TeamCity's feed, but we can't specify the target feed in the build step.

The settings for RGDM only let you specify where RGDM is, what to call the package, and what your API Key is.

Our settings look like this:
Package ID: ApiServices-backend-database
Server URL: http://redgatedeploy:81
DM API Key: ***************************

RGDM's feed API ( http://redgatedeploy:81/api/feeds ) lists three feeds: MyGet, RDGM, and TeamCity.
[
  {
    "Id": "feeds-129",
    "Name": "MyGet feed",
    "FeedUri": "https://www.myget.org/F/f4kef33dl1nk/",
    "Links": {
      "Self": "/api/feeds/feeds-129",
      "Packages": "/api/feeds/feeds-129/packages"
    },
    "Username": "********",
    "Password": "********"
  },
  {
    "Id": "feeds-default",
    "Name": "Deployment Manager package feed",
    "FeedUri": "http://redgatedeploy:81/nuget/",
    "Links": {
      "Self": "/api/feeds/feeds-default",
      "Packages": "/api/feeds/feeds-default/packages"
    },
    "Username": "",
    "Password": ""
  },
  {
    "Id": "feeds-1",
    "Name": "TeamCity",
    "FeedUri": "http://teamcity:8111/httpAuth/app/nuget/v1/FeedService.svc/",
    "Links": {
      "Self": "/api/feeds/feeds-1",
      "Packages": "/api/feeds/feeds-1/packages"
    },
    "Username": "********",
    "Password": "********"
  }
]

How do we configure our build to publish to just the TeamCity feed?
Iain Elder, Skyscanner

Comments

  • You should be able to do this by getting the TeamCity feed to be the first one listed in the JSON returned by http://redgatedeploy:81/api/feeds

    The feeds are ordered in the order that they are created, and there's no way to re-order them in the UI. You can however do it by going to our internal database and changing the order.

    Having remote desktoped into the Deployment Manager server, visit http://localhost:10300/raven/studio.htm ... Csystem%3E

    Then adjust the SortOrder to be -1, and click Save.

    Now if you view the JSON of the list of feeds the TeamCity feed should be at the top.

    And that means the TeamCity plugin should push to it. It will probably display a message along the lines of "Skipping package push for repository". Just ignore that message; it should still work even though that message is shown.

    Let me/us know how you get on.
  • It worked. Thanks, David!

    Here are the steps I took to resolve the issue.

    Move the TeamCity feed to the top of the feed list

    Use Remote Desktop Connection to connect to redgatedeploy.

    Open this link in Internet Explorer:
    http://localhost:10300/raven/studio.htm ... Csystem%3E

    Click the Silverlight logo to install Silverlight. Refresh the page after installation.

    Change the sort order of the document to -1 and click save.

    The RavenDB interface should look like this.

    lZVZggd.png

    Check that it worked

    Go back to your workstation desktop.

    Open RGDM package feed API:
    http://redgatedeploy:81/api/feeds

    You should see the TeamCity feed at the top.
    [
      {
        "Id": "feeds-1",
        "Name": "TeamCity",
        "FeedUri": "http://teamcity:8111/httpAuth/app/nuget/v1/FeedService.svc/",
        "Links": {
          "Self": "/api/feeds/feeds-1",
          "Packages": "/api/feeds/feeds-1/packages"
        },
        "Username": "********",
        "Password": "********"
      },
      {
        "Id": "feeds-129",
        "Name": "MyGet feed",
        "FeedUri": "https://www.myget.org/F/f4kef33dl1nk/",
        "Links": {
          "Self": "/api/feeds/feeds-129",
          "Packages": "/api/feeds/feeds-129/packages"
        },
        "Username": "********",
        "Password": "********"
      },
      {
        "Id": "feeds-default",
        "Name": "Deployment Manager package feed",
        "FeedUri": "http://redgatedeploy:81/nuget/",
        "Links": {
          "Self": "/api/feeds/feeds-default",
          "Packages": "/api/feeds/feeds-default/packages"
        },
        "Username": "",
        "Password": ""
      }
    ]
    

    Run the TeamCity build again.

    sqlCI should no longer raise an error.

    You might see a message like this in the build log:
    [13:29:21]Skipping package push for repository http://teamcity:8111/httpAuth/app/nuget/v1/FeedService.svc/.
    [13:29:21]This respository is a TeamCity NuGet server which doesn't support pushing packages.
    [13:29:21]To publish the package to a TeamCity feed, run sqlCI as a TeamCity build step. This will publish the package as an artifact and add it to the TeamCity feed.
    

    It's safe to ignore. If the build was successful, the build will be published to the TeamCity package feed.
    Iain Elder, Skyscanner
Sign In or Register to comment.