Hello everyone,
I'm trying to set up a Chef recipe to install and manage a Jenkins server.
So far I can get the server installed and manage it's config so that it
listens on port 80.
My problem right now is that I can't get it to scripts it's way through the
initial administrator password so I can actually access the server.
So far I have the script blow that can find the password and submit the web
page back to Jenkins, but Jenkins always claims the password is incorrect.
Is there any easier way to get this done than scraping Jenkins' web pages?
Maybe a way to avoid this password screen after install entirely?
Thanks,
Bill
$hostName = $env:computername
if(-not (Test-Path 'C:\Program Files
(x86)\Jenkins\secrets\initialAdminPassword'))
{
exit -1
} else {
$password = Get-Content 'C:\Program Files
(x86)\Jenkins\secrets\initialAdminPassword'
}
$loginPage = Invoke-WebRequest -Uri "http://$hostName/login?from%2f
<http://$hostname/login?from%2f>" -UseBasicParsing -SessionVariable session
$xmlPage = ([xml]$loginPage.Content)
$xmlPage.SelectNodes('//input[@name = "j_password"]').setAttribute('value',
$password)
$actionPath = $xmlPage.SelectNodes('//form').action
$responsePage = Invoke-WebRequest -Uri "http://$hostName/$actionPath
<http://$hostname/$actionPath>" -UseBasicParsing -WebSession $session -Body
($xmlPage.SelectNodes('//input').OuterXML) -Method Post
--
You received this message because you are subscribed to the Google Groups
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/jenkinsci-users/3759bfc9-0180-40e4-a30c-5c3df67701d8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.