1
0
Fork 0

draft for agent installer

This commit is contained in:
Christian Kühnel 2019-12-16 16:45:06 +00:00
parent ffb70a2922
commit d4702d1c3f

View file

@ -13,23 +13,53 @@
# 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 EphemeralDisk").Number New-Variable -Name diskid -Value (Get-Disk -FriendlyName "NVMe nvme_card").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..."
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) ; `
choco feature disable --name showDownloadProgress
Write-Host "Installing Visual Studio build tools..."
choco install visualcpp-build-tools `
--version 15.0.26228.20170424 -y --params "'/IncludeOptional'" ;`
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
# and a few more that were not documented...
choco install -y git python2 ninja gnuwin cmake
pip install psutil
Write-Host "Setting environment variables..."
$Env:PYTHONIOENCODING=UTF-8
$Env:path = $Env:path + ';c:\Program Files (x86)\GnuWin32\bin;C:\Program Files\CMake\bin'
# support long file names during git checkout
Write-Host "Setting git config..."
git config --system core.longpaths true
git config --global core.autocrlf false
# Above: genric LLVM-related things
#-------------
# Below: Jenkins specific things
Write-Host "Installing openjdk..."
RUN 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"
$SWARM_PLUGIN_JAR="C:\jenkins\swarm-client.jar"
mkdir c:\jenkins
Invoke-WebRequest -Uri $SWARM_PLUGIN_URL -OutFile $SWARM_PLUGIN_JAR
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
Write-Host "Authenticating with gcloud..."
# TODO: make this quiet and non-interactive
# TODO: check if this works if it's already installed
gcloud components install docker-credential-gcr
docker-credential-gcr configure-docker
Write-Host "Launching docker container, this might take a while..."
docker pull gcr.io/llvm-premerge-checks/agent-windows-jenkins:latest
docker run -it -v D:\:C:\ws -v E:\results:C:\results gcr.io/llvm-premerge-checks/agent-windows-jenkins:latest