Skip to content

Commit

Permalink
Merge pull request #208 from pash-slack/pk_initializer
Browse files Browse the repository at this point in the history
Force lazy loading of Promoted Builds Plugin properties so they are available to JCasC
  • Loading branch information
jtnord authored Jun 28, 2022
2 parents 99d2978 + a9a4306 commit 12d3f79
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/hudson/plugins/promoted_builds/Promotion.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@
import org.kohsuke.stapler.StaplerRequest;
import org.kohsuke.stapler.StaplerResponse;

import hudson.init.InitMilestone;
import hudson.init.Initializer;
import org.kohsuke.accmod.restrictions.DoNotUse;

/**
* Records a promotion process.
*
Expand Down Expand Up @@ -486,6 +490,16 @@ private boolean preBuild(BuildListener listener, List<BuildStep> steps) {
public static final PermissionGroup PERMISSIONS = new PermissionGroup(Promotion.class, Messages._Promotion_Permissions_Title());
public static final Permission PROMOTE = new Permission(PERMISSIONS, "Promote", Messages._Promotion_PromotePermission_Description(), Jenkins.ADMINISTER, PermissionScope.RUN);

@Initializer(before = InitMilestone.SYSTEM_CONFIG_LOADED)
@Restricted(DoNotUse.class)
public static void registerPermissions() {
// Pending JENKINS-17200, ensure that the above permissions have been registered prior to
// allowing plugins to adapt the system configuration, which may depend on these permissions
// having been registered. Since this method is static and since it follows the above
// construction of static permission objects (and therefore their calls to
// PermissionGroup#register), there is nothing further to do in this method.
}

@Override
public int hashCode() {
return this.getId().hashCode();
Expand Down

0 comments on commit 12d3f79

Please sign in to comment.