Skip to content

Instantly share code, notes, and snippets.

@oldthreefeng
Last active September 18, 2019 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oldthreefeng/d2bb2833c0af03513cdc090ee9442081 to your computer and use it in GitHub Desktop.
Save oldthreefeng/d2bb2833c0af03513cdc090ee9442081 to your computer and use it in GitHub Desktop.
pipeline
node {
stage('Parallel Stage') {
parallel 'test02': {
def remote = [:]
remote.name = "test01"
remote.host = "host"
remote.port = port
remote.allowAnyHosts = true
withCredentials([sshUserPrivateKey(credentialsId: 'louis', keyFileVariable: 'identity', passphraseVariable: 'passphrase', usernameVariable: 'username')]) {
remote.user = username
remote.identityFile = identity
remote.passphrase = passphrase
stage("test01-build") {
sshCommand remote: remote, command: 'uname -r'
}
}
}, 'test02': {
def remote = [:]
remote.name = "test02"
remote.host = "host"
remote.port = port
remote.allowAnyHosts = true
withCredentials([sshUserPrivateKey(credentialsId: 'louis', keyFileVariable: 'identity', passphraseVariable: 'passphrase', usernameVariable: 'username')]) {
remote.user = username
remote.identityFile = identity
remote.passphrase = passphrase
stage("test02-build") {
sshCommand remote: remote, command: 'uname -r'
}
}
}
}
stage('DingDing') {
script {
def msg = "构建失败,请及时查看原因"
def imageUrl = "https://www.iconsdb.com/icons/preview/red/x-mark-3-xxl.png"
def dingdingtoken = "https://oapi.dingtalk.com/robot/send?access_token=acde****cdef"
if (currentBuild.currentResult=="SUCCESS"){
imageUrl= "http://icons.iconarchive.com/icons/paomedia/small-n-flat/1024/sign-check-icon.png"
msg ="发布成功"
}
sh "sh ${JENKINS_HOME}/dingding.sh ${BUILD_TAG} ${BUILD_URL} ${msg} ${imageUrl} ${dingdingtoken}"
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment