该插件不提供声明性脚本。如何将其从脚本转换为声明式?
网址:https://github.com/jenkinsci/bitbucket-build-status-notifier-plugin
...
stage 'Build'
bitbucketStatusNotify(
buildState: 'INPROGRESS',
buildKey: 'build',
buildName: 'Build',
repoSlug: 'my-awesome-project',
commitId: 'a83c709e9d514421ef614ef0a1117366c84c6304'
)
try {
myBuildFunction()
bitbucketStatusNotify(
buildState: 'SUCCESSFUL',
buildKey: 'build',
buildName: 'Build',
repoSlug: 'my-awesome-project',
commitId: 'a83c709e9d514421ef614ef0a1117366c84c6304'
)
}catch(Exception e) {
bitbucketStatusNotify(
buildState: 'FAILED',
buildKey: 'build',
buildName: 'Build',
buildDescription: 'Something went wrong with build!',
repoSlug: 'my-awesome-project',
commitId: 'a83c709e9d514421ef614ef0a1117366c84c6304'
)
}
答案 0 :(得分:0)
快速查看插件代码表明示例中显示的API是构建步骤,因此您可以执行以下操作:
pipeline {
agent any
stages {
stage('start') {
steps {
bitbucketStatusNotify(buildState: 'INPROGRESS' .... )
}
}
.
.
stage('last') {
steps {
.
.
bitbucketStatusNotify(buildState: 'SUCCESSFUL' ... )
}
}
}
post {
failure {
bitbucketStatusNotify(buildState: 'FAILURE' ... )
}
}
}