Jenkins 构建如何区分 SCM 触发的构建和用户请求的构建?
如果有人通过 UI“立即构建”按钮请求构建,或者它是由 SCM 触发的,我希望我的构建表现不同(处理脚本需要知道)。我不想在用户界面中提供一个用户必须更改的复选框 - 我已经收到了他们对此类事情的强烈反对。问题是,无论构建是如何触发的,我设置的任何参数都具有相同的默认值。
I would like my builds to behave differently (a handling script needs to know) if a person requested the build through the UI "build now" button, or if it was triggered by SCM. I don't want to have to provide a checkbox in the UI that the users have to alter - I've already gotten blowback from them about such things. Trouble is, any parameter I set has the same default regardless of how the build is triggered.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
你不应该拥有一份行为不同的工作。如果您需要不同的行为,请为每个行为设置一个工作。在您的情况下,最好的选择是拥有 2 个单独的作业,一项用于 SCM 触发的构建,一项用于手动触发的构建。
有一个插件可以让您将作业过滤到单独的页面中(目前不记得名称了)。您可以在一个页面上设置所有 SCM 构建,在另一个页面上设置手动构建,然后将手动构建页面设置为登录时的默认页面。默认情况下,用户只能看到您想要手动触发的作业,但仍然可以通过选择其他页面来访问 SCM 触发的构建。
You should not really have 1 job with different behaviour. If you need different behaviour set up a job per behaviour. Best bet in your case is to have 2 separate jobs, one for the SCM triggered builds, and one for the manually triggered builds.
There's a plugin to allow you to filter jobs into separate pages (can't remember the name at the moment). You could set all SCM builds on 1 page and manual builds on another, then set the manual build page as the default one on login. Users will only see the jobs you want triggered manually by default, but can still access the SCM triggered builds by selecting the other page.
您能否在预构建期间(使用脚本)检查 SCM 轮询日志,然后从那里开始?
Could you somehow check the SCM polling log during the pre-build (with a script), and then go from there?