0

I have a jenkins-project which is built via ant (and build.xml). In the build.xml i have specified phpDoc but i only want to execute the ant-target phpdoc if the pushed branch is the master-branch. Is this possible?

Roman
  • 2,530
  • 2
  • 27
  • 50

1 Answers1

1

Yes it is possible. There are a few options depend on what SCM you use.

E.g for git, install git plugin Next create new job in Jenkins, In SCM section select git, set proper git repository, and in Branches to build set your master branch e.g */master

Next you need to specify build trigger. One approach is to setup proper git hook, or pull request builder. Another is to setup Poll SCM option. The second will cause that Jenkins will check your SCM every X minutes (depend on cofiguration).

Community
  • 1
  • 1
kkamil
  • 2,593
  • 11
  • 21
  • With your solution i have to create a new job that generates the documentation. What i wanted is to trigger the generation via the ant-script (build.xml). – Roman Jan 14 '15 at 14:24
  • 1
    Generally, you want the Ant buildfile to contain the tasks and how they execute, but not logic to make decisions on which tasks to run in a given instance. The Jenkins jobs then contain the logic to choose what to run and when, thus using the Ant file to perform only the tasks as chosen by the Jenkins job. Trying to incorporate such choosing logic in Ant itself would require writing your own macrodefs (very old example - http://tlrobinson.net/blog/2008/11/ant-tasks-for-git/). – ashnazg Jan 14 '15 at 22:44