Skip to content

Instantly share code, notes, and snippets.

@mvk
Created April 16, 2019 12:28
Show Gist options
  • Save mvk/dbc88280fdba255fa3cdfdadcde25332 to your computer and use it in GitHub Desktop.
Save mvk/dbc88280fdba255fa3cdfdadcde25332 to your computer and use it in GitHub Desktop.
mix scripted with declarative
pipeline {
agent {
docker { image 'docker-registry:5000/ruby:2.5.1' }
}
stages {
stage('Test') {
steps {
script {
String target = 'bla'
String targetUser = 'ku'
sshagent (['test']) {
sh([
label: "on current agent",
script: "ls -l"
])
sh([
label: "on ${target}",
script: "ssh -l ${targetUser} ${target} whoami"
])
}
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment