Skip to content
Permalink
Browse files
[JENKINS-47972] fix ClaimConfig circular dependency on data migration
  • Loading branch information
Greybird committed Dec 24, 2017
1 parent 48e857d commit 5bf7f4d20e13ff9e4b65b626673617b8d838be4c
Showing with 11 additions and 2 deletions.
  1. +11 −2 src/main/java/hudson/plugins/claim/ClaimConfig.java
@@ -133,7 +133,16 @@ public SecureGroovyScript getGroovyTrigger() {
}

void setGroovyTrigger(@Nonnull SecureGroovyScript groovyTrigger) {
this.groovyTrigger = groovyTrigger.configuring(ApprovalContext.create().withCurrentUser().withKey(GROOVY_SCRIPT_KEY)); }
this.setGroovyTrigger(groovyTrigger, true);
}

private void setGroovyTrigger(@Nonnull SecureGroovyScript groovyTrigger, boolean withCurrentUser ) {
ApprovalContext approvalContext = ApprovalContext.create().withKey(GROOVY_SCRIPT_KEY);
if (withCurrentUser) {
approvalContext = approvalContext.withCurrentUser();
}
this.groovyTrigger = groovyTrigger.configuring(approvalContext);
}

public boolean hasGroovyTrigger() {
return StringUtils.isNotEmpty(groovyTrigger.getScript());
@@ -150,7 +159,7 @@ public static ClaimConfig get() {
@SuppressWarnings("deprecation")
private Object readResolve() {
// JENKINS-43811 migration logic
setGroovyTrigger(new SecureGroovyScript(groovyScript != null ? groovyScript : "", true, null)); return this;
setGroovyTrigger(new SecureGroovyScript(groovyScript != null ? groovyScript : "", true, null), false); return this;
}

}

0 comments on commit 5bf7f4d

Please sign in to comment.