1
0
Fork 0

update of scripts for native windows agent

This commit is contained in:
Christian Kühnel 2019-12-16 18:56:02 +00:00
parent 1127782f09
commit adf51c6551
4 changed files with 135 additions and 112 deletions

View file

@ -1,33 +1,33 @@
#!/bin/bash #!/bin/bash
# Copyright 2019 Google LLC # Copyright 2019 Google LLC
# #
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); # 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 not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# #
# https://llvm.org/LICENSE.txt # https://llvm.org/LICENSE.txt
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
set -eux set -eux
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ROOT_DIR="$(dirname ${DIR})" ROOT_DIR="$(dirname ${DIR})"
# get config options # get config options
# shellcheck source=../k8s_config # shellcheck source=../k8s_config
source "${ROOT_DIR}/k8s_config" source "${ROOT_DIR}/k8s_config"
NAME=agent-windows-2 NAME=agent-windows-2
gcloud beta compute instances create "${NAME}" \ gcloud beta compute instances create "${NAME}" \
--project="${GCP_PROJECT}" \ --project="${GCP_PROJECT}" \
--zone="${GCP_ZONE}" \ --zone="${GCP_ZONE}" \
--machine-type=n1-highcpu-32 \ --machine-type=n1-highcpu-32 \
--local-ssd=device-name=local-ssd-0 \ --local-ssd=device-name=local-ssd-0 \
--image=windows-server-2019-dc-v20191210 \ --image=windows-server-2019-dc-v20191210 \
--image-project=windows-cloud \ --image-project=windows-cloud \
--boot-disk-size=100GB --boot-disk-size=100GB

View file

@ -1,33 +1,33 @@
# Copyright 2019 Google LLC # Copyright 2019 Google LLC
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); # 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 not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# https://llvm.org/LICENSE.txt # https://llvm.org/LICENSE.txt
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
Write-Host "Initializing local SSD..." Write-Host "Initializing local SSD..."
New-Variable -Name diskid -Value (Get-Disk -FriendlyName "Google PersistentDisk").Number New-Variable -Name diskid -Value (Get-Disk -FriendlyName "Google PersistentDisk").Number
# TODO: check if machine has an SSD # TODO: check if machine has an SSD
# TODO: only do this, if SSD is not yet usable # TODO: only do this, if SSD is not yet usable
Initialize-Disk -Number $diskid Initialize-Disk -Number $diskid
New-Partition -DiskNumber $diskid -UseMaximumSize -AssignDriveLetter New-Partition -DiskNumber $diskid -UseMaximumSize -AssignDriveLetter
Format-Volume -DriveLetter D Format-Volume -DriveLetter D
Write-Host "install chocolately as package manager..." Write-Host "install chocolately as package manager..."
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
choco feature disable --name showDownloadProgress choco feature disable --name showDownloadProgress
choco install git choco install git
Write-Host "Mounting result storage..." Write-Host "Mounting result storage..."
Install-WindowsFeature NFS-Client Install-WindowsFeature NFS-Client
net use E: \\results.local\exports net use E: \\results.local\exports /PERSISTENT:YES
Set-Location D:\ Set-Location D:\
git clone https://github.com/google/llvm-premerge-checks git clone https://github.com/google/llvm-premerge-checks

View file

@ -1,47 +1,48 @@
# Copyright 2019 Google LLC # Copyright 2019 Google LLC
# Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); # 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 not use this file except in compliance with the License.
# You may obtain a copy of the License at # You may obtain a copy of the License at
# https://llvm.org/LICENSE.txt # https://llvm.org/LICENSE.txt
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, # distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
. ${PSScriptRoot}\common.ps1
Write-Host "Installing Visual Studio build tools..."
choco install visualcpp-build-tools --version 15.0.26228.20170424 -y --params "'/IncludeOptional'" Write-Host "Installing Visual Studio build tools..."
Write-Host 'Waiting for Visual C++ Build Tools to finish' choco install -y visualcpp-build-tools --version 15.0.26228.20170424 -y --params "'/IncludeOptional'"
Wait-Process -Name vs_installer Write-Host 'Waiting for Visual C++ Build Tools to finish'
Wait-Process -Name vs_installer
Write-Host "Installing misc tools"
# install other tools as described in https://llvm.org/docs/GettingStartedVS.html Write-Host "Installing misc tools"
# and a few more that were not documented... # install other tools as described in https://llvm.org/docs/GettingStartedVS.html
choco install -y git python2 ninja gnuwin cmake # and a few more that were not documented...
pip install psutil choco install -y git python2 ninja gnuwin cmake
pip install psutil
Write-Host "Setting environment variables..."
$Env:PYTHONIOENCODING=UTF-8 Write-Host "Setting environment variables..."
$Env:path = $Env:path + ';c:\Program Files (x86)\GnuWin32\bin;C:\Program Files\CMake\bin' [System.Environment]::SetEnvironmentVariable('PYTHONIOENCODING', 'UTF-8', [System.EnvironmentVariableTarget]::User)
$oldpath=[System.Environment]::GetEnvironmentVariable('path',[System.EnvironmentVariableTarget]::User)
# support long file names during git checkout [System.Environment]::SetEnvironmentVariable('path', $oldpath + 'c:\Program Files (x86)\GnuWin32\bin;C:\Program Files\CMake\bin', [System.EnvironmentVariableTarget]::User)
Write-Host "Setting git config..." # support long file names during git checkout
git config --system core.longpaths true Write-Host "Setting git config..."
git config --global core.autocrlf false git config --system core.longpaths true
git config --global core.autocrlf false
# Above: genric LLVM-related things
#------------- # Above: genric LLVM-related things
# Below: Jenkins specific things #-------------
# Below: Jenkins specific things
Write-Host "Installing openjdk..."
choco install -y openjdk Write-Host "Installing openjdk..."
choco install -y openjdk
Write-Host "Installing Jenkins swarm agent..."
$SWARM_PLUGIN_URL="https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/3.17/swarm-client-3.17.jar" Write-Host "Installing Jenkins swarm agent..."
$SWARM_PLUGIN_JAR="C:\jenkins\swarm-client.jar" $SWARM_PLUGIN_URL="https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/3.17/swarm-client-3.17.jar"
mkdir c:\jenkins $SWARM_PLUGIN_JAR="C:\jenkins\swarm-client.jar"
Invoke-WebRequest -Uri $SWARM_PLUGIN_URL -OutFile $SWARM_PLUGIN_JAR mkdir c:\jenkins
Invoke-WebRequest -Uri $SWARM_PLUGIN_URL -OutFile $SWARM_PLUGIN_JAR

View file

@ -0,0 +1,22 @@
# 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.
. ${PSScriptRoot}\common.ps1
$JENKINS_SERVER="jenkins.local"
$AGENT_ROOT="D:\"
$SWARM_PLUGIN_JAR="C:\jenkins\swarm-client.jar"
java -jar ${SWARM_PLUGIN_JAR} -master http://${JENKINS_SERVER}:8080 -executors 1 -fsroot ${AGENT_ROOT} -labels windows