启用带有选项“直到完成为止的块构建”的远程作业时,Jenkins Pipeline失败

时间:2019-04-25 09:56:55

标签: jenkins groovy jenkins-plugins

我创建了一个管道,该管道应触发其他Jenkinsserver上的作业。 我使用远程触发器插件,并且可以使用以下语句来触发Job(当前这是我的管道中唯一的语句):

triggerRemoteJob enhancedLogging: true, job: 'myJob', maxConn: 1,     remoteJenkinsName: 'MyJenkins'

但是在触发作业后,管道会尝试在本地主机上运行的作业中连接作业,这显然会失败。

我尝试禁用一些选项,发现如果禁用blockBuildUntilComplete,该选项将起作用。

在启用了选项的情况下,我从日志中获取以下信息:

##############################################################################    ##################################

  Parameterized Remote Trigger Configuration:

    - job:                     myJob 

    - remoteJenkinsName:       myJenkins

    - parameters:              

    - blockBuildUntilComplete: true

    - connectionRetryLimit:    5

################################################################################################################

Triggering non-parameterized remote job 'http://x.x.x.x:8080/job/myJob'

  Using globally defined 'Credentials Authentication' as user 'myUser' (Credentials ID 'myCredentials')

Triggering remote job now.

CSRF protection is disabled on the remote server.

  Remote job queue number: 47

Remote build started!

  Remote build URL: http://localhost:8080/job/myJob /8/

  Remote build number: 8

Blocking local job until remote job completes.

calling remote without locking...

Connection to remote server failed , waiting for to retry - 10 seconds until next attempt. URL: http://localhost:8080/job/myJob /8/api/json/, parameters: 

Retry attempt #1 out of 5

Connection to remote server failed , waiting for to retry - 10 seconds until next attempt. URL: http://localhost:8080/job/myJob /8/api/json/, parameters: 

Retry attempt #2 out of 5

Connection to remote server failed , waiting for to retry - 10 seconds until next attempt. URL: http://localhost:8080/job/myJob /8/api/json/, parameters: 

Retry attempt #3 out of 5

Connection to remote server failed , waiting for to retry - 10 seconds until next attempt. URL: http://localhost:8080/job/myJob /8/api/json/, parameters: 

Retry attempt #4 out of 5

Connection to remote server failed , waiting for to retry - 10 seconds until next attempt. URL: http://localhost:8080/job/myJob /8/api/json/, parameters: 

Retry attempt #5 out of 5

Max number of connection retries have been exeeded.

我更改了Jenkins服务器的名称和IP地址。

我必须在完成远程作业后执行一些步骤,具体取决于其结果。所以我必须等到工作完成。

有没有阻止选项的方法吗?或者我必须怎么做才能使选项起作用?

1 个答案:

答案 0 :(得分:0)

我检查了插件的发布,发现3.0.8版有一个改进,称为“延长POST超时并避免在超时后重新发布”。 我对更改进行了审查,因为就我们的问题而言,它看起来不错,因此我将插件(v3.0.7)更新为当前版本。 现在错误不再出现。