Friday, October 31, 2014

October cycling

The numbers for the month are 10604.7/745.6, plus 95.14 miles on cycling holiday or +171.8/+146.0 or 412.9 miles, so 3628 miles year-to-date, passing last year's total on the morning of the 19th, in continuing mild and dry weather, and with 4200 now looking like a good stretch goal for the year.

The numbers were slightly helped by the incentive of the Cambridge Cycle Challenge, in which I came second for the district as an intermediate rider, and was also in second place in the work team. Never before had I been paid for making that extra ride to the pub! But it was also helped by continuing balmy weather -- T-shirt and shorts even in the middle of the month.

That included the first day of an autumn cycling holiday, which was another Constable Country pub-crawl, ambling to the Tattingstone White Horse (under new management, so a bit less looking like a bikers' pub) for lunch, the Bakers' Arms at Harkstead for a quick one, then the Sun Inn at Dedham to sample some of their wares (not so impressed by the Lushingtons) before settling down for the night.

Monday the weather was not so nice, but I decided to take a different tack this time, stopping at the Red Rose in Lindsey Tye (which has a cycle stand!), then across to the Maglia Rosso (which I'd not tried back in July) for some cake and hot chocolate, en route to which, the front dérailleur jammed in middle gear; before making the usual detour to the Cherry Tree in Glemsford (sampling the rather potent Redemption Brewery Urban Dusk), then a different route to Lavenham (avoiding Shimpling in favour of Long Melford, via a B road that emerges just before the 30 limit).

Evening sun

Evening sunshine, Sunday

Offton, village sign

Village Sign

Bizarre house sign

How Bizarre!

Between mechanical problems, and the remnants of Hurricane Gonzalo, bringing strong winds and heavy showers, I then wimped out, and got taken back to base rather than spend a few hours being driven before the wind.

Thursday, October 02, 2014

Configuring Jenkins with PowerShell

No sooner do I say I have nothing technical to write up of general interest, than I spend a day stitching together pieces across the internet, because most Jenkins examples tend to be written to *nix or the JVM, and I'm on Windows where the admin tool of choice is PowerShell.

So, start on the Jenkins wiki page for Authenticating scripted clients, which tells you how to get your API key -- visit $(JENKINS_URL)/me/configure in your browser and look for the API token so you don't have to script your password (especially if you're using AD authentication on the server). Setting username/API Token as a Credentials object on a WebClient will just get you 403 errors, until you notice that the Groovy script example sets pre-emptive auth on its web client. The secret to HTTP Authorization and .NET WebRequest, WebClient Classes needs to be sought separately.

At this point you can GET from $(JENKINS_URL)/job/[job name]/config.xml, with DownloadString and cast to [xml] PowerShell style to read and modify.

Then you have to POST the modified XML back; but if you just do that with the Basic auth header, suddenly more 403 out of nowhere, until you read the small print about the Jenkins Remote access API about CSRF protection. When you get that and add it to your headers, it's now just a case of using UploadString to push the xml as xml.

Putting it all together we get

This appears to correctly preserve line endings as is, so you don't need to do anything non-default, equivalent to the --data-binary as you need for scripting with curl.