Last active
August 29, 2015 14:05
-
-
Save snallami/ad44c109928e86c03e1b to your computer and use it in GitHub Desktop.
Hudson JNLP init script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-ExecutionPolicy Unrestricted | |
# Hudson plugin will dynamically pass the server name and vm name. | |
$hudsonserverurl = $args[0] | |
$vmname = $args[1] | |
# Download the file to a specific location | |
Write-Output "Downloading zulu SDK " | |
$source = "http://azure.azulsystems.com/zulu/zulu1.7.0_51-7.3.0.4-win64.zip?jenkins" | |
mkdir c:\azurecsdir | |
$destination = "c:\azurecsdir\zuluJDK.zip" | |
$wc = New-Object System.Net.WebClient | |
$wc.DownloadFile($source, $destination) | |
Write-Output "Unzipping JDK " | |
# Unzip the file to specified location | |
$shell_app=new-object -com shell.application | |
$zip_file = $shell_app.namespace($destination) | |
mkdir c:\java | |
$destination = $shell_app.namespace("c:\java") | |
$destination.Copyhere($zip_file.items()) | |
Write-Output "Successfully downloaded and extracted JDK " | |
# Downloading hudson slaves jar | |
Write-Output "Downloading hudson slave jar " | |
$slaveSource = $hudsonserverurl + "jnlpJars/slave.jar" | |
$destSource = "c:\java\slave.jar" | |
$wc = New-Object System.Net.WebClient | |
$wc.DownloadFile($slaveSource, $destSource) | |
# execute slave | |
Write-Output "Executing slave process " | |
$java="c:\java\zulu1.7.0_51-7.3.0.4-win64\bin\java.exe" | |
$jar="-jar" | |
$jnlpUrl="-jnlpUrl" | |
$serverURL=$hudsonserverurl+"computer/" + $vmname + "/slave-agent.jnlp" | |
& $java $jar $destSource $jnlpUrl $serverURL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment