我们的Jenkins服务器有一个已经运行了三天的作业,但是没有做任何事情。单击角落里的小X没有任何作用,控制台输出日志也没有显示任何内容。我在我们的构建服务器上检查过,该作业实际上似乎根本没有在运行。
有没有办法告诉jenkins工作已经“完成”了,比如编辑一些文件或锁之类的?因为我们有很多任务,所以我们并不想重新启动服务器。
我们的Jenkins服务器有一个已经运行了三天的作业,但是没有做任何事情。单击角落里的小X没有任何作用,控制台输出日志也没有显示任何内容。我在我们的构建服务器上检查过,该作业实际上似乎根本没有在运行。
有没有办法告诉jenkins工作已经“完成”了,比如编辑一些文件或锁之类的?因为我们有很多任务,所以我们并不想重新启动服务器。
当前回答
如果“X”按钮不起作用,作业被卡住,那么只需删除特定的版本号。这将解放遗嘱执行人。
在我的例子中,即使工作完成了,它仍然停留在执行者几个小时。删除构建对我来说是有效的。
其他回答
进入蓝海用户界面。 试着从那里阻止他。
同样的问题已经发生在我身上两次了,唯一的解决方案是重新启动tomcat服务器并重新启动构建。
在https://my-jenkins/script上使用脚本控制台
import hudson.model.Job
import org.jenkinsci.plugins.workflow.job.WorkflowRun
Collection<Job> jobs = Jenkins.instance.getItem('My-Folder').getAllJobs()
for (int i = 0; i < jobs.size(); i++) {
def job = jobs[i]
for (int j = 0; j < job.builds.size(); j++) {
WorkflowRun build = job.builds[j]
if (build.isBuilding()) {
println("Stopping $job ${build.number}")
build.setResult(Result.FAILURE)
}
}
}
非常简单的解决方案
我看到这个问题的原因是页面上不正确的http链接,而不是应该停止工作的https。所有你需要做的是编辑onclick属性在html页面,通过以下
Open up a console log of the job (pipeline) that got hang Click whatever is available to kill the job (x icon, "Click here to forcibly terminate running steps" etc) to get "Click here to forcibly kill entire build" link visible (it's NOT gonna be clickable at the moment) Open the browser's console (use any one of three for chrome: F12; ctrl + shift + i; menu->more tools->developer tools) Locate "Click here to forcibly kill entire build" link manually or using "select an element in the page" button of the console Double click on onclick attribute to edit its value Append s to http to have https Press enter to submit the changes Click "Click here to forcibly kill entire build" link
使用截图作为参考
以下是我在2.100版本中使用Blue Ocean解决这个问题的方法
我唯一安装的插件是bitbucket。 我只有一个节点。
ssh到我的Jenkins盒子里 cd ~ /。詹金斯(我放詹金斯的地方) cd工作/ < job_name > /分支/ < problem_branch_name > /构建 Rm -rf <build_number>
在此之后,您可以选择在nextBuildNumber中更改数字(我这样做) 最后,我重新启动jenkins (brew services restart jenkins),这一步显然会有所不同,这取决于您如何管理和安装jenkins。