gpt4 book ai didi

continuous-integration - Hudson:一键运行 View 中的所有作业

转载 作者:行者123 更新时间:2023-12-04 21:25:56 26 4
gpt4 key购买 nike

有没有办法只按一个按钮就可以在一个 hudson 的 View 中运行所有作业?谢谢。

最佳答案

更新:这里是解决方案

编辑 View 的描述并将此代码粘贴到其中:

<script type="text/javascript">
<!--
function triggerBuilds(obj){
obj.responseText.evalJSON()['jobs'].each(
function(i){
new Ajax.Request(i['url']+'build',{method:'GET'});
}
);
}

function buildAll(){
new Ajax.Request(
document.URL.replace(/[\W]+$/,'') + '/api/json',
{
onSuccess : triggerBuilds,
method : 'GET'
}
);
}

//-->
</script>
<a href="javascript:buildAll();void(0)">Build all Jobs in this view</a>

这将创建一个链接,该链接使用 hudson 的 JSON api 在当前 View 中构建所有作业。 (仅适用于 View ,如果您想从其他地方使用它,则必须更改相对 URL)。

(此解决方案依赖于当前版本的 hudson 中存在的原型(prototype),但我不知道它存在多长时间,因此这可能不适用于旧版本)

或为此 URL 创建一个书签:
javascript:var%20f=function(obj){obj.responseText.evalJSON()['jobs'].each(function(i){new%20Ajax.Request(i['url']+'build',{method:'GET'});});};new%20Ajax.Request(document.URL.replace(/[\W]+$/,'')+'/api/json',{onSuccess:f,method:'GET'});void(0)

在您的书签菜单中并在您喜欢的任何 hudson View 上执行它

编辑:我有 elaborated on this answer on my weblog .

关于continuous-integration - Hudson:一键运行 View 中的所有作业,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3178967/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com