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
  • 75,001
  • 122
  • 434
  • 781

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
  • 36,824
  • 16
  • 89
  • 114