Skip to content

Commit

Permalink
Merge pull request #1 from jdstamp/dev-oscar-pipeline
Browse files Browse the repository at this point in the history
example for ssh pipeline steps executed on oscar
  • Loading branch information
jdstamp authored Dec 18, 2020
2 parents b8db976 + ad1ab83 commit 35ddc8a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea/
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
# ccmb-workflow
Collection of scripts for workflow automation.

## Workflow on oscar

4 changes: 4 additions & 0 deletions oscar-job.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

echo "From the shell script:"
echo "Hello!"
40 changes: 40 additions & 0 deletions oscar.Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,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"
}
}
}

0 comments on commit 35ddc8a

Please sign in to comment.