99re热这里只有精品视频,7777色鬼xxxx欧美色妇,国产成人精品一区二三区在线观看,内射爽无广熟女亚洲,精品人妻av一区二区三区

Jenkins 清理和通知

2018-08-22 10:45 更新

由于post Pipeline的部分保證在Pipeline執(zhí)行結(jié)束時運(yùn)行,因此我們可以添加一些通知或其他步驟來執(zhí)行定稿,通知或其他Pipeline末端任務(wù)。

Jenkinsfile (Declarative Pipeline)
pipeline {
    agent any
    stages {
        stage('No-op') {
            steps {
                sh 'ls'
            }
        }
    }
    post {
        always {
            echo 'One way or another, I have finished'
            deleteDir() /* clean up our workspace */
        }
        success {
            echo 'I succeeeded!'
        }
        unstable {
            echo 'I am unstable :/'
        }
        failure {
            echo 'I failed :('
        }
        changed {
            echo 'Things were different before...'
        }
    }
}

Toggle Scripted Pipeline (Advanced)

Jenkinsfile (Scripted Pipeline)
node {
    try {
        stage('No-op') {
            sh 'ls'
        }
    }
}
catch (exc) {
    echo 'I failed'
}
finally {
    if (currentBuild.result == 'UNSTABLE') {
        echo 'I am unstable :/'
    } else {
        echo 'One way or another, I have finished'
    }
}

有很多方法可以發(fā)送通知,下面是一些演示如何將有關(guān)Pipeline的通知發(fā)送到電子郵件,Hipchat房間或Slack頻道的片段。

Email

post {
    failure {
        mail to: 'team@example.com',
             subject: "Failed Pipeline: ${currentBuild.fullDisplayName}",
             body: "Something is wrong with ${env.BUILD_URL}"
    }
}

Hipchat

post {
    failure {
        hipchatSend message: "Attention @here ${env.JOB_NAME} #${env.BUILD_NUMBER} has failed.",
                    color: 'RED'
    }
}

Slack

post {
    success {
        slackSend channel: '#ops-room',
                  color: 'good',
                  message: "The pipeline ${currentBuild.fullDisplayName} completed successfully."
    }
}

現(xiàn)在,當(dāng)事情出現(xiàn)故障,不穩(wěn)定或甚至成功時,我們可以通過令人興奮的部分完成我們的持續(xù)交付流程:shipping!好了現(xiàn)在讓我們來看看下一節(jié):Jenkins部署


以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號