Quantcast

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
Issue Type: New Feature New Feature
Assignee: jglick
Components: core
Created: 30/Aug/12 9:50 PM
Description:

Many jobs or other model objects require certain plugins. This should be represented in the actual config.xml, e.g.

<builders>
  <org.jenkinsci.plugins.hello.HelloWorldBuilder plugin="hello 1.5">
    <idiosyncraticConfig/>
  </org.jenkinsci.plugins.hello.HelloWorldBuilder>
</builders>

(XML namespaces would in some ways be natural for this, but XStream probably is more comfortable with a simple attribute on the outermost element “owned” by a plugin.)

Need to make XmlFile.write insert these attributes as it serializes configuration, perhaps by making it take some interface implemented by PluginManager mapping Class to String shortName × String version. JRubyXStreamConverter might be used for inspiration.

onLoad can either ignore these attributes, or use them as hints—for example, silently ignoring deserialization failures from a section owned by a plugin which is not currently loaded.

Web methods like doCreateItem and doConfigDotXml, and their corresponding Java methods like createProjectFromXML and updateByXml, can be left alone, but a caller needs some way of first checking whether all required plugins are present, and attempting to install them if not. So there needs to be a web method on Jenkins and a corresponding Java method which can be given an arbitrary XML file and will return:

  1. OK, if all plugins mentioned therein are present. (Perhaps also check versions.)
  2. A security error, if caller is missing ADMINISTER permission.
  3. Or a list of jobs given as UpdateCenterJob.id (introduced in a3e57da) indicating ongoing progress of installing (or updating?) plugins, and perhaps even restarting Jenkins (trackable as of a3e57da) for those plugins which require it.

May also want some higher-level convenience interface, e.g. in CLI, to validate XML and wait for all update center jobs to complete.

Project: Jenkins
Labels: plugin xml api
Priority: Major Major
Reporter: jglick
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
jglick commented on New Feature JENKINS-15003
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
jglick started work on New Feature JENKINS-15003
Change By: jglick (07/Sep/12 12:51 AM)
Status: Open In Progress
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Jesse Glick commented on New Feature JENKINS-15003

Something like https://github.com/jenkinsci/cli-channel-demo/blob/master/src/main/java/org/jenkinsci/demo/cli/App.java (CLI.upgrade) could suffice for a convenient remote API, especially if the client were enhanced to automatically reconnect after a server restart.

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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Change By: Jesse Glick (14/Sep/12 5:45 PM)
Description: Many jobs or other model objects require certain plugins. This should be represented in the actual {{config.xml}}, e.g.

{code:xml}
<builders>
  <org.jenkinsci.plugins.hello.HelloWorldBuilder plugin="hello 1.5">
    <idiosyncraticConfig/>
  </org.jenkinsci.plugins.hello.HelloWorldBuilder>
</builders>
{code}

(XML namespaces would in some ways be natural for this, but XStream probably is more comfortable with a simple attribute on the outermost element “owned” by a plugin.)

Need to make {{XmlFile.write}} insert these attributes as it serializes configuration, perhaps by making it take some interface implemented by {{PluginManager}} mapping {{Class}} to {{String shortName}} × {{String version}}. {{JRubyXStreamConverter}} might be used for inspiration.

{{onLoad}} can either ignore these attributes, or use them as hints—for example, silently ignoring deserialization failures from a section owned by a plugin which is not currently loaded.

Web methods like {{doCreateItem}} and {{doConfigDotXml}}, and their corresponding Java methods like {{createProjectFromXML}} and {{updateByXml}}, can be left alone, but a caller needs some way of first checking whether all required plugins are present, and attempting to install them if not. So there needs to be a web method on {{Jenkins}} and a corresponding Java method which can be given an arbitrary XML file and will return:

# OK, if all plugins mentioned therein are present. (Perhaps also check versions.)
# A security error, if caller is missing {{ADMINISTER}} permission.
# Or a list of jobs given as {{UpdateCenterJob.id}} (introduced in {{a3e57da}}) indicating ongoing progress of installing (or updating?) plugins, and perhaps even restarting Jenkins (trackable as of {{
a3e57da 4bd0696 }}) for those plugins which require it.

May also want some higher-level convenience interface, e.g. in CLI, to validate XML and wait for all update center jobs to complete
 (including restart as of {{9ae0ba0}}) .
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Jesse Glick commented on New Feature JENKINS-15003

To find the list of update jobs using the remote API:

curl -g 'http://localhost:8080/updateCenter/api/json?pretty&tree=jobs[id,type,status[type],plugin[name,version]]'
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Jesse Glick commented on New Feature JENKINS-15003
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Jesse Glick resolved New Feature JENKINS-15003 as Fixed
Change By: Jesse Glick (14/Sep/12 10:10 PM)
Status: In Progress Resolved
Resolution: Fixed
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

[JIRA] (JENKINS-15003) Track and verify plugins mentioned in configuration XML

JIRA noreply@jenkins-ci.org
In reply to this post by JIRA noreply@jenkins-ci.org
Jesse Glick commented on New Feature JENKINS-15003
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
Loading...