Template job is overwritten after adding or editing the desciption - template clobbering issue

Article ID:214734698
1 minute readKnowledge base

Issue

  • When updating the description in a Job created from template, the updated text is overwritten when the job’s configuration is changed (using the "Configure" option).
    By design, all content of the instance (templatized job) is defined by the transformer. The Templates plugin overrides the Configure link, which covers most of the ways in which config.xml might be modified. However there are some cases not covered, such as the "Edit Description" link, RBAC Groups, etc. In those cases any customizations made outside the knowledge of Templates will be “clobbered” the next time the instance is reconfigured (attributes changed, or template changed).

Environment

  • CloudBees Jenkins Enterprise

  • Template plugin

Resolution

There is a workaround that can be used in the job template’s "Groovy Template Transformation" section, so that the description can be updated without being clobbered by changes in the configuration. Modify the template’s 'description' section as follows…​.

  • Original (default) value: <description>${description}</description>

  • New (modified) value: <description>${instance.item.description}</description>

This will force the template’s jobs to read the instance’s description each time the job is re-configured.