windows: Redirect slave-agent.jnlp to internal DNS.
@@ -70,12 +70,10 @@ Start-Process -Wait $anaconda3_installer -ArgumentList "/AddToPath=0? /Installat
$webclient=(New-Object Net.WebClient)
$webclient.Headers.Add("Metadata-Flavor", "Google")
$jenkins_node=$webclient.DownloadString("http://metadata/computeMetadata/v1/instance/attributes/jenkins_node")
-if ($jenkins_node -match '.*-staging$') {$jenkins_master='jenkins-staging'}
-else {$jenkins_master='jenkins'}
+$jenkins_master='jenkins.c.bazel-public.internal'
-# Save the Jenkins slave.jar and slave-agent.jnlp to a suitable location.
+# Save the Jenkins slave.jar to a suitable location.
Invoke-WebRequest http://${jenkins_master}/jnlpJars/slave.jar -OutFile slave.jar
-Invoke-WebRequest http://${jenkins_master}/computer/${jenkins_node}/slave-agent.jnlp -OutFile slave-agent.jnlp
# Install the necessary packages in msys2
$bash_installer=@'
@@ -111,6 +109,12 @@ cmd.exe /C mklink /j C:\bazel_ci\installs\latest $folder
# Also use the latest release for bootstrapping
cmd.exe /C mklink /j C:\bazel_ci\installs\bootstrap $folder
+# Replace the host name in the JNLP file, because Jenkins, in its infinite
+# wisdom, does not let us change that separately from its external hostname.
+$jnlp=((New-Object Net.WebClient).DownloadString("http://${jenkins_master}/computer/${jenkins_node}/slave-agent.jnlp"))
+$jnlp=$jnlp -replace "https://ci.bazel.build", "http://${jenkins_master}"
+Write-Output $jnlp | Out-File -Encoding ascii slave-agent.jnlp
+
# Create the service that runs the Jenkins slave
# We can't execute Java directly because then it mysteriously fails with
# "Sockets error: 10106: create", so we redirect through Powershell
