Search code examples
jenkinsphabricator

Create a job in Jenkins automatically when a repo is created in Phabricator


I have a repo in phabricator and cloned in my local machine.

Now I want to create a new Jenkins job automatically after creating a new repo in Phabricator. Jenkins API is available to create a new job remotely.

According to Jenkins:

To create a new job, post config.xml to this URL with query parameter name=JOBNAME. You need to send a Content-Type: application/xml header.

I can create a job by the following command using terminal.

curl -X POST -H "Content-Type:application/xml" -d "<project><builders/><publishers/><buildWrappers/></project>" "http://ip:port/createItem?name=AA_TEST_JOB1" 

Question: How can I run the command by Harbormaster to create a Jenkins job and also send config.xml file for the configuration of that new job?


Solution

    • Actually, there is no settings or automatic way to create a Jenkins job after creating a new repo in Phabricator.

    • I've solved this editing Phabricator php codes. Simple way is to call the Jenkins API from php codes after creating a repo.