Reputation: 706
The situation:
2 files are placed on a server, this sends a trigger to Jenkins starting a pipeline job.
The problem:
The trigger-script kicks off a trigger per file causing the job to run twice, while the idea is to run it just once.
Contacted the party that built the trigger and they say the trigger cannot be altered.
So a trigger side fix is not possible.
The question and what i have tried so far
I have tried adding
options {
disableConcurrentBuilds()
}
To my pipeline script, but this seems to do nothing.
I have tried throttling the build to one an hour, but then it queues the second run until the first one is finished while I just want it to bounce and never be run, only the first one should run.
My question is, how do I set up my job so even though the trigger launches twice, only one job will run.
Thanks in advance.
Upvotes: 2
Views: 3214
Reputation: 706
Eventually I solved the issue outside of Jenkins. By adding a catch to the trigger-script that kicks off my Jenkins Pipeline, preventing it from being kicked of twice in quick succession.
Upvotes: 1
Reputation: 1146
I would look into quiet period: https://jenkins.io/blog/2010/08/11/quiet-period-feature/
That way if it was triggered twice within a certain time it would notice they are duplicates and only trigger once.
Upvotes: 3