在管道中使用通用 webhook 触发器变量
Use generic webhook trigger variables in pipeline
我正在使用通用 webhook 插件来触发我的构建:https://plugins.jenkins.io/generic-webhook-trigger/
在此插件的设置中,它允许您根据 webhook 的内容定义变量。我用它来创建变量 $name & $branch.
我可以在构建的触发条件内使用这些变量(我用它来检查提交是否针对正确的分支)。
我真正想做的是能够访问我在实际管道中定义的变量。
所以我可以这样做:
steps {
slackSend(channel: "#pipeline", message: 'Starting to build ${branch} for ${name}', botUser: true, color: 'good')
}
如何将这些 webhook 变量添加到我的构建环境变量中?
试试这个:
steps {
slackSend(channel: "#pipeline", message: 'Starting to build ${params.branch} for ${params.name}', botUser: true, color: 'good')
}
Guerrilla 在评论中回答了这个问题,但解决方法是使用双引号而不是单引号,如下所示:
steps {
slackSend(channel: "#pipeline", message: "Starting to build ${branch} for ${name}", botUser: true, color: 'good')
}
我正在使用通用 webhook 插件来触发我的构建:https://plugins.jenkins.io/generic-webhook-trigger/
在此插件的设置中,它允许您根据 webhook 的内容定义变量。我用它来创建变量 $name & $branch.
我可以在构建的触发条件内使用这些变量(我用它来检查提交是否针对正确的分支)。
我真正想做的是能够访问我在实际管道中定义的变量。
所以我可以这样做:
steps {
slackSend(channel: "#pipeline", message: 'Starting to build ${branch} for ${name}', botUser: true, color: 'good')
}
如何将这些 webhook 变量添加到我的构建环境变量中?
试试这个:
steps {
slackSend(channel: "#pipeline", message: 'Starting to build ${params.branch} for ${params.name}', botUser: true, color: 'good')
}
Guerrilla 在评论中回答了这个问题,但解决方法是使用双引号而不是单引号,如下所示:
steps {
slackSend(channel: "#pipeline", message: "Starting to build ${branch} for ${name}", botUser: true, color: 'good')
}