Reputation: 2970
I would like to trigger a Jenkins build when the following conditions are met:
I have only been able to either run it nightly (whether there has been a commit or not) using the Build periodically trigger, or only after a commit using the Poll SCM trigger or just a webhook from Stash.
I've tried using both Poll SCM and Build periodically but it ends but never running.
Does anyone have a solution for this case?
I would like my nightly to run only if there's been development activity.
Upvotes: 1
Views: 1551
Reputation: 14782
See Git Plugin, Environment Variables:
The git plugin sets several environment variables you can use in your scripts:
GIT_COMMIT
- SHA of the current...
GIT_PREVIOUS_COMMIT
- SHA of the previous built commit from the same branch
If these are the same, there was no change. Use them in the Conditional BuildStep Plugin to decide whether your nightly shall run or not.
Upvotes: 1