简体   繁体   中英

Jenkins remote build with Parameterized Trigger Plugin failed

I am using Jenkins along with Parameterized Trigger Plugin for triggering a job remotely. The build trigger is failed with console output as below

Server returned HTTP response code: 403 for URL: http://x.x.x.x:8080/job/jobname/buildWithParameters?token=buildcommand&build&delay=0
Connection to remote server failed, waiting for to retry - 10 seconds until next attempt.
Retry attempt #1 out of 5
Server returned HTTP response code: 403 for URL: http://x.x.x.x:8080/job/jobname/buildWithParameters?token=buildcommand&build&delay=0
Connection to remote server failed, waiting for to retry - 10 seconds until next attempt.
ERROR: Remote build failed for the following reason:

The build with URL ' http://xxxx:8080/job/jobname/build?token=buildcommand&build&delay=0 ' from a browser is able to trigger the build remotely.

I only see the difference between two URL is one uses 'build' and other has 'buildWithParameters'.

Could you please help me to resolve the same.

Had the same issue where my remote jenkins was using credentials that were passed in by the master build. To fix it I had to disable CSRF protection on the target Jenkins:

  1. Log into your target Jenkins and go to Manage Jenkins
  2. Go to Configure Global Security
  3. Scroll down to Prevent Cross Site Request Forgery exploits
  4. Uncheck it
  5. Save changes

No need to restart Jenkins, just try the master job again.

Caveat: Obviously your Jenkins server is without CSRF protection... but it's probably safely behind a corporate firewall anyway, right?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM