Computing, Programming

NuKeeper YAML Example

Having rolled out the use of NuKeeper across multiple repos in Azure DevOps I thought I would share an example YAML build definition to save others similar headaches to what I have had, also a few handy tips on what I learned the hard way.

The main issue I had was ensuring the credentials were correctly passed through, you need to set the environment variable ‘NuKeeper_azure_devops_token‘ with the value $(System.AccessToken).

Another issue I had was that I had set the checkout to do a shallow clone / fetch to save time on bigger repos, this did not play nicely with NuKeeper and I was getting an error ‘NuKeeperException : Git Cannot checkout branch’

trigger: none # you don't likely want this firing every time someone pushes a branch

schedules:
- cron: 0 4 * * 1,2,3,4,5 # 4am Mon-Fri
  always: true # you want this to fire regardless of changes to this repo
  branches:
    include:
    - refs/heads/master
    
pool:
  vmImage: windows-latest

steps:
- checkout: self
  persistCredentials: True
- task: NuKeeper@0
  displayName: NuKeeper
  env:
    NuKeeper_azure_devops_token: $(System.AccessToken) # this is important!
  inputs:
    arguments: --consolidate --maxpackageupdates 10 --change minor --age 0 --include ^CompanyNugetPrefix
    feed: /87ed4aa7-4a9f-4ea0-89f5-a9782a2067ae #GUID of your products nuget feed

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.