Super type in job templates

Article ID:360000113372
1 minute readKnowledge base

Issue

How can I use the super type option in the Job Templates?

Environment

  • CloudBees Jenkins Enterprise - Managed controller (CJE-MM)

Resolution

When you create a new Job Template you can see a select field named "Super type", but how can you use that field?

Where is the super type selection field

The use of supertypes in Job Templates is for hierarchy purposes only (as it happenss in Java).

For Jenkins Job Templates you can use supertypes to include the same attributes in different jobs with the advantage that if you change the supertype job template all the templates using it will also change.

To use it, you only have to define the supertype job template and in your transformation script, ensure that you use the attributes of the supertype (you might want to avoid using attributes with the same name outside the supertype).

For example, if you define a Job Template "TestJobTemplate" with an attribute "testAtribute", and you create a new Job Template named:"TestTemplateJob2" where you select as Super type "TestJobTemplate. The jobs that you create from the template "TestTemplateJob2" will include all the attributes explicitly defined for that job template and it will also include the attributes of the TestJobTemplate.

Example of selection of a supertype

The supertypes don’t allow you to reuse the transformation script to prevent circular references.

Tested products/plugins version

The latest update of this article was tested with:

  • Jenkins LTS 2.73.3.1