启用选项 "Block Build Until Complete" 触发远程作业时,Jenkins Pipeline 失败
Jenkins Pipeline fails when triggering a remote job with option "Block Build Until Complete" is enabled
我创建了一个应该在不同的 Jenkins 服务器上触发作业的管道。
我使用 Remote Trigger Plug-in,我可以使用以下语句触发作业(目前这是我的管道中唯一的语句):
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 地址。
我必须在远程作业完成后执行一些步骤,具体取决于其结果。所以我必须等到工作完成。
有没有办法在没有阻止选项的情况下执行此操作,或者我必须做什么才能使该选项正常工作?
我检查了插件的发布,我发现了一个名为 "Extend POST timeout & avoid re-POST after timeout" 的版本 3.0.8 的改进
我审查了更改,因为它看起来很好地解决了我们的问题,我将我们的插件 (v3.0.7) 更新到当前版本。
现在错误不再出现。
我创建了一个应该在不同的 Jenkins 服务器上触发作业的管道。 我使用 Remote Trigger Plug-in,我可以使用以下语句触发作业(目前这是我的管道中唯一的语句):
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 地址。
我必须在远程作业完成后执行一些步骤,具体取决于其结果。所以我必须等到工作完成。
有没有办法在没有阻止选项的情况下执行此操作,或者我必须做什么才能使该选项正常工作?
我检查了插件的发布,我发现了一个名为 "Extend POST timeout & avoid re-POST after timeout" 的版本 3.0.8 的改进 我审查了更改,因为它看起来很好地解决了我们的问题,我将我们的插件 (v3.0.7) 更新到当前版本。 现在错误不再出现。