diff --git a/containers/agent-windows-buildkite/Dockerfile b/containers/agent-windows-buildkite/Dockerfile deleted file mode 100644 index ce9ab02..0000000 --- a/containers/agent-windows-buildkite/Dockerfile +++ /dev/null @@ -1,121 +0,0 @@ -# escape=` -FROM mcr.microsoft.com/dotnet/framework/sdk:4.8-windowsservercore-ltsc2019 - -# This docker image is run on manually maintained windows machines in 'llvm-premerge-check' cluster. - -# Restore the default Windows shell for correct batch processing. -SHELL ["cmd", "/S", "/C"] - -# Download the Build Tools bootstrapper. -ADD https://aka.ms/vs/16/release/vs_buildtools.exe C:\TEMP\vs_buildtools.exe - -# Download channel for fixed install. -ARG CHANNEL_URL=https://aka.ms/vs/16/release/channel -ADD ${CHANNEL_URL} C:\TEMP\VisualStudio.chman - -# Install Build Tools with C++ workload. -# - Documentation for docker installation -# https://docs.microsoft.com/en-us/visualstudio/install/build-tools-container?view=vs-2019 -# - Documentation on workloads -# https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-build-tools?view=vs-2019#c-build-tools -# - Documentation on flags -# https://docs.microsoft.com/en-us/visualstudio/install/use-command-line-parameters-to-install-visual-studio?view=vs-2019 -RUN C:\TEMP\vs_buildtools.exe --quiet --wait --norestart --nocache ` - --channelUri C:\TEMP\VisualStudio.chman ` - --installChannelUri C:\TEMP\VisualStudio.chman ` - --installPath C:\BuildTools ` - --add Microsoft.VisualStudio.Workload.VCTools ` - --add Microsoft.VisualStudio.Component.VC.ATL ` - --includeRecommended ` - || IF "%ERRORLEVEL%"=="3010" EXIT 0 - -# Register DIA dll (Debug Interface Access) so it can be used to symbolize -# the stack traces. Register dll for 32 and 64 bit. -# see https://developercommunity.visualstudio.com/content/problem/290674/msdia140dll-is-not-registered-on-vs2017-hosts.html -RUN regsvr32 /S "C:\BuildTools\DIA SDK\bin\amd64\msdia140.dll" & ` - regsvr32 /S "C:\BuildTools\DIA SDK\bin\msdia140.dll" - -# install chocolately as package manager -RUN powershell -NoProfile -InputFormat None -Command ` - iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) ; ` - choco feature disable --name showDownloadProgress - -# install tools as described in https://llvm.org/docs/GettingStartedVS.html -# and a few more that were not documented... -RUN choco install -y ninja git -# Pin an older version of Python; the current Python 3.10 fails when -# doing "pip install" for the other dependencies, as it fails to find libxml -# while compiling some package. -RUN choco install -y python3 --version 3.9.7 - -# ActivePerl is currently not installable via Chocolatey, see -# http://disq.us/p/2ipditb. Install StrawberryPerl instead. Unfortunately, -# StrawberryPerl not only installs Perl, but also a redundant C/C++ compiler -# toolchain, and a copy of pkg-config which can cause misdetections for other -# built products, see -# https://github.com/StrawberryPerl/Perl-Dist-Strawberry/issues/11 for further -# details. Remove the redundant and unnecessary parts of the StrawberryPerl -# install. -RUN choco install -y strawberryperl && ` - rmdir /q /s c:\strawberry\c && ` - del /q c:\strawberry\perl\bin\pkg-config* - -# libcxx requires clang(-cl) to be available -RUN choco install -y sccache llvm -RUN pip install psutil - -# install python dependencies for the scripts -RUN pip install -r https://raw.githubusercontent.com/google/llvm-premerge-checks/main/scripts/requirements.txt - -RUN curl -LO https://github.com/mstorsjo/llvm-mingw/releases/download/20230320/llvm-mingw-20230320-ucrt-x86_64.zip && ` - powershell Expand-Archive llvm-mingw-*-ucrt-x86_64.zip -DestinationPath . && ` - del llvm-mingw-*-ucrt-x86_64.zip && ` - ren llvm-mingw-20230320-ucrt-x86_64 llvm-mingw - -# configure Python encoding -ENV PYTHONIOENCODING=UTF-8 - -# update the path variable -# C:\Program Files\Git\usr\bin contains a usable bash and other unix tools. -# C:\llvm-mingw\bin contains Clang configured for mingw targets and -# corresponding sysroots. Both the 'llvm' package (with Clang defaulting -# to MSVC targets) and this directory contains executables named -# 'clang.exe' - add this last to let the other one have precedence. -# To use these compilers, use the triple prefixed form, e.g. -# x86_64-w64-mingw32-clang. -# C:\buildtools and SDK paths are ones that are set by c:\BuildTools\Common7\Tools\VsDevCmd.bat -arch=amd64 -host_arch=amd64 -RUN powershell -Command ` - [System.Environment]::SetEnvironmentVariable('PATH', ` - [System.Environment]::GetEnvironmentVariable('PATH', 'machine') + ';C:\Program Files\Git\usr\bin;C:\llvm-mingw\bin' ` - + ';C:\BuildTools\Common7\IDE\' ` - + ';C:\BuildTools\Common7\IDE\CommonExt ensions\Microsoft\TeamFoundation\Team Explorer' ` - + ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin' ` - + ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\Ninja' ` - + ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer' ` - + ';C:\BuildTools\Common7\IDE\CommonExtensions\Microsoft\TestWindow' ` - + ';C:\BuildTools\Common7\IDE\VC\VCPackages' ` - + ';C:\BuildTools\Common7\Tools\' ` - + ';C:\BuildTools\Common7\Tools\devinit' ` - + ';C:\BuildTools\MSBuild\Current\Bin' ` - + ';C:\BuildTools\MSBuild\Current\bin\Roslyn' ` - + ';C:\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX64\x64' ` - + ';C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools\x64\' ` - + ';C:\Program Files (x86)\Windows Kits\10\bin\10.0.19041.0\x64' ` - + ';C:\Program Files (x86)\Windows Kits\10\bin\x64' ` - + ';C:\Windows\Microsoft.NET\Framework64\v4.0.30319' ` - ,'machine') - -# use this folder to store the worksapce' -VOLUME C:\ws -WORKDIR C:\ws - -# support long file names during git checkout -RUN git config --system core.longpaths true & ` - git config --global core.autocrlf false - -RUN choco install -y handle -COPY start_agent.ps1 c:\scripts\ -COPY pre-checkout.ps1 c:\scripts\ -COPY pre-checkout.bat c:\buildkite-agent\hooks\ -COPY post-checkout.bat c:\buildkite-agent\hooks\ -CMD "powershell C:\scripts\start_agent.ps1" diff --git a/containers/agent-windows-buildkite/VERSION b/containers/agent-windows-buildkite/VERSION deleted file mode 100644 index 8abec46..0000000 Binary files a/containers/agent-windows-buildkite/VERSION and /dev/null differ diff --git a/containers/agent-windows-buildkite/build.ps1 b/containers/agent-windows-buildkite/build.ps1 deleted file mode 100644 index 530073a..0000000 --- a/containers/agent-windows-buildkite/build.ps1 +++ /dev/null @@ -1,25 +0,0 @@ -# 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. - -$ROOT_DIR=(Get-Item $PSScriptRoot).Parent.FullName -$IMAGE_NAME='agent-windows-buildkite' -$QUALIFIED_NAME='gcr.io/llvm-premerge-checks/agent-windows-buildkite' - -Write-Host "Building ${IMAGE_NAME}..." -docker build . -t "${IMAGE_NAME}" -docker tag "${IMAGE_NAME}" "${QUALIFIED_NAME}:latest" -docker tag "${IMAGE_NAME}" "${QUALIFIED_NAME}:stable" -Write-Host "to push image, run" -Write-Host "docker push ${QUALIFIED_NAME}:latest" -Write-Host "docker push ${QUALIFIED_NAME}:stable" \ No newline at end of file diff --git a/containers/agent-windows-buildkite/post-checkout.bat b/containers/agent-windows-buildkite/post-checkout.bat deleted file mode 100644 index 1825249..0000000 --- a/containers/agent-windows-buildkite/post-checkout.bat +++ /dev/null @@ -1,2 +0,0 @@ -echo "post-checkout" -powershell c:\llvm-premerge-checks\scripts\windows\post-checkout.ps1 diff --git a/containers/agent-windows-buildkite/pre-checkout.bat b/containers/agent-windows-buildkite/pre-checkout.bat deleted file mode 100644 index fad618c..0000000 --- a/containers/agent-windows-buildkite/pre-checkout.bat +++ /dev/null @@ -1,2 +0,0 @@ -REM TODO: use powershell shell for hooks directly -powershell c:\scripts\pre-checkout.ps1 \ No newline at end of file diff --git a/containers/agent-windows-buildkite/pre-checkout.ps1 b/containers/agent-windows-buildkite/pre-checkout.ps1 deleted file mode 100644 index fcb4da8..0000000 --- a/containers/agent-windows-buildkite/pre-checkout.ps1 +++ /dev/null @@ -1,28 +0,0 @@ -$srcDirectory = "c:\src" -$env:BUILDKITE_BUILD_CHECKOUT_PATH=$srcDirectory - -echo "unlocking git" -taskkill /F /IM git.exe -rm -Force "$env:BUILDKITE_BUILD_CHECKOUT_PATH/.git/index.lock" -echo "BUILDKITE_BUILD_CHECKOUT_PATH: $env:BUILDKITE_BUILD_CHECKOUT_PATH" -echo "BUILDKITE_BUILD_PATH: $env:BUILDKITE_BUILD_PATH" -echo 'running processes (before)' -Get-Process | Where-Object {$_.Path -like "$env:BUILDKITE_BUILD_PATH*"} | Select-Object -ExpandProperty Path -echo "unlocking $env:BUILDKITE_BUILD_PATH" -handle -nobanner $env:BUILDKITE_BUILD_CHECKOUT_PATH -c:\llvm-premerge-checks\scripts\windows\unlock_path.ps1 $env:BUILDKITE_BUILD_CHECKOUT_PATH -echo 'running processes (after)' -Get-Process | Where-Object {$_.Path -like "$env:BUILDKITE_BUILD_PATH*"} | Select-Object -ExpandProperty Path - -echo "BUILDKITE_REPO: $env:BUILDKITE_REPO" -if (Test-Path -Path $env:BUILDKITE_BUILD_CHECKOUT_PATH) { - Set-Location -Path $env:BUILDKITE_BUILD_CHECKOUT_PATH - $remoteUrl = git remote get-url origin - echo "current remote URL: $remoteUrl" - if ($remoteUrl -ne $env:BUILDKITE_REPO) { - Write-Host "Remote URL does not match. Deleting and recreating the directory." - Set-Location -Path "C:\" - Remove-Item -Path $env:BUILDKITE_BUILD_CHECKOUT_PATH -Recurse -Force - } -} - diff --git a/containers/agent-windows-buildkite/start_agent.ps1 b/containers/agent-windows-buildkite/start_agent.ps1 deleted file mode 100644 index 9b77fa5..0000000 --- a/containers/agent-windows-buildkite/start_agent.ps1 +++ /dev/null @@ -1,10 +0,0 @@ -c:\credentials\buildkite-env.ps1 -git clone https://github.com/google/llvm-premerge-checks.git c:\llvm-premerge-checks -# Install Buildkite agent. -iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/buildkite/agent/master/install.ps1')) -$env:SCCACHE_DIR="C:\ws\sccache" -$env:SCCACHE_IDLE_TIMEOUT="0" -Remove-Item -Recurse -Force -ErrorAction Ignore $env:SCCACHE_DIR -sccache --start-server - -C:\buildkite-agent\bin\buildkite-agent.exe start diff --git a/containers/buildkite-windows/start_agent.ps1 b/containers/buildkite-windows/start_agent.ps1 index 8ac3839..04bde57 100644 --- a/containers/buildkite-windows/start_agent.ps1 +++ b/containers/buildkite-windows/start_agent.ps1 @@ -4,6 +4,9 @@ git clone https://github.com/google/llvm-premerge-checks.git c:\llvm-premerge-ch # short as many tools break on Windows with paths longer than 250. $env:BUILDKITE_BUILD_CHECKOUT_PATH = "$env:BUILDKITE_BUILD_PATH\src" +# Exclude build path from Windows Defender. +Add-MpPreference -ExclusionPath "$env:BUILDKITE_BUILD_PATH" + # Install Buildkite agent. iex ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/buildkite/agent/master/install.ps1')) $env:SCCACHE_DIR="$env:BUILDKITE_BUILD_PATH\sccache"