extensible-choice-parameter-plugin icon indicating copy to clipboard operation
extensible-choice-parameter-plugin copied to clipboard

Added a new DatabaseChoiceListProvider with ja/fr/en translations

Open tduchateau opened this issue 10 years ago • 6 comments

  • The new choice list provider is fully configurable: JDBC URL and driver, db name, db table, db column, db username, db password. It allows per-job database configuration only.
  • Moreover, a fallback mechanism has been added and allows to read a local file containing choices (one per line) if the connection to the database can't be established (for any reason)
  • All Messages*.properties have been updated accordingly
  • WARNING: the driver class must be manually added to the classpath (either by putting the right JAR in the WEB-INF\lib folder of Jenkins, or by installing one of the Database plugins, such as https://wiki.jenkins-ci.org/display/JENKINS/MySQL+Database+Plugin)

tduchateau avatar Jan 12 '15 22:01 tduchateau

Additional notes:

  • There is no tests. Shame on me :-(
  • mvn test launched locally in the original code base, before any modification, was already failing with Tests run: 70, Failures: 0, Errors: 35, Skipped: 0. I didn't take the time to try to fix them.
  • I had to comment some @Override annotations in order to fix compiling issues. Compiler used in Eclipse: 1.6.
  • This one could be a showstopper: I had to upgrade the org.jenkins-ci.plugins:plugin from 1.466 to 1.580.1.But because I'm not sure this is the minimal version required, I didn't push the pom.xml file
  • Finally, I had to explicitely use the latest release of the maven-hpi-plugin by adding the following to the pom.xml file:
<build> 
   <plugins> 
      <plugin> 
         <groupId>org.jenkins-ci.tools</groupId> 
         <artifactId>maven-hpi-plugin</artifactId> 
         <version>1.95</version> 
      </plugin> 
   </plugins> 
</build>

tduchateau avatar Jan 12 '15 22:01 tduchateau

Thank you for a pull request! Please check this document for how the Jenkins project handles pull requests

jenkinsadmin avatar Jan 13 '15 01:01 jenkinsadmin

mvn eclipse:eclipse generates build configurations that force to compile with Java 1.5. That cause compilation errors as annotations (like @Override) are introduced in Java1.6. Uncheck a checkbox like "project specific configuraion" in Project -> Properties -> Java Compiler and you can compile that without errors.

ikedam avatar Jan 13 '15 10:01 ikedam

uncheckhere

ikedam avatar Jan 13 '15 23:01 ikedam

WARNING: the driver class must be manually added to the classpath (either by putting the right JAR in the WEB-INF\lib folder of Jenkins, or by installing one of the Database plugins, such as https://wiki.jenkins-ci.org/display/JENKINS/MySQL+Database+Plugin)

This can be resolved by integrated with Database plugin. Though there are too few examples, you can integrate that as a following way (just outline):

  1. add an optional dependency to database-plugin 1.1.
    • As 1.1 is the greatest version that works with Jenkins 1.466 targeted by extensible-choice-parameter plugin.
    • Of course you can upgrade the target Jenkins version and depends to the latest database plugin, but I don't think we need features of database plugin introduced in 1.2.
  2. Replace database connaction parameter fields of DatabaseChoiceList provider with Database.
  3. in config.jelly: <f:dropdownDescriptorSelector field="database" title="${%Database}" />

ikedam avatar Jan 15 '15 00:01 ikedam

#9 demonstrates implementation with database plugin.

ikedam avatar Jan 31 '15 01:01 ikedam