jenkins-autobuilder
jenkins-autobuilder copied to clipboard
No valid crumb was included in the request
Hi,
packer builds up to the point where it tries to install the plugins. Fails with this error:
amazon-ebs: Jenkins is up! Downloading plugins
amazon-ebs: 150K .......... .......... .......... .......... .......... 23% 36.3M 0s
amazon-ebs: There is some bug with the plugin installer so we have to follow procedure here https://gist.github.com/rowan-m/1026918
amazon-ebs: 200K .......... .......... .......... .......... .......... 29% 6.31M 0s
amazon-ebs: 250K .......... .......... .......... .......... .......... 34% 54.4M 0s
amazon-ebs: 300K .......... .......... .......... .......... .......... 40% 15.2M 0s
amazon-ebs: 350K .......... .......... .......... .......... .......... 46% 6.17M 0s
amazon-ebs: 400K .......... .......... .......... .......... .......... 52% 155M 0s
amazon-ebs: 450K .......... .......... .......... .......... .......... 58% 176M 0s
amazon-ebs: 500K .......... .......... .......... .......... .......... 64% 181M 0s
amazon-ebs: 550K .......... .......... .......... .......... .......... 69% 183M 0s
amazon-ebs: 600K .......... .......... .......... .......... .......... 75% 156M 0s
amazon-ebs: 650K .......... .......... .......... .......... .......... 81% 181M 0s
amazon-ebs: 700K .......... .......... .......... .......... .......... 87% 181M 0s
amazon-ebs: 750K .......... .......... .......... .......... .......... 93% 178M 0s
amazon-ebs: 800K .......... .......... .......... .......... .......... 98% 159M 0s
amazon-ebs: 850K ......... 100% 145M=0.03s
amazon-ebs:
amazon-ebs: 2016-10-03 19:48:30 (27.0 MB/s) - ‘jenkins-cli.jar’ saved [879628/879628]
amazon-ebs:
amazon-ebs: % Total % Received % Xferd Average Speed Time Time Time Current
amazon-ebs: Dload Upload Total Spent Left Speed
amazon-ebs: 100 264 100 264 0 0 608 0 --:--:-- --:--:-- --:--:-- 608
amazon-ebs: 100 248 100 248 0 0 383 0 --:--:-- --:--:-- --:--:-- 383
amazon-ebs: 100 253 100 253 0 0 208 0 0:00:01 0:00:01 --:--:-- 0
amazon-ebs: 100 1090k 100 1090k 0 0 56547 0 0:00:19 0:00:19 --:--:-- 53136
amazon-ebs: % Total % Received % Xferd Average Speed Time Time Time Current
amazon-ebs: Dload Upload Total Spent Left Speed
amazon-ebs: 100 1090k 100 384 100 1090k 1274 3619k --:--:-- --:--:-- --:--:-- 3621k
amazon-ebs: <html>
amazon-ebs: <head>
amazon-ebs: <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
amazon-ebs: <title>Error 403 No valid crumb was included in the request</title>
amazon-ebs: </head>
amazon-ebs: <body><h2>HTTP ERROR 403</h2>
amazon-ebs: <p>Problem accessing /updateCenter/byId/default/postBack. Reason:
amazon-ebs: <pre> No valid crumb was included in the request</pre></p><hr><i><small>Powered by Jetty://</small></i><hr/>
amazon-ebs:
amazon-ebs: </body>
amazon-ebs: </html>
amazon-ebs:
amazon-ebs: ERROR: anonymous is missing the Overall/Read permission
==> amazon-ebs: Terminating the source AWS instance...
Have you seen this before and know how to fix this?
Cheers David
What version of jenkins are you running? I believe this code should still work for Jenkins 1.x, but not for 2.x.
If you're using 1.x then you can run packer with --debug and when it breaks, login into Jenkins and checkout the Global Security Options and see if the flag "Prevent Cross Site Request Forgery exploits" is checked.
If it's checked then that is probably what is causing the 403.
Ah right. Well, I've not changed anything, just ran it as is and hit this issue. If packer is just downloading the latest then that is probably Jenkins 2.
It's whatever version ubuntu is packaging in 14.04. https://github.com/philbert/jenkins-autobuilder/blob/master/scripts/jenkins-install.sh#L10
At a guess it's probably still 1.x. I believe that it is likely this change which causes the problem and was introduced after my last commit in this repo.
If you want to get it working I'd suggest 2 different way to go about it:
- Find where in the jenkins config.xml the csrf check can be disabled and add those lines before starting the service.
- The better way would be to keep the csrf check in place and use something else than localhost here when trying to install the plugins. Just make sure you don't leave anything behind that might break the portability of the ami you're building.