答案 0 :(得分:1)
在Jenkins中,除env vars之外,目前不支持获取其他变量。我们可以使用“ Environment Injector”插件,但是我不确定该插件。
对于您的情况,您可以使用下面的脚本管道创建“管道”
node('JENKINS_NODE') {
git([url: 'GITHUB_REPO_URL', branch: 'BRANCH'])
def getResult
stage ('Execute Script') {
getResult = sh(
script: "python test.py",
returnStdout: true,
)
}
stage ('Send Slack Notification') {
slackSend channel: '#YOUR_SLACK_CHANNEL', color: 'good', message: getResult'
}
}