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

Commit

Permalink
JENKINS-37408: Add checkboxes for -X and -e on the formular site
Browse files Browse the repository at this point in the history
Options are now part of the form where the release is triggered.
  • Loading branch information
shillner committed Aug 29, 2016
1 parent ca5c797 commit 74b6319
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
Expand Up @@ -20,6 +20,7 @@
import hudson.maven.MavenModule;
import hudson.maven.MavenModuleSet;
import hudson.model.PermalinkProjectAction;
import hudson.model.PermalinkProjectAction.Permalink;

public class UnleashAction implements PermalinkProjectAction {
private static final Logger LOGGER = Logger.getLogger(UnleashAction.class.getName());
Expand All @@ -28,13 +29,17 @@ public class UnleashAction implements PermalinkProjectAction {
private boolean useGlobalVersion;
private boolean allowLocalReleaseArtifacts;
private boolean commitBeforeTagging;
private boolean errorLog;
private boolean debugLog;

public UnleashAction(MavenModuleSet project, boolean useGlobalVersion, boolean allowLocalReleaseArtifacts,
boolean commitBeforeTagging) {
boolean commitBeforeTagging, boolean errorLog, boolean debugLog) {
this.project = project;
this.useGlobalVersion = useGlobalVersion;
this.allowLocalReleaseArtifacts = allowLocalReleaseArtifacts;
this.commitBeforeTagging = commitBeforeTagging;
this.errorLog = errorLog;
this.debugLog = debugLog;
}

@Override
Expand Down Expand Up @@ -119,6 +124,22 @@ public void setCommitBeforeTagging(boolean commitBeforeTagging) {
this.commitBeforeTagging = commitBeforeTagging;
}

public boolean isErrorLog() {
return this.errorLog;
}

public void setErrorLog(boolean errorLog) {
this.errorLog = errorLog;
}

public boolean isDebugLog() {
return this.debugLog;
}

public void setDebugLog(boolean debugLog) {
this.debugLog = debugLog;
}

public List<MavenModule> getAllMavenModules() {
List<MavenModule> modules = Lists.newArrayList();
modules.addAll(this.project.getModules());
Expand All @@ -142,6 +163,8 @@ public void doSubmit(StaplerRequest req, StaplerResponse resp) throws IOExceptio

arguments.setAllowLocalReleaseArtifacts(requestWrapper.getBoolean("allowLocalReleaseArtifacts"));
arguments.setCommitBeforeTagging(requestWrapper.getBoolean("commitBeforeTagging"));
arguments.setErrorLog(requestWrapper.getBoolean("errorLog"));
arguments.setDebugLog(requestWrapper.getBoolean("debugLog"));

if (this.project.scheduleBuild(0, new UnleashCause(), arguments)) {
resp.sendRedirect(req.getContextPath() + '/' + this.project.getUrl());
Expand Down
Expand Up @@ -8,6 +8,8 @@ public class UnleashArgumentsAction implements Action {
private boolean useGlobalReleaseVersion;
private boolean allowLocalReleaseArtifacts;
private boolean commitBeforeTagging;
private boolean errorLog;
private boolean debugLog;

@Override
public String getIconFileName() {
Expand Down Expand Up @@ -63,4 +65,20 @@ public boolean commitBeforeTagging() {
public void setCommitBeforeTagging(boolean commitBeforeTagging) {
this.commitBeforeTagging = commitBeforeTagging;
}

public boolean errorLog() {
return this.errorLog;
}

public void setErrorLog(boolean errorLog) {
this.errorLog = errorLog;
}

public boolean debugLog() {
return this.debugLog;
}

public void setDebugLog(boolean debugLog) {
this.debugLog = debugLog;
}
}
Expand Up @@ -143,6 +143,12 @@ public void buildEnvVars(Map<String, String> env) {
}
command.append(" -Dunleash.allowLocalReleaseArtifacts=").append(arguments.allowLocalReleaseArtifacts());
command.append(" -Dunleash.commitBeforeTagging=").append(arguments.commitBeforeTagging());
if (arguments.errorLog()) {
command.append(" -e");
}
if (arguments.debugLog()) {
command.append(" -X");
}
}

final Map<String, String> scmEnv = updateCommandWithScmCredentials(build, command);
Expand Down Expand Up @@ -256,7 +262,7 @@ public void setPreselectUseGlobalVersion(boolean preselectUseGlobalVersion) {
@Override
public Collection<? extends Action> getProjectActions(@SuppressWarnings("rawtypes") AbstractProject job) {
return Collections.singleton(new UnleashAction((MavenModuleSet) job, this.preselectUseGlobalVersion,
this.preselectAllowLocalReleaseArtifacts, this.preselectCommitBeforeTagging));
this.preselectAllowLocalReleaseArtifacts, this.preselectCommitBeforeTagging, false, false));
}

public List<HookDescriptor> getHooks() {
Expand Down
Expand Up @@ -45,6 +45,12 @@
<f:entry title="Commit Before Tagging" help="/plugin/unleash/help-actionUnleash-commitBeforeTagging.html">
<f:checkbox field="commitBeforeTagging" name="commitBeforeTagging" checked="${it.isCommitBeforeTagging()}" />
</f:entry>
<f:entry title="Show error messages (-e)">
<f:checkbox field="errorLog" name="errorLog" checked="${it.isErrorLog()}"/>
</f:entry>
<f:entry title="Show debug log messages (-X)">
<f:checkbox field="debugLog" name="debugLog" checked="${it.isDebugLog()}"/>
</f:entry>
</f:section>

<tr>
Expand Down

0 comments on commit 74b6319

Please sign in to comment.