Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-41291

Implement a select widget to show configuration in custom Builder


    • Icon: New Feature New Feature
    • Resolution: Unresolved
    • Icon: Minor Minor
    • None
    • config-file-provider-plugin 2.15.5
      Jenkins 1.625.3

      If I would integrate in a build step the choosen of a config file to use (similar settings.xml in Maven step) actually I have to do a lot of manual work to properly render an HTML select with a filtered list of config and eventually manage verification of file content.

      So i ask to implement a custom select jelly widget (like that credential plugin) to facilitate integrations of configuration in custom build step/wrapper a sort of

      <j:jelly ... xmlns:cf="/lib/configfiles">
          <f:entry title="${%Config File}" field="configId">
          <cf:select filter="${descriptor.class}" includeEmpty="true" />

      This widget attributes could be:

      1. field - Used for databinding.
      2. filter - (optional) list only configuration that match this FQN of descriptor class
      3. default - default value of the text box, in case both @value is and 'instance[field]' is null.
      4. includeEmpty - an empty option in the combobox that indicates no config file must be provided for this step

      To validate wrong configuration add a verify method on Config base class (by default empty {} ), implementation could override with own logic (for example XML/JSON verify that content is well-formed) that could be invoked in the doCheck method in the BuildDescriptorImp.

      This verify method could be also used to validate the content during supplyFile method after token replace. This reduce user analisys on build failure.

      Keept in mind that in this way we could enforce the same failure behavior when the configuration file is handled directly by a custom build step (like maven or NodeJS) or ConfigFileBuildWrapper is used.

            domi Dominik Bartholdi
            nfalco Nikolas Falco
            0 Vote for this issue
            1 Start watching this issue