Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix label in step generator #121

Merged
merged 3 commits into from
Aug 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -132,17 +132,17 @@ public boolean isReturnStatus() {
@DataBoundSetter public void setReturnStatus(boolean returnStatus) {
this.returnStatus = returnStatus;
}

@DataBoundSetter public void setLabel(String label) {
this.label = label;
this.label = Util.fixEmptyAndTrim(label);
}

public String getLabel() {
return label;
}

@Override public StepExecution start(StepContext context) throws Exception {
if (this.label != null && !this.label.isEmpty()) {
if (this.label != null) {
context.get(FlowNode.class).addAction(new LabelAction(StringUtils.left(label, MAX_LABEL_LENGTH)));
}
return new Execution(context, this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -288,17 +288,17 @@ private static class Decorator extends LauncherDecorator implements Serializable
assertFalse(s.isReturnStdout());
assertNull(s.getEncoding());
assertFalse(s.isReturnStatus());
assertEquals("", s.getLabel());
assertEquals(null, s.getLabel());

s.setReturnStdout(true);
s.setEncoding("ISO-8859-1");
s = new StepConfigTester(j).configRoundTrip(s);
assertEquals("echo hello", s.getScript());
assertTrue(s.isReturnStdout());
assertEquals("ISO-8859-1", s.getEncoding());
assertFalse(s.isReturnStatus());
assertEquals("", s.getLabel());
assertEquals(null, s.getLabel());

s.setReturnStdout(false);
s.setEncoding("UTF-8");
s.setReturnStatus(true);
Expand All @@ -307,8 +307,8 @@ private static class Decorator extends LauncherDecorator implements Serializable
assertFalse(s.isReturnStdout());
assertEquals("UTF-8", s.getEncoding());
assertTrue(s.isReturnStatus());
assertEquals("", s.getLabel());
assertEquals(null, s.getLabel());

s.setLabel("Round Trip Test");
s = new StepConfigTester(j).configRoundTrip(s);
assertEquals("echo hello", s.getScript());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,14 @@ private void startJnlpProc() throws Exception {
new FileOutputStream(f1).close();
p.setDefinition(new CpsFlowDefinition(
"node('dumbo') {\n" +
" sh 'touch \"" + f2 + "\"; while [ -f \"" + f1 + "\" ]; do sleep 1; done; echo finished waiting; rm \"" + f2 + "\"'\n" +
" sh 'touch \"" + f2 + "\"; while [ -f \"" + f1 + "\" ]; do echo waiting; sleep 1; done; echo finished waiting; rm \"" + f2 + "\"'\n" +
" echo 'OK, done'\n" +
"}", true));
WorkflowRun b = p.scheduleBuild2(0).waitForStart();
while (!f2.isFile()) {
Thread.sleep(100);
}
story.j.waitForMessage("waiting", b);
assertTrue(b.isBuilding());
killJnlpProc();
}
Expand Down