Reputation: 1438
I have job which builds a maven project and runs sonar as a post build step and then with another build step, deploys the WAR file. Since the code base is huge, I dont want to run sonar every time I do a deployment. Requirement is, when the user triggers the job, the sonar build step should only be performed, if there is a change in the code base from the last build. If no change, skip the test. Any idea or a plugin which can do this?
Upvotes: 1
Views: 782
Reputation: 14762
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 SonarQube shall run or not.
Upvotes: 2