3

I have a TFS Build Definition which has a Queue Jenkins job step. If I cancel the TFS Build Definition the Jenkins job isn't cancelled. Is there a way to make it cancel?

I'm thinking maybe schedule a step to run if build definition was cancelled which cancels the job using Cancelling Jenkins Job from Command line (CLI)

sashoalm
  • 69,127
  • 105
  • 396
  • 720

1 Answers1

2

You can add a "Jenkins stop job" task, using Jenkins API like mentioned here or with POST call like mentioned here.

Configure this task to run only if you cancel the build:

enter image description here

eq(variables['Agent.JobStatus'], 'Canceled')
Shayki Abramczyk
  • 30,710
  • 15
  • 70
  • 94