Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Trigger Remote Parameterised Job failed with Exceed Retry Limits after 1st try - mentions CSRF

I have a pipeline that triggers a remote job and then when its done, posts to a web hook - PipelineA

I have 2 other pipelines that trigger PipelineA, PipelineB and PipelineC.

PipelineB triggers PipelineA and it successfully invokes the job.

However PipelineC triggers PipelineA and the invoking of the remote job fails almost immediately with this error

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

  Parameterized Remote Trigger Configuration:
    - job:                     #REDACTED# 
    - remoteJenkinsName:       {pre configured remote jenkins}
    - parameters:              [myVariousParams=myParams,MyOtherParams=Other]
    - blockBuildUntilComplete: true
    - connectionRetryLimit:    5
    - trustAllCertificates:    false

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

Triggering parameterized remote job '#REDACTED#'

  Using globally defined 'Credentials Authentication' as user '#REDACTED#' (Credentials ID '{ID}')

Triggering remote job now. CSRF protection is enabled on the remote server. ERROR: Remote build failed with 'ExceedRetryLimitException' for the following reason: 'Max number of connection retries have been exeeded.'.

org.jenkinsci.plugins.ParameterizedRemoteTrigger.exceptions.ExceedRetryLimitException: Max number of connection retries have been exeeded.  at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.sendHTTPCall(HttpHelper.java:562)  at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.tryCall(HttpHelper.java:596)   at org.jenkinsci.plugins.ParameterizedRemoteTrigger.utils.HttpHelper.tryPost(HttpHelper.java:611)   at org.jenkinsci.plugins.ParameterizedRemoteTrigger.RemoteBuildConfiguration.performTriggerAndGetQueueId(RemoteBuildConfiguration.java:664)     at org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep$Execution.run(RemoteBuildPipelineStep.java:273)    at org.jenkinsci.plugins.ParameterizedRemoteTrigger.pipeline.RemoteBuildPipelineStep$Execution.run(RemoteBuildPipelineStep.java:249)    at org.jenkinsci.plugins.workflow.steps.SynchronousNonBlockingStepExecution.lambda$start$0(SynchronousNonBlockingStepExecution.java:47)     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)  at java.util.concurrent.FutureTask.run(FutureTask.java:266)     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)  at java.lang.Thread.run(Thread.java:748)

ExceedRetryLimitException: Max number of connection retries have been exeeded.

I just cannot fathom why this works from one pipeline and not the other.

PipelineB and PipelineC live in the same folder they have no extra configuration other than some parameters that are passed through to the sub jobs

Any help would be appreacited

like image 466
Dave Avatar asked Jan 25 '23 14:01

Dave


1 Answers

I was tempted to delete this when I figured it out, but I thought I'll leave the answer for others who may have this issue.

The Remote 'job' I was triggering in Pipeline A. Has some parameters, one being a choice parameter.

Both pipeline B and C are passing parameters through the chain to the remote job (essentially mirroring the remote job)

Pipeline B - the one that works - was passing a parameter through to the remote job that was a valid option in the choice parameter

Pipeline C - the one that didn't work - was passing an invalid option for the choice parameter in the remote job

It was this 'invalid' choice that was causing the job to get rejected immediately and not retry.

Edit (March 2020): So overtime with using this plugin I've noticed that it seems to report any issue invoking the remote job as 'exceeded retry limit' - which is a pain since it confuses people and also hides what is really wrong. I have found in certain occasions that more information can be found in the 'local' jenkins logs, this can often contain a lot more information on what was returned from the remote jenkins instance. The remote jenkins instance's logs may have info too, but in my case I didn't have access to them, so I couldn't check - hope the extra info may help other weary travelers

like image 138
Dave Avatar answered Feb 07 '23 09:02

Dave