-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathoscar.Jenkinsfile
40 lines (39 loc) · 1.36 KB
/
oscar.Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!groovy
node {
checkout scm
withCredentials(
[
usernamePassword(
credentialsId: 'brown-account',
passwordVariable: 'PASSWORD',
usernameVariable: 'USER')
]
) {
def remote = [
name: 'oscar',
host: 'ssh.ccv.brown.edu',
user: USER,
password: PASSWORD,
allowAnyHosts: true
]
stage('Transfer a file to oscar') {
writeFile file: 'hello.txt', text: 'Hello oscar!'
sshPut remote: remote, from: 'hello.txt', into: '.'
}
stage('Run a command on oscar') {
sshCommand remote: remote, command: "ls -lrt"
sshCommand remote: remote, command: "for i in {1..5}; do echo -n \"Loop \$i \"; date > hello.txt; sleep 1; done"
}
stage('Run a shell script on oscar') {
sshScript remote: remote, script: "oscar-job.sh"
}
stage('Fetch a file from oscar') {
sshGet remote: remote, from: 'hello.txt', into: 'hello.txt', override: true
sh 'cat hello.txt'
}
stage('Remove a file from oscar') {
sshRemove remote: remote, path: "hello.txt"
sshCommand remote: remote, command: "ls -lrt"
}
}
}