0

I am new to Jenkins. I am running my jobs using Jenkins declarative pipeline. My jobs has both snapshot version and release version. I want to push only release version to nexus (the reason is just to make sure it is not very much crowded in nexus). Can i control this in my pipeline script something like running multiple steps like, if my pom version has SNAPSHOT version, don't run nexus stage and if my pom has release version run nexus stage. is it possible to control this scenario in Jenkins pipeline. please assist

B--rian
  • 5,578
  • 10
  • 38
  • 89
user11881
  • 65
  • 2
  • 12

1 Answers1

1

Depending on how you know is a SNAPSHOT or a RELEASE version. For example if you use git branches (develop = SNAPSHOT , master = RELEASE) you can use GIT_BRANCH variable in order to select if you must deploy push to nexus

If you must read it directly from pom.xml, read this: Extract version ID from POM in a Jenkins pipeline

There you get the version and select if is a SNAPSHOT or RELEASE and the upload the file acoordingly.

Hope it helps

mndrye
  • 489
  • 2
  • 7