Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Commit

Permalink
Fixes #38. Settings are now properly saved and restored
Browse files Browse the repository at this point in the history
  • Loading branch information
Argelbargel committed Mar 3, 2018
1 parent a5357e2 commit 45e0fcb
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public GitLabSCMSourceSettings getSourceSettings() {

@Override
public String getCredentialsId() {
return sourceSettings.getCredentialsId();
return sourceSettings.getCheckoutCredentialsId();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public final class GitLabSCMSourceSettings extends AbstractDescribableImpl<GitLa
private final GitLabSCMOriginMonitorStrategy originMonitorStrategy;
private final GitLabSCMForksMonitorStrategy forksMonitorStrategy;
private final GitLabSCMTagMonitorStrategy tagMonitorStrategy;
private String credentialsId;
private String checkoutCredentialsId;
private boolean updateBuildDescription;
private boolean publishUnstableBuildsAsSuccess;
private String mergeCommitMessage;
Expand All @@ -70,7 +70,7 @@ public GitLabSCMSourceSettings(String connectionName,
this.originMonitorStrategy = originMonitorStrategy;
this.forksMonitorStrategy = forksMonitorStrategy;
this.tagMonitorStrategy = tagMonitorStrategy;
this.credentialsId = CHECKOUT_CREDENTIALS_ANONYMOUS;
this.checkoutCredentialsId = CHECKOUT_CREDENTIALS_ANONYMOUS;
this.updateBuildDescription = true;
this.publishUnstableBuildsAsSuccess = false;
this.mergeCommitMessage = DEFAULT_MERGE_COMMIT_MESSAGE;
Expand All @@ -97,13 +97,13 @@ public GitLabSCMTagMonitorStrategy getTagMonitorStrategy() {
return tagMonitorStrategy;
}

public String getCredentialsId() {
return !CHECKOUT_CREDENTIALS_ANONYMOUS.equals(credentialsId) ? credentialsId : null;
public String getCheckoutCredentialsId() {
return !CHECKOUT_CREDENTIALS_ANONYMOUS.equals(checkoutCredentialsId) ? checkoutCredentialsId : null;
}

@DataBoundSetter
public void setCredentialsId(String credentialsId) {
this.credentialsId = credentialsId;
public void setCheckoutCredentialsId(String checkoutCredentialsId) {
this.checkoutCredentialsId = checkoutCredentialsId;
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import hudson.util.ListBoxModel;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.NoExternalUse;
import org.kohsuke.stapler.DataBoundSetter;

import javax.annotation.Nonnull;

Expand All @@ -26,14 +27,28 @@ public final boolean getMonitored() {
return monitor;
}

@DataBoundSetter
public final void setMonitored(boolean value) {
monitor = value;
}

public final boolean getBuild() {
return build;
}

@DataBoundSetter
public final void setBuild(boolean value) {
build = value;
}

public final BuildStatusPublishMode getBuildStatusPublishMode() {
return buildStatusPublishMode;
}

@DataBoundSetter
public final void setBuildStatusPublishMode(BuildStatusPublishMode value) {
buildStatusPublishMode = value;
}

protected static abstract class MonitorStrategyDescriptor<T extends MonitorStrategy> extends Descriptor<MonitorStrategy> {
@Nonnull
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:optionalBlock title="${%Monitor &amp; Build Origin Branches}" field="monitored" inline="true"
checked="${descriptor.defaults.monitored}">
<f:optionalBlock title="${%Monitor &amp; Build Origin Branches}" field="monitored" inline="true">
<f:nested>
<table>
<f:entry title="${%Include branches}" field="includes">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:optionalBlock title="Monitor &amp; Build Merge Requests from Forks" field="monitored" inline="true"
checked="${descriptor.defaults.monitored}">
<f:optionalBlock title="Monitor &amp; Build Merge Requests from Forks" field="monitored" inline="true">
<f:nested>
<table>
<f:optionalBlock title="${%Build merged with base branch}" field="build"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:optionalBlock title="${%Monitor &amp; Build Merge Requests from Origin}" field="monitored"
checked="${descriptor.defaults.monitored}" inline="true">
<f:optionalBlock title="${%Monitor &amp; Build Merge Requests from Origin}" field="monitored" inline="true">
<f:nested>
<table>
<f:optionalBlock title="${%Build merged with base branch}" field="buildMerged"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:f="/lib/form">
<f:optionalBlock title="${%Monitor Tags}" field="monitored" checked="${descriptor.defaults.monitored}"
inline="true">
<f:optionalBlock title="${%Monitor Tags}" field="monitored" inline="true">
<f:nested>
<table>
<f:optionalBlock title="${%Build Tags}" field="buildTags" checked="${descriptor.defaults.build}"
inline="true">
<f:optionalBlock title="${%Build Tags}" field="build" inline="true">
<f:entry title="${%Publish build status}" field="buildStatusPublishMode">
<f:select default="${descriptor.defaults.buildStatusPublishMode}"/>
</f:entry>
Expand Down

0 comments on commit 45e0fcb

Please sign in to comment.