1
0
Fork 0

created windows agent container

This commit is contained in:
Christian Kühnel 2019-11-29 12:23:45 +00:00
parent 804d0ab083
commit d2be5e1011
4 changed files with 41 additions and 2 deletions

View file

@ -15,4 +15,4 @@ RUN powershell -NoProfile -InputFormat None -Command `
Set-ExecutionPolicy Bypass -Scope Process -Force ; `
iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/buildkite/agent/master/install.ps1'))
CMD "C:\buildkite-agent\bin\buildkite-agent.exe" start
CMD "C:\buildkite-agent\bin\buildkite-agent.exe" start

View file

@ -0,0 +1,18 @@
# escape=`
# use windows server core image
FROM gcr.io/llvm-premerge-checks/agent-windows
# install java
RUN choco install -y openjdk
# get Jenkins swarm plugin
ENV SWARM_PLUGIN_URL="https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/3.17/swarm-client-3.17.jar"
ENV SWARM_PLUGIN_JAR="C:\jenkins\swarm-client.jar"
RUN powershell -NoProfile -InputFormat None -Command `
mkdir c:\jenkins ; `
Invoke-WebRequest -Uri %SWARM_PLUGIN_URL% -OutFile %SWARM_PLUGIN_JAR%
# start swarm plugin
COPY start_agent.bat c:\jenkins
CMD c:\jenkins\start_agent.bat

View file

@ -0,0 +1,20 @@
@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.
JENKINS_SERVER=10.43.247.173
AGENT_ROOT=${WORKSPACE}\agent
mkdir %AGENT_ROOT%
java -jar %SWARM_PLUGIN_JAR% -master http://%JENKINS_SERVER%:8080 -executors 1 -fsroot %AGENT_ROOT% -labels windows

View file

@ -15,6 +15,7 @@
# define command line arguments
param(
[Parameter(Mandatory=$true)][string]$IMAGE_NAME,
[Parameter(Mandatory=$false)][string]$CMD="",
[string]$token
)
@ -29,7 +30,7 @@ If ($LastExitCode -ne 0) {
# mount a persistent workspace for experiments
New-Item -ItemType Directory -Force -Path $Env:USERPROFILE\workspace
docker run -it -v $Env:USERPROFILE\workspace:C:\ws --name $IMAGE_NAME $IMAGE_NAME
docker run -it -v $Env:USERPROFILE\workspace:C:\ws $IMAGE_NAME $CMD
If ($LastExitCode -ne 0) {
exit
}