How to use project-based matrix authorization strategy for Jobs created using a job template?

Issue

I am using enterprise jenkins along with template plugin.
I have created a job template and I want the jobs that will be created from this template to also have the option to enable project based matrix authorization Matrix Authorization Strategy Plugin.
I don’t know how this can be enabled.

Environment

Resolution

The configuration of project-based matrix authorization strategy for jobs is similar to other job properties. So you need to declare the hudson.security.AuthorizationMatrixProperty snippet in the proper location. The best way to get a sample configuration is to import it from an existing job using such control in Groovy Transformer.

In order to add the property conditionally, you can use conditional expressions in your template transformers. See Transformer Reference section in docs. There is an example for Conditional expression for groovy.

Please Note: The Jelly transformer is deprecated. Always use the Groovy transformer.

There is also an open RFE to allow the authorization property for the job to continue to be adjusted manually while the rest of the job definition is generated from the template transformer.

Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.