Skip to content

Commit

Permalink
add first class rsh, better deal with args for proxy cmds like exec, rsh
Browse files Browse the repository at this point in the history
  • Loading branch information
gabemontero committed Nov 16, 2017
1 parent 06ed726 commit ab4b7bf
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
4 changes: 4 additions & 0 deletions examples/jenkins-image-sample.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ try {
echo "Database will run in deployment config: ${dcs.name()}"
// Find a least one pod related to the DeploymentConfig and wait it satisfies a condition
dcs.related('pods').untilEach(1) {
// some example debug of the pod in question
// commented out until v1.0.3 of the plugin is in the openshift jenkins image
//shortname = it.object().metadata.name
//echo openshift.rsh("${shortname}", "hostname").out
// untilEach only terminates when each selected item causes the body to return true
return it.object().status.phase != 'Pending'
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,9 @@ public List<String> buildCommand(boolean redacted) {

String toolName = (new OpenShift.DescriptorImpl()).getClientToolName();
cmd.add(toolName);
cmd.add(verb);

cmd.addAll(toStringArray(verbArgs));

cmd.addAll(toStringArray(userArgs));

cmd.addAll(toStringArray(options));


// in general with 'oc' if the '--' args preceded the verb that helps
// with some of the exec/rsh type scenarios
if (this.server != null) {
cmd.add("--server=" + server);
}
Expand Down Expand Up @@ -111,6 +106,14 @@ public List<String> buildCommand(boolean redacted) {
cmd.add("--token=" + token);
}
}

cmd.add(verb);

cmd.addAll(toStringArray(verbArgs));

cmd.addAll(toStringArray(userArgs));

cmd.addAll(toStringArray(options));

return cmd;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,7 @@ class OpenShiftDSL implements Serializable {
}

public Result exec(Object... args) { return simplePassthrough("exec", args); }
public Result rsh(Object... args) { return simplePassthrough("rsh", args); }
public Result idle(Object... args) { return simplePassthrough("idle", args); }
public Result _import(Object... args) { return simplePassthrough("import", args); }
public Result policy(Object... args) { return simplePassthrough("policy", args); }
Expand Down

0 comments on commit ab4b7bf

Please sign in to comment.