咨询Jenkins中Run.Replay权限对应的Permission对象定义位置
Run.Replay Permission Defined in Jenkins? Great question! You’re absolutely right to notice that Run.Replay doesn’t exist in Jenkins core’s hudson.model.Run class—this permission is tied to a Pipeline (Workflow) exclusive feature, not core Jenkins functionality.
The Short Answer
The Run.Replay permission is defined in the org.jenkinsci.plugins.workflow.cps.replay.ReplayAction class, which is part of the Workflow CPS Plugin (the plugin that powers Pipeline functionality in Jenkins).
Breakdown of the Permission Definition
Here’s a simplified snippet of how the permission is declared in that class:
public static final Permission REPLAY = new Permission( Run.PERMISSIONS, "Replay", Messages.ReplayAction_PermissionDescription(), Run.UPDATE, PermissionScope.JENKINS );
- It’s registered under
Run.PERMISSIONS, which is why it shows up alongside core Run permissions (likeDelete/UPDATE) in the Jenkins UI. - The permission inherits an "implied by" relationship from
Run.UPDATE, meaning users withRun.UPDATEaccess will automatically getRun.Replaypermissions unless you explicitly restrict it.
Why It’s Not in Core Run
Replay is a feature unique to Pipeline jobs—it lets you re-run a Pipeline with modified script content without committing changes to your source control. Since this functionality doesn’t apply to all Jenkins job types (like Freestyle jobs), the permission lives in the plugin that provides the feature, not Jenkins core.
内容的提问来源于stack exchange,提问作者agabrys

