I have set a global environment varaiable in jenkins - flag which takes in values on and off
I have multiple declarative pipelines in jenkins, some of which get triggered based on timers.
Now I don't want the timers to trigger the scheduled pipelines when flag is set to on.
One way is to use the when {expression {env.flag == 'off' }} in all the stages in all the pipelines triggered by timer. I can't even apply it to stages at once but instead have to apply it individually to all stage inside stages. Is there a better way?
How can I accomplish this, preferably without installing any new plugins?