Skip to content

Commit

Permalink
JENKINS-52390 Throw appropriate error when the code is not in node bl…
Browse files Browse the repository at this point in the history
…ock (#3)
  • Loading branch information
nrayapati authored Jul 6, 2018
1 parent aedee57 commit e4d1b19
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ This step executes given command on remote node and responds with output.
==== Example

```groovy
node {
def remote = [:]
remote.name = 'test'
remote.host = 'test.domain.com'
Expand All @@ -190,6 +191,7 @@ This step executes given command on remote node and responds with output.
sshCommand remote: remote, command: "ls -lrt"
sshCommand remote: remote, command: "for i in {1..5}; do echo -n \"Loop \$i \"; date ; sleep 1; done"
}
}
```

=== sshScript
Expand Down Expand Up @@ -224,6 +226,7 @@ This step executes given script(file) on remote node and responds with output.
==== Example

```groovy
node {
def remote = [:]
remote.name = 'test'
remote.host = 'test.domain.com'
Expand All @@ -234,6 +237,7 @@ This step executes given script(file) on remote node and responds with output.
writeFile file: 'abc.sh', text: 'ls -lrt'
sshScript remote: remote, script: "abc.sh"
}
}
```

=== sshPut
Expand Down Expand Up @@ -272,6 +276,7 @@ Put a file or directory into the remote host.
==== Example

```groovy
node {
def remote = [:]
remote.name = 'test'
remote.host = 'test.domain.com'
Expand All @@ -282,6 +287,7 @@ Put a file or directory into the remote host.
writeFile file: 'abc.sh', text: 'ls -lrt'
sshPut remote: remote, from: 'abc.sh', into: '.'
}
}
```

=== sshGet
Expand Down Expand Up @@ -320,6 +326,7 @@ Get a file or directory from the remote host.
==== Example

```groovy
node {
def remote = [:]
remote.name = 'test'
remote.host = 'test.domain.com'
Expand All @@ -329,6 +336,7 @@ Get a file or directory from the remote host.
stage('Remote SSH') {
sshGet remote: remote, from: 'abc.sh', into: 'abc_get.sh', override: true
}
}
```

=== sshRemove
Expand Down Expand Up @@ -363,6 +371,7 @@ Remove a file or directory on the remote host.
==== Example

```groovy
node {
def remote = [:]
remote.name = 'test'
remote.host = 'test.domain.com'
Expand All @@ -372,6 +381,7 @@ Remove a file or directory on the remote host.
stage('Remote SSH') {
sshRemove remote: remote, path: "abc.sh"
}
}
```
== Examples

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import com.google.common.collect.ImmutableSet;
import hudson.EnvVars;
import hudson.FilePath;
import hudson.Launcher;
import hudson.model.Run;
import hudson.model.TaskListener;
import java.util.Set;
Expand All @@ -20,6 +22,6 @@ protected String getPrefix() {

@Override
public Set<? extends Class<?>> getRequiredContext() {
return ImmutableSet.of(Run.class, TaskListener.class, EnvVars.class);
return ImmutableSet.of(Launcher.class, FilePath.class, Run.class, TaskListener.class, EnvVars.class);
}
}

0 comments on commit e4d1b19

Please sign in to comment.