首页 > 解决方案 > jenkins pipeline groovy waitFor 执行命令,每5分钟超时一次

问题描述

下面是我的代码片段,每次执行5分钟,jenkins就会超时报错:</p>

                script{
                    def autotest_cmd = ["/usr/script/jenkins-autotest.py"].execute()
                    autotest_cmd.waitFor()
                    def autotest_cmd_output = autotest_cmd.in.text
                    def autotest_cmd_status = autotest_cmd.exitValue() 
                    if (autotest_cmd_status == 0) {
                        println "${autotest_cmd_output}"
                    }
                    }

以下是jenkins的错误信息:</p>

java.lang.InterruptedException
    at java.lang.Object.wait(Native Method)
    at java.lang.Object.wait(Object.java:502)
    at java.lang.UNIXProcess.waitFor(UNIXProcess.java:396)
    at sun.reflect.GeneratedMethodAccessor1581.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
    at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1213)
    at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
    at 

标签: jenkinsgroovyjenkins-pipeline

解决方案


推荐阅读