为什么我的OpenShift构建跨不同项目构建正常,但验证会引发异常?

时间:2018-06-15 09:27:31

标签: jenkins openshift jenkins-pipeline

在OpenShift中,我有一个Jenkins实例在项目上运行(my-jenkins-project),我在不同的项目(my-test-project)中有一个构建(my-openshift-build),它构建但是验证失败。构建工作,但验证失败。为什么呢?

詹金斯档案      sh" oc start-build my-openshift-build --from-file = target / my-openshift-build.jar -n my-test-project"         openshiftVerifyBuild apiURL:'',authToken:'',bldCfg:' my-openshift-build',checkForTriggeredDeployments:' false',命名空间:'',详细:' false',waitTime:' 40',waitUnit:' min'

Starting the "Verify OpenShift Build" step with build config "my-openshift-build" from the project "my-jenkins-project".
Waiting on build "null" to complete ...
Operation will timeout after 2400000 milliseconds 
java.lang.ClassCastException: com.openshift.internal.restclient.model.List cannot be cast to com.openshift.restclient.model.IBuild

1 个答案:

答案 0 :(得分:0)

在非交叉项目Jenkins实例 - 构建中,您不必在openshiftVerifyBuild中设置namespace参数,但在这种情况下,您可以使用Jenkins管道。

只需在openshiftVerifyBuild步骤中添加目标命名空间即可,在这种情况下:

    openshiftVerifyBuild apiURL: '', authToken: '', bldCfg: 'my-openshift-build ', checkForTriggeredDeployments: 'false', namespace: 'my-test-project', verbose: 'false', waitTime: '40', waitUnit: 'min'