0

I have a build pipeline at azure DevOps with the following tasks:

-Pack .net core
-check nuget dependencies
-publish artifact

The first task packs the nuget and the second one checks if their versions and shows the existent last version.

What I need to do is that the pipeline stop in case the nuget packages are not up-to-date.

Any idea how I could set it up?

riQQ
  • 9,878
  • 7
  • 49
  • 66

1 Answers1

0

As a suggestion, you could define a global variable about your current nuget package latest version, also your current nuget package version.

Create two variable as LastVersion and NewVersion variable.

enter image description here

LastVersion is the last version of your nuget package on the package source, you should search for it and give a value for it.

NewVersion is the current nuget version you want to pack.

After that, use a powershell task with the condition of '$(LastVersion)'-eq '$(NewVersion)' to cancel the job. You can refer to this link about the steps.

Or you could use exit 1 under powershell task with the below command to cancel this:

 #if LastVersion is the same as NewVersion, cancel the job       
 if( '$(LastVersion)' -eq '$(NewVersion)')
 {
   exit 1
 }
 else
 {
  exit 0
 }
Mr Qian
  • 21,064
  • 1
  • 31
  • 41
  • Thank's for your suggestion, but I don't think it covers de whole problem, since I have several packages and each one of them got different versions. I actually have found a task called "Nukeeper" that seems to cover this problem, however I've got a error of "Oauth missing". The problem is that there isn' any slot to fill with the token information. – Fabiano Alves Apr 30 '21 at 15:26
  • that is an easy workaround. And your requirements are quite complex and might not meet your expectations. Also, I could not find Nukeeper task. Could you try some steps about that? – Mr Qian May 06 '21 at 09:21