2

Does Jenkins provide a variable when replay is ran? If so what is that? I see in the log that is writes Replayed but I am not looking to scrape the console output.

Laser Hawk
  • 1,988
  • 2
  • 23
  • 29

1 Answers1

3

You can use 'cause' of which has triggered the job, in rawBuild.

def replayClassName = "org.jenkinsci.plugins.workflow.cps.replay.ReplayCause​"
def isReplay = currentBuild.rawBuild.getCauses().any{ cause -> cause.toString().contains(replayClassName) }  

*refered from
How to know inside jenkinsfile / script that current build is a replay?

Jiho
  • 338
  • 1
  • 6
  • 14