Last active
September 18, 2019 11:03
-
-
Save oldthreefeng/d2bb2833c0af03513cdc090ee9442081 to your computer and use it in GitHub Desktop.
pipeline
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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