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

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 purpose only (like the general use in Java).

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

For use it, you only have to define de supertype job template and in your script use the attributes of the supertype (Be careful of having some attributes with the same name).

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 "TestTamplateJob2" will have all the attributes of the TestTemplateJob2 and TestJobTemplate

Example of selection of a supertype

The supertypes don’t allow you to reuse the transformation because if they allow you the final job would be the same of the supertype.

Tested products/plugins version

The latest update of this article was tested with:

  • Jenkins LTS 2.73.3.1