We’ve started publishing our .NET API Client library via NuGet. While each build is published to a private MyGet repository, we wanted to approve the versions that get published to the primary NuGet feed, including a chance to bump up version numbers based on semantic versioning concerns before the world started using a particular build.

There is a Promoted Builds Plugin available for Jenkins that allows action to be taken on a build based on criteria that include “manual approval”, and it turns out this plugin is pretty easy to setup for this need:

  • Set a Jenkins variable for your NuGet API key.  I set it in Jenkins’ global configuration.
  • Make sure NuGet is available to your build process. Perhaps check in the .nuget directory with the EXE. We have a separate repo that contains solely the nuget tool, which we clone before use.
  • Install the Promoted Builds Plugin from Jenkins’ management page.
  • Have your job produce a .nupkg file (With symbols!) and archive it as an artifact.
  • Setup the promotion job.
    • We chose to wait for both manual approval AND the completion of downstream tests.
    • Setup a promoted job step to copy the .nupkg artifacts from the main job. Specify the jenkins variable $PROMOTED_JOB for the build number of the upstream job.
    • In a shell or batch step, call NuGet.exe push $NUPKG $NUGET_API_KEY

Once that’s done, you can touch off the promotion from the job’s “Promotion Status” screen, as well as view the promotion job status and log.

Join the Discussion

    • Xavier Decoster

      Interesting to see you are using a package promotion mechanism on top of CI packages hosted on MyGet. Is there any reason you are not using MyGet’s built-in package promotion (push upstream) feature for this? Anything missing on our end, or any feedback in terms of missing features or requirements? Feel free to contact us or log them on our uservoice.

    93 − = 90