Amit
Amit

Reputation: 153

How to give "build run" Permission on a specific job to a user in Jenkins

We have a created a Job in jenkins.

How can i give run permission to a user for this specific build Job.

I have referred some Jenkins sites but not got a clear understanding.

Thanks

Upvotes: 0

Views: 3499

Answers (1)

luka5z
luka5z

Reputation: 7805

If you are using Job DSL Plugin, then the easiest way you could specify per job permission would be to utilize Project-based Matrix Authorization Strategy (Manage Jenkins / Configure Global Security) and DSL script like the one below:

// adds the build permission for the special anonymous user
job('example-2') {
    authorization {
        permission('hudson.model.Item.Build', 'anonymous')
    }
}

Additionally, by setting Project-based Matrix Authorization Strategy you will be able to change project's permission manually, straight from job's configuration page.

Upvotes: 1

Related Questions