diff --git a/powershell/Jenkins-Windows-Init-Script-no-secrets.ps1 b/powershell/Jenkins-Windows-Init-Script-no-secrets.ps1 index 6b4499e..e27b756 100644 --- a/powershell/Jenkins-Windows-Init-Script-no-secrets.ps1 +++ b/powershell/Jenkins-Windows-Init-Script-no-secrets.ps1 @@ -30,11 +30,20 @@ $destSource = "d:\java\slave.jar" $wc = New-Object System.Net.WebClient $wc.DownloadFile($slaveSource, $destSource) -# execute slave -Write-Output "Executing slave process " +# execute agent +Write-Output "Executing agent process " $java="d:\java\zulu1.7.0_51-7.3.0.4-win64\bin\java.exe" $jar="-jar" $jnlpUrl="-jnlpUrl" $secretFlag="-secret" $serverURL=$jenkinsserverurl+"computer/" + $vmname + "/slave-agent.jnlp" -& $java $jar $destSource $secretFlag $secret $jnlpUrl $serverURL +while ($true) { + try { + # Launch + & $java -jar $destSource $secretFlag $secret $jnlpUrl $serverURL -noReconnect + } + catch [System.Exception] { + Write-Output $_.Exception.ToString() + } + Start-Sleep 10 +}