Jesse Glick commented on New Feature JENKINS-15003

To prevalidate a job:

curl -i -d @config.xml http://localhost:8080/pluginManager/prevalidateConfig

and note the X-Jenkins-Session for later. To track its progress:

(while :; do curl -ig 'http://localhost:8080/updateCenter/api/json?pretty&tree=jobs[id,type,status[type],plugin[name,version]]'; sleep 1; done)

Initially all plugins will show e.g.

{
  "id" : 1,
  "type" : "InstallationJob",
  "status" : {
    "type" : "Pending"
  },
  "plugin" : {
    "name" : "htmlpublisher",
    "version" : "1.0"
  }
}

but when done they will show

{
   "id" : 1,
   "type" : "InstallationJob",
   "status" : {
     "type" : "Success"
   },
   "plugin" : {
     "name" : "htmlpublisher",
     "version" : "1.0"
   }
 }

If you see "SuccessButRequiresRestart" then you must

curl -d '' http://localhost:8080/updateCenter/safeRestart

and then poll on

curl -I 'http://localhost:8080/'

or (more efficiently) any …/api/… such as

curl -i 'http://localhost:8080/updateCenter/api/json?tree=none'

until you get a 200 status with a new X-Jenkins-Session indicating that the server has restarted.

Now you may actually use the XML:

curl -d @/tmp/config.xml -H 'Content-Type: text/xml' 'http://localhost:8080/createItem?name=newjob'
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to