diff --git a/containers/agent-windows-jenkins/Dockerfile b/containers/agent-windows-jenkins/Dockerfile index 0a84853..f1aff8b 100644 --- a/containers/agent-windows-jenkins/Dockerfile +++ b/containers/agent-windows-jenkins/Dockerfile @@ -14,13 +14,12 @@ RUN powershell -NoProfile -InputFormat None -Command ` Invoke-WebRequest -Uri %SWARM_PLUGIN_URL% -OutFile %SWARM_PLUGIN_JAR% # install gsutils to access Google Cloud Storage -RUN powershell -NoProfile -InputFormat None -Command ` - (New-Object Net.WebClient).DownloadFile("https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe", "$env:Temp\GoogleCloudSDKInstaller.exe") ; ` - & $env:Temp\GoogleCloudSDKInstaller.exe ; ` - del $env:Temp\GoogleCloudSDKInstaller.exe +RUN pip install gsutil VOLUME C:\credentials + +# temporary directory, can be mounted on host if required VOLUME C:\Temp # start swarm plugin -COPY start_agent.bat c:\jenkins -CMD c:\jenkins\start_agent.bat \ No newline at end of file +COPY start_agent.ps1 c:\jenkins +CMD powershell c:\jenkins\start_agent.ps1 \ No newline at end of file diff --git a/containers/agent-windows-jenkins/start_agent.bat b/containers/agent-windows-jenkins/start_agent.bat deleted file mode 100644 index ef39ff2..0000000 --- a/containers/agent-windows-jenkins/start_agent.bat +++ /dev/null @@ -1,26 +0,0 @@ -@rem Copyright 2019 Google LLC -@rem -@rem Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); -@rem you may not use this file except in compliance with the License. -@rem You may obtain a copy of the License at -@rem -@rem https://llvm.org/LICENSE.txt -@rem -@rem Unless required by applicable law or agreed to in writing, software -@rem distributed under the License is distributed on an "AS IS" BASIS, -@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -@rem See the License for the specific language governing permissions and -@rem limitations under the License. - -set JENKINS_SERVER=jenkins.local - -set AGENT_ROOT=C:\ws -set WORKSPACE=%AGENT_ROOT%\workspace - -@rem authenticate gsutil -gcloud auth activate-service-account --key-file C:\credentials\build-agent-results_key.json - -set TEMP=C:\TEMP -set TMP=%TEMP% - -java -jar %SWARM_PLUGIN_JAR% -master http://%JENKINS_SERVER%:8080 -executors 1 -fsroot %AGENT_ROOT% -labels windows \ No newline at end of file diff --git a/containers/agent-windows-jenkins/start_agent.ps1 b/containers/agent-windows-jenkins/start_agent.ps1 new file mode 100644 index 0000000..376d1ae --- /dev/null +++ b/containers/agent-windows-jenkins/start_agent.ps1 @@ -0,0 +1,31 @@ +# Copyright 2019 Google LLC +# +# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://llvm.org/LICENSE.txt +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +$JENKINS_SERVER="jenkins.local" + +$AGENT_ROOT="C:\ws" + +# authenticate gsutil +# gcloud auth activate-service-account --key-file C:\credentials\build-agent-results_key.json +Write-Output "C:\credentials\build-agent-results_key.json`nllvm-premerge-checks`n`n" | gsutil config -e + +$env:TEMP="C:\TEMP" +$env:TMP="${env:TEMP}" + +java -jar ${env:SWARM_PLUGIN_JAR} ` + -master http://${JENKINS_SERVER}:8080 ` + -executors 1 ` + -fsroot ${AGENT_ROOT} ` + -labels windows ` + -name ${env:PARENT_HOSTNAME} \ No newline at end of file diff --git a/containers/build_run.ps1 b/containers/build_run.ps1 index b0b3175..1c3e5ca 100644 --- a/containers/build_run.ps1 +++ b/containers/build_run.ps1 @@ -29,7 +29,7 @@ If ($LastExitCode -ne 0) { } # mount a persistent workspace for experiments -docker run -it -v D:\:C:\ws -v C:\credentials:C:\credentials $IMAGE_NAME $CMD +docker run -it -v D:\:C:\ws -v C:\credentials:C:\credentials -e PARENT_HOSTNAME=$env:computername $IMAGE_NAME $CMD If ($LastExitCode -ne 0) { exit } \ No newline at end of file