From 6dfeb6a728035eeec3dfa232c325ae4816218508 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Wed, 22 Jan 2020 13:19:31 +0100 Subject: [PATCH 01/26] using patch instead of "git apply" --- scripts/phabtalk/apply_patch2.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/phabtalk/apply_patch2.py b/scripts/phabtalk/apply_patch2.py index d436b2e..e5c20f4 100755 --- a/scripts/phabtalk/apply_patch2.py +++ b/scripts/phabtalk/apply_patch2.py @@ -78,7 +78,7 @@ class ApplyPatch: print('Checking out {}...'.format(base_revision)) self.repo.git.checkout(base_revision) print('Revision is {}'.format(self.repo.head.commit.hexsha)) - print('Cleanup...') + print('git reset, git cleanup...') self.repo.git.reset('--hard') self.repo.git.clean('-fdx') print('Analyzing {}'.format(diff_to_str(revision_id))) @@ -139,7 +139,7 @@ class ApplyPatch: """Download and apply a diff to the local working copy.""" print('Applying diff {} for revision {}...'.format(diff_id, diff_to_str(revision_id))) diff = self.phab.differential.getrawdiff(diffID=diff_id).response - proc = subprocess.run('git apply --whitespace=nowarn --binary -v', input=diff, shell=True, text=True, + proc = subprocess.run('patch -p1', input=diff, shell=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) if proc.returncode != 0: raise Exception('Applying patch failed:\n{}'.format(proc.stdout + proc.stderr)) From 275c2f81b1ea07d048ff67c569557d2a389351af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Wed, 22 Jan 2020 17:02:05 +0100 Subject: [PATCH 02/26] Updated boot strapping of windows agents --- docs/playbooks.md | 10 +++++- scripts/windows_agent_bootstrap.ps1 | 27 +++++++++++---- scripts/windows_agent_install.ps1 | 51 ----------------------------- scripts/windows_agent_start.ps1 | 28 +++++----------- 4 files changed, 37 insertions(+), 79 deletions(-) delete mode 100644 scripts/windows_agent_install.ps1 diff --git a/docs/playbooks.md b/docs/playbooks.md index 94d0c88..ec94176 100644 --- a/docs/playbooks.md +++ b/docs/playbooks.md @@ -120,7 +120,15 @@ To spawn a new windows agent: 1. In the RDP session: run these commands in the CMD window to start the docker container: ```cmd powershell -Invoke-WebRequest -uri 'https://raw.githubusercontent.com/google/llvm-premerge-checks/master/kubernetes/windows_agent_bootstrap.ps1' -OutFile windows_agent_bootstrap.ps1 +Invoke-WebRequest -uri 'https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/windows_agent_bootstrap.ps1' -OutFile windows_agent_bootstrap.ps1 +.\windows_agent_bootstrap.ps1 +``` +1. Wait for the machine to reboot, then login again and store the `gsutil` credentials in `build-agent-results_key`. +TODO: add documentation on how to create these. +1. run this script to start containers: +```cmd +powershell +Invoke-WebRequest -uri 'https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/windows_agent_start.ps1' -OutFile windows_agent_bootstrap.ps1 .\windows_agent_bootstrap.ps1 ``` diff --git a/scripts/windows_agent_bootstrap.ps1 b/scripts/windows_agent_bootstrap.ps1 index 276f3a5..7303644 100644 --- a/scripts/windows_agent_bootstrap.ps1 +++ b/scripts/windows_agent_bootstrap.ps1 @@ -12,10 +12,13 @@ # See the License for the specific language governing permissions and # limitations under the License. +# 1st stage of the installation process. +# This script only needs to be run once per machine. + Write-Host "Initializing local SSD..." New-Variable -Name diskid -Value (Get-Disk -FriendlyName "Google EphemeralDisk").Number # 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 partioned and formatted Initialize-Disk -Number $diskid New-Partition -DiskNumber $diskid -UseMaximumSize -AssignDriveLetter Format-Volume -DriveLetter D @@ -23,11 +26,21 @@ 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 -choco install git +choco install -y git -Write-Host "Mounting result storage..." -Install-WindowsFeature NFS-Client -net use E: \\results.local\exports /PERSISTENT:YES +# install Docker +Install-PackageProvider -Name NuGet -Force +Install-Module -Name DockerMsftProvider -Repository PSGallery -Force +Install-Package -Name docker -ProviderName DockerMsftProvider -Force +Set-Service -Name docker -StartupType Automatic -Set-Location D:\ -git clone https://github.com/google/llvm-premerge-checks +# install gcloud and authenticate access to gcr.io registry +# TODO: find a better way to install the Google Cloud SDK, avoid ingoring the checksum +choco install -y gcloudsdk --ignore-checksums +gcloud auth docker + +# move docker folder to SSD to get better IO performance +cmd /C "mklink /j C:\ProgramData\Docker D:\docker" + +# Reboot +Restart-Computer -Force diff --git a/scripts/windows_agent_install.ps1 b/scripts/windows_agent_install.ps1 deleted file mode 100644 index 46c3b40..0000000 --- a/scripts/windows_agent_install.ps1 +++ /dev/null @@ -1,51 +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. - -. ${PSScriptRoot}\common.ps1 - -Write-Host "Installing Visual Studio build tools..." -choco install -y 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..." -[System.Environment]::SetEnvironmentVariable('PYTHONIOENCODING', 'UTF-8', [System.EnvironmentVariableTarget]::User) -$oldpath=[System.Environment]::GetEnvironmentVariable('path',[System.EnvironmentVariableTarget]::User) -[System.Environment]::SetEnvironmentVariable('path', $oldpath + 'c:\Program Files (x86)\GnuWin32\bin;C:\Program Files\CMake\bin', [System.EnvironmentVariableTarget]::User) -# 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..." -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 - -# TODO: put build-agent-results_key.json on the machine somehow -gcloud auth activate-service-account --key-file C:\jenkins\build-agent-results_key.json \ No newline at end of file diff --git a/scripts/windows_agent_start.ps1 b/scripts/windows_agent_start.ps1 index 3a218d9..bb98577 100644 --- a/scripts/windows_agent_start.ps1 +++ b/scripts/windows_agent_start.ps1 @@ -1,32 +1,20 @@ # 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. +$IMAGE="gcr.io/llvm-premerge-checks/agent-windows-jenkins" -. ${PSScriptRoot}\common.ps1 - -$JENKINS_SERVER="jenkins.local" -$AGENT_ROOT="D:\" -$SWARM_PLUGIN_JAR="C:\jenkins\swarm-client.jar" - -# move temp dir to local SSD -mkdir D:\temp -$env:temp="D:\temp" -$env:tmp=$env:temp - -java -jar ${SWARM_PLUGIN_JAR} ` - -master http://${JENKINS_SERVER}:8080 ` - -executors 1 ` - -fsroot ${AGENT_ROOT} ` - -labels windows ` - -name $env:computername \ No newline at end of file +# check for new images on every start +docker pull $IMAGE:latest +docker run $IMAGE +docker run -v D:\:C:\ws -v C:\credentials:C:\credentials -e PARENT_HOSTNAME=$env:computername $IMAGE From 7e54c937c82265292f282c3aa81f0860bff69ca7 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Wed, 22 Jan 2020 18:04:18 +0100 Subject: [PATCH 03/26] Add pathspec pip package. --- scripts/phabtalk/requirements.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/phabtalk/requirements.txt b/scripts/phabtalk/requirements.txt index 3c9d93e..54707c5 100644 --- a/scripts/phabtalk/requirements.txt +++ b/scripts/phabtalk/requirements.txt @@ -1,4 +1,5 @@ -phabricator==0.7.0 -lxml==4.4.1 -gitpython==3.0.5 -retrying==1.3.3 \ No newline at end of file +phabricator==0.7.0 +lxml==4.4.1 +gitpython==3.0.5 +retrying==1.3.3 +pathspec=0.7.0 From f998580ba2fb5e44dbd6ebe6cf78e3bbf78aa2f5 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Wed, 22 Jan 2020 18:27:04 +0100 Subject: [PATCH 04/26] fix requirements.txt --- scripts/phabtalk/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/phabtalk/requirements.txt b/scripts/phabtalk/requirements.txt index 54707c5..abd989e 100644 --- a/scripts/phabtalk/requirements.txt +++ b/scripts/phabtalk/requirements.txt @@ -2,4 +2,4 @@ phabricator==0.7.0 lxml==4.4.1 gitpython==3.0.5 retrying==1.3.3 -pathspec=0.7.0 +pathspec==0.7.0 From 403973a35638c2ae7ee513993fb2fceb6d70910b Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Wed, 22 Jan 2020 19:04:13 +0100 Subject: [PATCH 05/26] Line endings, docs --- .../Dockerfile | 108 +++++++++--------- containers/build_deploy.sh | 2 +- docs/playbooks.md | 5 +- 3 files changed, 60 insertions(+), 55 deletions(-) diff --git a/containers/agent-debian-testing-clang8-ssd/Dockerfile b/containers/agent-debian-testing-clang8-ssd/Dockerfile index 4baab8d..a4bf8f5 100644 --- a/containers/agent-debian-testing-clang8-ssd/Dockerfile +++ b/containers/agent-debian-testing-clang8-ssd/Dockerfile @@ -1,53 +1,55 @@ -FROM debian:testing - -RUN apt-get update ;\ - apt-get install -y --no-install-recommends locales \ - cmake ninja-build git ca-certificates clang lld ccache python3 build-essential \ - clang-tidy clang-format \ - python3-psutil arcanist zip wget \ - openjdk-11-jdk \ - python3-pip python3-setuptools \ - swig python3-dev libedit-dev libncurses5-dev libxml2-dev liblzma-dev golang rsync jq; \ - apt-get clean - -# Make python3 default (needed by git-clang-format and others). -RUN rm -f /usr/bin/python && ln -s /usr/bin/python3 /usr/bin/python -# required for openssh server -RUN mkdir -p /run/sshd - -ARG user=jenkins -ARG group=jenkins -ARG uid=1000 -ARG gid=1000 -ARG AGENT_WORKDIR=/home/${user}/agent - -RUN mkdir -p /scripts - -# install the swarm client -RUN cd /scripts ;\ - wget https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/3.17/swarm-client-3.17.jar ;\ - mv swarm-client-3.17.jar swarm-client.jar - -COPY start_agent.sh report_results.sh /scripts/ - -# install python dependencies for the scripts -RUN pip3 install -r https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/phabtalk/requirements.txt - -RUN groupadd -g ${gid} ${group} ;\ - useradd -c "Jenkins user" -d /home/${user} -u ${uid} -g ${gid} -m ${user} ;\ - mkdir /home/${user}/ccache - -RUN chown -R ${user}:${user} /home/${user} - -WORKDIR /home/${user} -ENV CCACHE_PATH=/mnt/disks/ssd0/ccache - -# configure locale -RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\ - locale-gen -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -CMD ["/scripts/start_agent.sh"] - +FROM debian:testing + +RUN apt-get update ;\ + apt-get install -y --no-install-recommends locales \ + cmake ninja-build git ca-certificates clang lld ccache python3 build-essential \ + clang-tidy clang-format \ + python3-psutil arcanist zip wget \ + openjdk-11-jdk \ + python3-pip python3-setuptools \ + swig python3-dev libedit-dev libncurses5-dev libxml2-dev liblzma-dev golang rsync jq; \ + apt-get clean + +# Make python3 default (needed by git-clang-format and others). +RUN rm -f /usr/bin/python && ln -s /usr/bin/python3 /usr/bin/python +# required for openssh server +RUN mkdir -p /run/sshd + +ARG user=jenkins +ARG group=jenkins +ARG uid=1000 +ARG gid=1000 +ARG AGENT_WORKDIR=/home/${user}/agent + +RUN mkdir -p /scripts + +# install the swarm client +RUN cd /scripts ;\ + wget https://repo.jenkins-ci.org/releases/org/jenkins-ci/plugins/swarm-client/3.17/swarm-client-3.17.jar ;\ + mv swarm-client-3.17.jar swarm-client.jar + +COPY start_agent.sh report_results.sh /scripts/ + +# install python dependencies for the scripts +# ADD will checks that contentent of a file has changed. +ADD "https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/phabtalk/requirements.txt" requirements.txt +RUN pip3 install -r requirements.txt + +RUN groupadd -g ${gid} ${group} ;\ + useradd -c "Jenkins user" -d /home/${user} -u ${uid} -g ${gid} -m ${user} ;\ + mkdir /home/${user}/ccache + +RUN chown -R ${user}:${user} /home/${user} + +WORKDIR /home/${user} +ENV CCACHE_PATH=/mnt/disks/ssd0/ccache + +# configure locale +RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\ + locale-gen +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +CMD ["/scripts/start_agent.sh"] + diff --git a/containers/build_deploy.sh b/containers/build_deploy.sh index 299a2b7..93bd09c 100755 --- a/containers/build_deploy.sh +++ b/containers/build_deploy.sh @@ -27,4 +27,4 @@ QUALIFIED_NAME="${GCR_HOSTNAME}/${GCP_PROJECT}/${IMAGE_NAME}" cd "${DIR}/${IMAGE_NAME}" docker build -t ${IMAGE_NAME} . docker tag ${IMAGE_NAME} ${QUALIFIED_NAME} -docker push ${QUALIFIED_NAME} \ No newline at end of file +docker push ${QUALIFIED_NAME} \ No newline at end of file diff --git a/docs/playbooks.md b/docs/playbooks.md index ec94176..bf23b77 100644 --- a/docs/playbooks.md +++ b/docs/playbooks.md @@ -6,11 +6,14 @@ General remarks: * GCP does not route any traffic to your services unless the service is "healthy". It might take a few minutes after startup before the services is classified as healthy. Until then you will only see some generic error message. -These are the steps to set up the build server on a clean infrastructure: +These are the steps to set up the build server on a clean infrastructure: 1. Configure the tools on your local machine: ```bash ./local_setup.sh ``` + If you not running docker under your user, you might need to + `sudo gcloud auth login --no-launch-browser && gcloud auth configure-docker` + before running other commands under sudo. 1. Delete the old cluster, if it still exists: ```bash cd kubernetes/cluster From 276978ff1fc7fcde621de385da0f45278f009a94 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Wed, 22 Jan 2020 13:23:07 +0100 Subject: [PATCH 06/26] Ignore selected paths for clang-format and clang-tidy Now clang-format report will skip files matching `clang-format.ignore`. For now it's empty. clang-tidy will not receive diffs for `clang-tidy.ignore` (it still can produce warnings for these files). In addition build bot will not will not post comments for files that are matched by `clang-tidy-comments.ignore`. Now project/file should be whitelisted to receive inline comments from clang-tidy. Added all /test directories to `clang-tidy.ignore`. Other alternatives considered: - using 'compile_commands.json': does not contain header files. - specifying -regex option to 'clang-tidy-diff': probably not the best experience of providing multiple rules and maintaining a single regex. --- .gitignore | 2 + Jenkins/Phabricator-pipeline/Jenkinsfile | 1 + scripts/clang-format.ignore | 1 + scripts/clang-tidy-comments.ignore | 4 ++ scripts/clang-tidy.ignore | 44 +++++++++++++++++++ scripts/ignore_diff.py | 39 +++++++++++++++++ scripts/lint.sh | 9 ++-- scripts/phabtalk/apply_patch.py | 2 +- scripts/phabtalk/phabtalk.py | 54 ++++++++++++++++-------- scripts/phabtalk/requirements.txt | 2 +- 10 files changed, 135 insertions(+), 23 deletions(-) create mode 100644 scripts/clang-format.ignore create mode 100644 scripts/clang-tidy-comments.ignore create mode 100644 scripts/clang-tidy.ignore create mode 100755 scripts/ignore_diff.py diff --git a/.gitignore b/.gitignore index 238546f..21455c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ .vscode/ .idea/ *.iml +venv/ +__pycache__/ diff --git a/Jenkins/Phabricator-pipeline/Jenkinsfile b/Jenkins/Phabricator-pipeline/Jenkinsfile index c02bc84..82a9e39 100644 --- a/Jenkins/Phabricator-pipeline/Jenkinsfile +++ b/Jenkins/Phabricator-pipeline/Jenkinsfile @@ -149,6 +149,7 @@ pipeline { --buildresult ${currentBuild.result} \ --clang-format-patch "clang-format.patch" \ --clang-tidy-result "clang-tidy.txt" \ + --clang-tidy-ignore "${SCRIPT_DIR}/clang-tidy-comments.ignore" \ --results-dir "${TARGET_DIR}" \ --results-url "${RESULT_URL}" """ diff --git a/scripts/clang-format.ignore b/scripts/clang-format.ignore new file mode 100644 index 0000000..c43ec0c --- /dev/null +++ b/scripts/clang-format.ignore @@ -0,0 +1 @@ +# Patterns for clang-format to ignore. \ No newline at end of file diff --git a/scripts/clang-tidy-comments.ignore b/scripts/clang-tidy-comments.ignore new file mode 100644 index 0000000..6663111 --- /dev/null +++ b/scripts/clang-tidy-comments.ignore @@ -0,0 +1,4 @@ +# Files that are allowed by clang-tidy.ignore but should not receive inline review comments. +# Right now it works in whitelist mode and only some files / directories are whitelisted. +* +!clang-tools-extra/clangd/** \ No newline at end of file diff --git a/scripts/clang-tidy.ignore b/scripts/clang-tidy.ignore new file mode 100644 index 0000000..4d74be8 --- /dev/null +++ b/scripts/clang-tidy.ignore @@ -0,0 +1,44 @@ +# Files to be ignored by clang-tidy. Will not appear in short report and inline comments. +libcxxabi/test +libcxxabi/test/libcxxabi/test +libcxx/test +libcxx/utils/libcxx/test +libcxx/utils/google-benchmark/test +llvm/test +llvm/utils/gn/secondary/llvm/test +llvm/utils/gn/secondary/lld/test +llvm/utils/gn/secondary/clang-tools-extra/test +llvm/utils/gn/secondary/clang-tools-extra/clangd/test +llvm/utils/gn/secondary/compiler-rt/test +llvm/utils/gn/secondary/clang/test +llvm/utils/benchmark/test +polly/test +lldb/examples/test +lldb/test +lldb/utils/test +lldb/tools/intel-features/intel-mpx/test +lldb/packages/Python/lldbsuite/test +lldb/packages/Python/lldbsuite/test/tools/lldb-server/test +lldb/packages/Python/lldbsuite/test/commands/expression/test +lldb/packages/Python/lldbsuite/test/test_runner/test +lldb/third_party/Python/module/unittest2/unittest2/test +lld/test +clang-tools-extra/test +clang-tools-extra/clangd/clients/clangd-vscode/test +clang-tools-extra/clangd/test +pstl/test +libc/test +llgo/test +compiler-rt/test +compiler-rt/test/builtins/Unit/ppc/test +compiler-rt/test/builtins/Unit/test +debuginfo-tests/dexter/dex/tools/test +debuginfo-tests/dexter/feature_tests/subtools/test +clang/test +libclc/test +mlir/test +openmp/libomptarget/test +openmp/libomptarget/deviceRTLs/nvptx/test +openmp/runtime/test +libunwind/test +libunwind/test/libunwind/test diff --git a/scripts/ignore_diff.py b/scripts/ignore_diff.py new file mode 100755 index 0000000..a376948 --- /dev/null +++ b/scripts/ignore_diff.py @@ -0,0 +1,39 @@ +#!/usr/bin/env python3 +# Copyright 2020 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. + +import re +import sys +import pathspec + +# Takes an output of git diff and removes files ignored by patten specified by ignore file. +def main(): + argv = sys.argv[1:] + if not argv: + print("Please provide a path to .ignore file.") + sys.exit(1) + ignore = pathspec.PathSpec.from_lines(pathspec.patterns.GitWildMatchPattern, + open(argv[0], 'r').readlines()) + good = True + for line in sys.stdin: + match = re.search(r'^diff --git a/(.*) b/(.*)$', line) + if match: + good = not (ignore.match_file(match.group(1)) and ignore.match_file(match.group(2))) + if not good: + continue + sys.stdout.write(line) + + +if __name__ == "__main__": + main() diff --git a/scripts/lint.sh b/scripts/lint.sh index 7618d4a..259cf79 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -21,16 +21,17 @@ set -eux echo "Running linters... =====================================" cd "${WORKSPACE}" + +# clang-format # Let clang format apply patches --diff doesn't produces results in the format we want. git-clang-format set +e -git diff -U0 --exit-code > "${TARGET_DIR}"/clang-format.patch -STATUS="${PIPESTATUS[0]}" +git diff -U0 --exit-code | "${SCRIPT_DIR}/ignore_diff.py" "${SCRIPT_DIR}/clang-format.ignore" > "${TARGET_DIR}"/clang-format.patch set -e # Revert changes of git-clang-format. git checkout -- . -# TODO: clang tidy is currently disabled, see https://github.com/google/llvm-premerge-checks/issues/91 -# git diff HEAD^ | clang-tidy-diff -p1 -quiet > "${TARGET_DIR}"/clang-tidy.txt +# clang-tidy +git diff -U0 HEAD^ | "${SCRIPT_DIR}/ignore_diff.py" "${SCRIPT_DIR}/clang-tidy.ignore" | clang-tidy-diff -p1 -quiet > "${TARGET_DIR}"/clang-tidy.txt echo "linters completed ======================================" diff --git a/scripts/phabtalk/apply_patch.py b/scripts/phabtalk/apply_patch.py index 2a9d7c0..b424241 100755 --- a/scripts/phabtalk/apply_patch.py +++ b/scripts/phabtalk/apply_patch.py @@ -1,4 +1,4 @@ -#!/bin/env python3 +#!/usr/bin/env python3 # Copyright 2019 Google LLC # # Licensed under the the Apache License v2.0 with LLVM Exceptions (the "License"); diff --git a/scripts/phabtalk/phabtalk.py b/scripts/phabtalk/phabtalk.py index a6609df..a34e559 100755 --- a/scripts/phabtalk/phabtalk.py +++ b/scripts/phabtalk/phabtalk.py @@ -24,6 +24,7 @@ import socket import time from typing import Optional +import pathspec from lxml import etree from phabricator import Phabricator @@ -48,6 +49,7 @@ class BuildReport: self.lint[key] = [] self.lint[key].append(m) + class PhabTalk: """Talk to Phabricator to upload build results. See https://secure.phabricator.com/conduit/method/harbormaster.sendmessage/ @@ -213,18 +215,25 @@ def _add_clang_format(report: BuildReport, results_dir: str, report.success = success and report.success -def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, workspace: str, clang_tidy_file: str): +def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, workspace: str, clang_tidy_file: str, + clang_tidy_ignore: str): # Typical message looks like # [..]/clang/include/clang/AST/DeclCXX.h:3058:20: error: no member named 'LifetimeExtendedTemporary' in 'clang::Decl' [clang-diagnostic-error] - pattern = '^{}/([^:]*):(\\d+):(\\d+): (.*): (.*)'.format(workspace) - success = True + errors_count = 0 + warn_count = 0 present = (clang_tidy_file is not None) and os.path.exists(os.path.join(results_dir, clang_tidy_file)) if not present: print('clang-tidy result {} is not found'.format(clang_tidy_file)) report.comments.append(section_title('clang-tidy', False, False)) return - + present = (clang_tidy_ignore is not None) and os.path.exists(clang_tidy_ignore) + if not present: + print('clang-tidy ignore file {} is not found'.format(clang_tidy_ignore)) + report.comments.append(section_title('clang-tidy', False, False)) + return + ignore = pathspec.PathSpec.from_lines(pathspec.patterns.GitWildMatchPattern, + open(clang_tidy_ignore, 'r').readlines()) p = os.path.join(results_dir, clang_tidy_file) for line in open(p, 'r'): match = re.search(pattern, line) @@ -235,20 +244,27 @@ def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, wor severity = match.group(4) text = match.group(5) if severity in ['warning', 'error']: - success = False - report.addLint({ - 'name': 'clang-tidy', - 'severity': 'warning', - 'code': 'clang-tidy', - 'path': file_name, - 'line': int(line_pos), - 'char': int(char_pos), - 'description': '{}: {}'.format(severity, text), - }) - + if severity == 'warning': + warn_count += 1 + if severity == 'error': + errors_count += 1 + if ignore.match_file(file_name): + print('{} is ignored by pattern and no comment will be added') + else: + report.addLint({ + 'name': 'clang-tidy', + 'severity': 'warning', + 'code': 'clang-tidy', + 'path': file_name, + 'line': int(line_pos), + 'char': int(char_pos), + 'description': '{}: {}'.format(severity, text), + }) + success = errors_count + warn_count == 0 comment = section_title('clang-tidy', success, present) if not success: - comment += 'Please fix [[ {}/{} | clang-tidy findings ]].'.format(results_url, clang_tidy_file) + comment += 'clang-tidy found [[ {}/{} | {} errors and {} warnings]].'\ + .format(results_url, clang_tidy_file, errors_count, warn_count) report.comments.append(comment) report.success = success and report.success @@ -355,7 +371,8 @@ def main(): report.success = False _add_test_results(report, args.results_dir, args.test_result_file) - _add_clang_tidy(report, args.results_dir, args.results_url, args.workspace, args.clang_tidy_result) + _add_clang_tidy(report, args.results_dir, args.results_url, args.workspace, args.clang_tidy_result, + args.clang_tidy_ignore) _add_clang_format(report, args.results_dir, args.results_url, args.clang_format_patch) _add_links_to_artifacts(report, args.results_dir, args.results_url) p = PhabTalk(args.conduit_token, args.host, args.dryrun) @@ -380,6 +397,9 @@ def _parse_args(): parser.add_argument('--clang-tidy-result', type=str, default=None, dest='clang_tidy_result', help="path to diff produced by git-clang-tidy, relative to results-dir") + parser.add_argument('--clang-tidy-ignore', type=str, default=None, + dest='clang_tidy_ignore', + help="path to file with patters to exclude commenting on for clang-tidy findings") parser.add_argument('--results-dir', type=str, default=None, required=True, dest='results_dir', help="directory of all build artifacts") diff --git a/scripts/phabtalk/requirements.txt b/scripts/phabtalk/requirements.txt index abd989e..1acc4fc 100644 --- a/scripts/phabtalk/requirements.txt +++ b/scripts/phabtalk/requirements.txt @@ -2,4 +2,4 @@ phabricator==0.7.0 lxml==4.4.1 gitpython==3.0.5 retrying==1.3.3 -pathspec==0.7.0 +pathspec=0.7.0 \ No newline at end of file From bf98f92a3d6c36270fa9a4fb9a3dde42a4ef6681 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 09:32:45 +0100 Subject: [PATCH 07/26] print current git commit info on checkout and while applying patch --- Jenkins/Phabricator-pipeline/Jenkinsfile | 6 ++---- scripts/phabtalk/apply_patch.py | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Jenkins/Phabricator-pipeline/Jenkinsfile b/Jenkins/Phabricator-pipeline/Jenkinsfile index 82a9e39..9de41e2 100644 --- a/Jenkins/Phabricator-pipeline/Jenkinsfile +++ b/Jenkins/Phabricator-pipeline/Jenkinsfile @@ -46,16 +46,14 @@ pipeline { currentBuild.displayName += " D${drev_id}" currentBuild.description = "D${drev_id}" } - // Report versions of the installed packages. - sh 'dpkg -l' - sh 'clang --version' - sh 'python --version' + sh 'dpkg -l' // Report versions of the installed packages. } } stage("git checkout"){ steps { git url: 'https://github.com/llvm/llvm-project.git' sh 'git clean -fdx' + sh 'git show -s' sh 'mkdir -p llvm-premerge-checks' dir("llvm-premerge-checks") { diff --git a/scripts/phabtalk/apply_patch.py b/scripts/phabtalk/apply_patch.py index b424241..ef1f24b 100755 --- a/scripts/phabtalk/apply_patch.py +++ b/scripts/phabtalk/apply_patch.py @@ -87,6 +87,8 @@ class ApplyPatch: 'master branch instead...'.format(self.git_hash)] subprocess.check_call('git checkout master', stdout=sys.stdout, stderr=sys.stderr, shell=True) + subprocess.check_call('git show -s', stdout=sys.stdout, + stderr=sys.stderr, shell=True) print('git checkout completed.') def _apply_patch(self): From 9f3db2cc482912183f0b1f0b313eea035b6345d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Thu, 23 Jan 2020 09:47:55 +0100 Subject: [PATCH 08/26] handling base revision not found using master instead --- scripts/phabtalk/apply_patch2.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/phabtalk/apply_patch2.py b/scripts/phabtalk/apply_patch2.py index e5c20f4..211f596 100755 --- a/scripts/phabtalk/apply_patch2.py +++ b/scripts/phabtalk/apply_patch2.py @@ -21,7 +21,7 @@ import sys from typing import List, Optional, Tuple from phabricator import Phabricator -from git import Repo +from git import Repo, GitCommandError class ApplyPatch: """Apply a diff from Phabricator on local working copy. @@ -76,7 +76,12 @@ class ApplyPatch: try: revision_id, dependencies, base_revision = self._get_dependencies() print('Checking out {}...'.format(base_revision)) - self.repo.git.checkout(base_revision) + try: + self.repo.git.checkout(base_revision) + except GitCommandError: + print('ERROR checking out revision {}. It`s not in the ' + 'repository. Using master instead.'.format(base_revision)) + self.repo.git.checkout('master') print('Revision is {}'.format(self.repo.head.commit.hexsha)) print('git reset, git cleanup...') self.repo.git.reset('--hard') From ebdda6fdc6b0b3c19ddbfb1692842cdfedb27e03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Thu, 23 Jan 2020 10:33:56 +0100 Subject: [PATCH 09/26] updated start script --- scripts/windows_agent_start.ps1 | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/scripts/windows_agent_start.ps1 b/scripts/windows_agent_start.ps1 index bb98577..0045a80 100644 --- a/scripts/windows_agent_start.ps1 +++ b/scripts/windows_agent_start.ps1 @@ -12,9 +12,18 @@ # See the License for the specific language governing permissions and # limitations under the License. -$IMAGE="gcr.io/llvm-premerge-checks/agent-windows-jenkins" +# Pull and start the Docker container for a Windows agent. +# To setup a Windows agent see docs/playbooks.md -# check for new images on every start -docker pull $IMAGE:latest -docker run $IMAGE -docker run -v D:\:C:\ws -v C:\credentials:C:\credentials -e PARENT_HOSTNAME=$env:computername $IMAGE +$NAME="agent-windows-jenkins" +$IMAGE="gcr.io/llvm-premerge-checks/${NAME}" + +docker pull ${IMAGE}:latest +docker stop ${NAME} +docker run ` + -v D:\:C:\ws ` + -v C:\credentials:C:\credentials ` + -e PARENT_HOSTNAME=$env:computername ` + --restart unless-stopped ` + --name ${NAME} ` + ${IMAGE} \ No newline at end of file From 0ba33dd7cd2a0c794eef277cb7e6180fc0ca5e15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Thu, 23 Jan 2020 13:03:52 +0100 Subject: [PATCH 10/26] added rd to arc stage --- Jenkins/Phabricator-windows-pipeline/Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkins/Phabricator-windows-pipeline/Jenkinsfile b/Jenkins/Phabricator-windows-pipeline/Jenkinsfile index d8c75f4..3831703 100644 --- a/Jenkins/Phabricator-windows-pipeline/Jenkinsfile +++ b/Jenkins/Phabricator-windows-pipeline/Jenkinsfile @@ -48,6 +48,7 @@ pipeline { echo "getting llvm-project... " dir("llvm-project") { + bat "rd /s/q build" git url: 'https://github.com/llvm/llvm-project.git' } powershell "New-Item -ItemType Directory -Force -Path ${RESULT_DIR}" From b8872caaa61f04a0cb3d8f3fa4d2be7cf45f72a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Thu, 23 Jan 2020 13:07:30 +0100 Subject: [PATCH 11/26] fixed container start script --- scripts/windows_agent_start.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/windows_agent_start.ps1 b/scripts/windows_agent_start.ps1 index 0045a80..95de34c 100644 --- a/scripts/windows_agent_start.ps1 +++ b/scripts/windows_agent_start.ps1 @@ -18,8 +18,9 @@ $NAME="agent-windows-jenkins" $IMAGE="gcr.io/llvm-premerge-checks/${NAME}" -docker pull ${IMAGE}:latest +docker pull ${IMAGE} docker stop ${NAME} +docker rm ${NAME} docker run ` -v D:\:C:\ws ` -v C:\credentials:C:\credentials ` From a3f6610df2147e1702600526e69529373dd95102 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 11:17:23 +0100 Subject: [PATCH 12/26] Update bot report - add links to join beta and report issue - add link "not useful" to clang-tidy warning - clang-tidy comment in report now tells how many inline comments were added --- docs/clang_tidy.md | 29 +++++++++++++++++++++++++++++ docs/user_doc.md | 6 ++++-- scripts/phabtalk/phabtalk.py | 25 +++++++++++++++++++++---- 3 files changed, 54 insertions(+), 6 deletions(-) create mode 100644 docs/clang_tidy.md diff --git a/docs/clang_tidy.md b/docs/clang_tidy.md new file mode 100644 index 0000000..fc2714d --- /dev/null +++ b/docs/clang_tidy.md @@ -0,0 +1,29 @@ +# clang-tidy checks +## warning is not useful +If you found that a warning produced by clang-tidy is not useful: + +- If clang-tidy must not run for some files at all (e.g. lit test), please +[add files to blacklist](scripts/clang-tidy.ignore). + +- Consider fixing or [suppressing diagnostic](https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics) + if there is a good reason. + +- [File a bug](issues/new?assignees=&labels=bug&template=bug_report.md&title=) + if build process should be improved. + +- If you believe that you found a clang-tidy bug then please keep in mind that clang-tidy version run by bot + might not be most recent. Please reproduce your issue on current version before submitting a bug to clang-tidy. + +## Review comments + +Build bot leaves inline comments only for a small subset of files that are not blacklisted for analysis (see above) *and* +specifically whitelisted for comments. + +That is done to avoid potential noise when a file already contains a number of warnings. + +If your are confident that some files are in good shape already, please +[whitelist them](scripts/clang-tidy-comments.ignore). + +---- + +[about pre-merge checks](docs/user_doc.md) \ No newline at end of file diff --git a/docs/user_doc.md b/docs/user_doc.md index 75adc63..041c399 100644 --- a/docs/user_doc.md +++ b/docs/user_doc.md @@ -44,17 +44,19 @@ Only then can the build server apply the patch locally and run the builds and te Once you're signed up, Phabricator will automatically trigger a build for every new patch you upload or every existing patch you modify. Phabricator shows the build results at the top of the entry: ![build status](images/diff_detail.png) +Bot will compile and run tests, run clang-format and [clang-tidy](docs/clang_tidy.md) on lines changed. + If a unit test failed, this is shown below the build status. You can also expand the unit test to see the details: ![unit test results](images/unit_tests.png) -After every build the build server will comment on your latest patch, so that you can also see the results for previous changes. The comment also contains a link to the log files: +After every build the build server will comment on your latest patch, so that you can also see the results for previous changes. +The comment also contains a link to the log files: ![bot comment](images/bot_comment.png) The build logs are stored for 90 days and automatically deleted after that. You can also trigger a build manually by using the "Run Plan Manually" link on the [Harbormaster page](https://reviews.llvm.org/harbormaster/plan/3/) and entering a revision ID in the pop-up window. - # Reporting issues If you notice any bugs, please create a [new issue](https://github.com/google/llvm-premerge-checks/issues/new). diff --git a/scripts/phabtalk/phabtalk.py b/scripts/phabtalk/phabtalk.py index a34e559..4829b15 100755 --- a/scripts/phabtalk/phabtalk.py +++ b/scripts/phabtalk/phabtalk.py @@ -22,6 +22,7 @@ import os import re import socket import time +import urllib from typing import Optional import pathspec @@ -65,7 +66,7 @@ class PhabTalk: def dryrun(self): return self._phab is None - def _get_revision_id(self, diff: str): + def get_revision_id(self, diff: str): """Get the revision ID for a diff from Phabricator.""" if self.dryrun: return None @@ -77,7 +78,7 @@ class PhabTalk: """Add a comment to a differential based on the diff_id""" print('Sending comment to diff {}:'.format(diff_id)) print(text) - self._comment_on_revision(self._get_revision_id(diff_id), text) + self._comment_on_revision(self.get_revision_id(diff_id), text) def _comment_on_revision(self, revision: str, text: str): """Add comment on a differential based on the revision id.""" @@ -222,6 +223,7 @@ def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, wor pattern = '^{}/([^:]*):(\\d+):(\\d+): (.*): (.*)'.format(workspace) errors_count = 0 warn_count = 0 + inline_comments = 0 present = (clang_tidy_file is not None) and os.path.exists(os.path.join(results_dir, clang_tidy_file)) if not present: print('clang-tidy result {} is not found'.format(clang_tidy_file)) @@ -243,6 +245,8 @@ def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, wor char_pos = match.group(3) severity = match.group(4) text = match.group(5) + text += '\n[[https://github.com/google/llvm-premerge-checks/blob/master/docs/clang_tidy.md#warning-is-not' \ + '-useful || not useful]] ' if severity in ['warning', 'error']: if severity == 'warning': warn_count += 1 @@ -251,6 +255,7 @@ def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, wor if ignore.match_file(file_name): print('{} is ignored by pattern and no comment will be added') else: + inline_comments += 1 report.addLint({ 'name': 'clang-tidy', 'severity': 'warning', @@ -263,8 +268,11 @@ def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, wor success = errors_count + warn_count == 0 comment = section_title('clang-tidy', success, present) if not success: - comment += 'clang-tidy found [[ {}/{} | {} errors and {} warnings]].'\ - .format(results_url, clang_tidy_file, errors_count, warn_count) + comment += "clang-tidy found [[ {}/{} | {} errors and {} warnings]]. {} of them are added as review comments " \ + "below ([[https://github.com/google/llvm-premerge-checks/blob/master/docs/clang_tidy.md#review" \ + "-comments || why?]])." \ + .format(results_url, clang_tidy_file, errors_count, warn_count, inline_comments) + report.comments.append(comment) report.success = success and report.success @@ -375,7 +383,16 @@ def main(): args.clang_tidy_ignore) _add_clang_format(report, args.results_dir, args.results_url, args.clang_format_patch) _add_links_to_artifacts(report, args.results_dir, args.results_url) + p = PhabTalk(args.conduit_token, args.host, args.dryrun) + title = 'Issue with build for {} ({})'.format(p.get_revision_id(args.diff_id), args.diff_id) + report.comments.append( + '//Pre-merge checks is in beta. [[ https://github.com/google/llvm-premerge-checks/issues/new?assignees' + '=&labels=bug&template=bug_report.md&title={} | Report issue]]. ' + 'Please [[ https://reviews.llvm.org/project/update/78/join/ || join beta ]] or ' + '[[ https://github.com/google/llvm-premerge-checks/issues/new?assignees=&labels=enhancement&template' + '=&title=enable%20checks%20for%20{{PATH}} || enable it for your project ]].//'.format( + urllib.parse.quote(title))) p.submit_report(args.diff_id, args.ph_id, report, args.buildresult) From 429c70ddc93d32645fe7c856a45aa08349a9c6c0 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 14:12:56 +0100 Subject: [PATCH 13/26] fix links --- scripts/phabtalk/phabtalk.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/phabtalk/phabtalk.py b/scripts/phabtalk/phabtalk.py index 4829b15..3cc144a 100755 --- a/scripts/phabtalk/phabtalk.py +++ b/scripts/phabtalk/phabtalk.py @@ -246,7 +246,7 @@ def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, wor severity = match.group(4) text = match.group(5) text += '\n[[https://github.com/google/llvm-premerge-checks/blob/master/docs/clang_tidy.md#warning-is-not' \ - '-useful || not useful]] ' + '-useful | not useful]] ' if severity in ['warning', 'error']: if severity == 'warning': warn_count += 1 @@ -270,7 +270,7 @@ def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, wor if not success: comment += "clang-tidy found [[ {}/{} | {} errors and {} warnings]]. {} of them are added as review comments " \ "below ([[https://github.com/google/llvm-premerge-checks/blob/master/docs/clang_tidy.md#review" \ - "-comments || why?]])." \ + "-comments | why?]])." \ .format(results_url, clang_tidy_file, errors_count, warn_count, inline_comments) report.comments.append(comment) @@ -389,9 +389,9 @@ def main(): report.comments.append( '//Pre-merge checks is in beta. [[ https://github.com/google/llvm-premerge-checks/issues/new?assignees' '=&labels=bug&template=bug_report.md&title={} | Report issue]]. ' - 'Please [[ https://reviews.llvm.org/project/update/78/join/ || join beta ]] or ' + 'Please [[ https://reviews.llvm.org/project/update/78/join/ | join beta ]] or ' '[[ https://github.com/google/llvm-premerge-checks/issues/new?assignees=&labels=enhancement&template' - '=&title=enable%20checks%20for%20{{PATH}} || enable it for your project ]].//'.format( + '=&title=enable%20checks%20for%20{{PATH}} | enable it for your project ]].//'.format( urllib.parse.quote(title))) p.submit_report(args.diff_id, args.ph_id, report, args.buildresult) From c28326f797b111884e16014f9b2c6fa2874b0ebc Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 14:16:42 +0100 Subject: [PATCH 14/26] fix doc links --- docs/clang_tidy.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/clang_tidy.md b/docs/clang_tidy.md index fc2714d..a6f4a68 100644 --- a/docs/clang_tidy.md +++ b/docs/clang_tidy.md @@ -1,14 +1,14 @@ # clang-tidy checks -## warning is not useful +## Warning is not useful If you found that a warning produced by clang-tidy is not useful: - If clang-tidy must not run for some files at all (e.g. lit test), please -[add files to blacklist](scripts/clang-tidy.ignore). +[add files to blacklist](../scripts/clang-tidy.ignore). - Consider fixing or [suppressing diagnostic](https://clang.llvm.org/extra/clang-tidy/#suppressing-undesired-diagnostics) if there is a good reason. -- [File a bug](issues/new?assignees=&labels=bug&template=bug_report.md&title=) +- [File a bug](https://github.com/google/llvm-premerge-checks/issues/new?assignees=&labels=bug&template=bug_report.md&title=) if build process should be improved. - If you believe that you found a clang-tidy bug then please keep in mind that clang-tidy version run by bot @@ -22,7 +22,7 @@ specifically whitelisted for comments. That is done to avoid potential noise when a file already contains a number of warnings. If your are confident that some files are in good shape already, please -[whitelist them](scripts/clang-tidy-comments.ignore). +[whitelist them](..scripts/clang-tidy-comments.ignore). ---- From 6394a86514a9833d05c4471642b1562e7a43635f Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 14:17:33 +0100 Subject: [PATCH 15/26] fix doc links --- docs/clang_tidy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/clang_tidy.md b/docs/clang_tidy.md index a6f4a68..3efce52 100644 --- a/docs/clang_tidy.md +++ b/docs/clang_tidy.md @@ -22,7 +22,7 @@ specifically whitelisted for comments. That is done to avoid potential noise when a file already contains a number of warnings. If your are confident that some files are in good shape already, please -[whitelist them](..scripts/clang-tidy-comments.ignore). +[whitelist them](../scripts/clang-tidy-comments.ignore). ---- From 241c1d7146f38db55b450c2bc64f30760857a83b Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 15:43:21 +0100 Subject: [PATCH 16/26] Fix requirements.txt --- scripts/phabtalk/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/phabtalk/requirements.txt b/scripts/phabtalk/requirements.txt index 1acc4fc..4b20cc1 100644 --- a/scripts/phabtalk/requirements.txt +++ b/scripts/phabtalk/requirements.txt @@ -2,4 +2,4 @@ phabricator==0.7.0 lxml==4.4.1 gitpython==3.0.5 retrying==1.3.3 -pathspec=0.7.0 \ No newline at end of file +pathspec==0.7.0 \ No newline at end of file From e13822f0f59f7aad9c2940b29cc5bfd5bc5f18b0 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 16:14:12 +0100 Subject: [PATCH 17/26] Use llvm-10 on phabricator agent - removed 'clang8' from the image name; - added --no-cache to ./build_deploy.sh to make sure that image will use most recent packages. Tested locally --- .../Dockerfile | 3 ++- .../report_results.sh | 0 .../start_agent.sh | 0 containers/build_deploy.sh | 2 +- containers/build_run.sh | 2 +- docs/playbooks.md | 2 +- kubernetes/jenkins.yaml | 6 +++--- 7 files changed, 8 insertions(+), 7 deletions(-) rename containers/{agent-debian-testing-clang8-ssd => agent-debian-testing-ssd}/Dockerfile (89%) rename containers/{agent-debian-testing-clang8-ssd => agent-debian-testing-ssd}/report_results.sh (100%) rename containers/{agent-debian-testing-clang8-ssd => agent-debian-testing-ssd}/start_agent.sh (100%) diff --git a/containers/agent-debian-testing-clang8-ssd/Dockerfile b/containers/agent-debian-testing-ssd/Dockerfile similarity index 89% rename from containers/agent-debian-testing-clang8-ssd/Dockerfile rename to containers/agent-debian-testing-ssd/Dockerfile index a4bf8f5..c38bc82 100644 --- a/containers/agent-debian-testing-clang8-ssd/Dockerfile +++ b/containers/agent-debian-testing-ssd/Dockerfile @@ -1,6 +1,7 @@ FROM debian:testing -RUN apt-get update ;\ +RUN echo "deb [trusted=yes] http://apt.llvm.org/buster/ llvm-toolchain-buster main\n$(cat /etc/apt/sources.list)" > /etc/apt/sources.list;\ # add LLVM 10 deb pkg to sources + apt-get update ;\ apt-get install -y --no-install-recommends locales \ cmake ninja-build git ca-certificates clang lld ccache python3 build-essential \ clang-tidy clang-format \ diff --git a/containers/agent-debian-testing-clang8-ssd/report_results.sh b/containers/agent-debian-testing-ssd/report_results.sh similarity index 100% rename from containers/agent-debian-testing-clang8-ssd/report_results.sh rename to containers/agent-debian-testing-ssd/report_results.sh diff --git a/containers/agent-debian-testing-clang8-ssd/start_agent.sh b/containers/agent-debian-testing-ssd/start_agent.sh similarity index 100% rename from containers/agent-debian-testing-clang8-ssd/start_agent.sh rename to containers/agent-debian-testing-ssd/start_agent.sh diff --git a/containers/build_deploy.sh b/containers/build_deploy.sh index 93bd09c..70167ad 100755 --- a/containers/build_deploy.sh +++ b/containers/build_deploy.sh @@ -25,6 +25,6 @@ IMAGE_NAME="${1%/}" QUALIFIED_NAME="${GCR_HOSTNAME}/${GCP_PROJECT}/${IMAGE_NAME}" cd "${DIR}/${IMAGE_NAME}" -docker build -t ${IMAGE_NAME} . +docker build -t --no-cache ${IMAGE_NAME} . docker tag ${IMAGE_NAME} ${QUALIFIED_NAME} docker push ${QUALIFIED_NAME} \ No newline at end of file diff --git a/containers/build_run.sh b/containers/build_run.sh index 36e8f9b..4ae154f 100755 --- a/containers/build_run.sh +++ b/containers/build_run.sh @@ -14,7 +14,7 @@ # limitations under the License. # Starts a new instances of a docker image. Example: -# sudo build_run.sh agent-debian-testing-clang8-ssd /bin/bash +# sudo build_run.sh agent-debian-testing-ssd /bin/bash set -eux DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" diff --git a/docs/playbooks.md b/docs/playbooks.md index bf23b77..bdfb9e9 100644 --- a/docs/playbooks.md +++ b/docs/playbooks.md @@ -137,7 +137,7 @@ Invoke-WebRequest -uri 'https://raw.githubusercontent.com/google/llvm-premerge-c ## Testing scripts locally -Build and run agent docker image `sudo ./containers/build_run.sh agent-debian-testing-clang8-ssd /bin/bash`. +Build and run agent docker image `sudo ./containers/build_run.sh agent-debian-testing-ssd /bin/bash`. Within a container set environment variables similar to [pipeline](https://github.com/google/llvm-premerge-checks/blob/master/Jenkins/Phabricator-pipeline/Jenkinsfile). diff --git a/kubernetes/jenkins.yaml b/kubernetes/jenkins.yaml index 65f62cd..ba2b9be 100644 --- a/kubernetes/jenkins.yaml +++ b/kubernetes/jenkins.yaml @@ -151,18 +151,18 @@ spec: apiVersion: extensions/v1beta1 kind: Deployment metadata: - name: agent-debian-testing-clang8-ssd + name: agent-debian-testing-ssd namespace: jenkins spec: replicas: 2 template: metadata: labels: - app: agent-debian-testing-clang8-ssd + app: agent-debian-testing-ssd spec: containers: - name: agent-debian-testing-clang8 - image: gcr.io/llvm-premerge-checks/agent-debian-testing-clang8-ssd + image: gcr.io/llvm-premerge-checks/agent-debian-testing-ssd ports: - containerPort: 22 resources: From 46978536f02c2360305667989a4815619af9b3a9 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 16:27:28 +0100 Subject: [PATCH 18/26] remove compile_commands.json before creating a new --- scripts/run_cmake.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/run_cmake.sh b/scripts/run_cmake.sh index 295c562..f40e02a 100755 --- a/scripts/run_cmake.sh +++ b/scripts/run_cmake.sh @@ -33,6 +33,7 @@ cmake -GNinja ../llvm -DCMAKE_BUILD_TYPE=Release -D LLVM_ENABLE_LLD=ON \ RETURN_CODE="${PIPESTATUS[0]}" set -e +rm -f "$WORKSPACE/compile_commands.json" ln -s "$WORKSPACE"/build/compile_commands.json "$WORKSPACE" cp CMakeCache.txt ${TARGET_DIR} From caef6c8238483f901fcfe71c21ec2fcdbda3b289 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 17:55:56 +0100 Subject: [PATCH 19/26] fix build --- containers/agent-debian-testing-ssd/Dockerfile | 2 +- containers/build_deploy.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/containers/agent-debian-testing-ssd/Dockerfile b/containers/agent-debian-testing-ssd/Dockerfile index c38bc82..426e85d 100644 --- a/containers/agent-debian-testing-ssd/Dockerfile +++ b/containers/agent-debian-testing-ssd/Dockerfile @@ -1,6 +1,6 @@ FROM debian:testing -RUN echo "deb [trusted=yes] http://apt.llvm.org/buster/ llvm-toolchain-buster main\n$(cat /etc/apt/sources.list)" > /etc/apt/sources.list;\ # add LLVM 10 deb pkg to sources +RUN echo "deb [trusted=yes] http://apt.llvm.org/buster/ llvm-toolchain-buster main\n$(cat /etc/apt/sources.list)" > /etc/apt/sources.list;\ apt-get update ;\ apt-get install -y --no-install-recommends locales \ cmake ninja-build git ca-certificates clang lld ccache python3 build-essential \ diff --git a/containers/build_deploy.sh b/containers/build_deploy.sh index 70167ad..afc84f4 100755 --- a/containers/build_deploy.sh +++ b/containers/build_deploy.sh @@ -25,6 +25,6 @@ IMAGE_NAME="${1%/}" QUALIFIED_NAME="${GCR_HOSTNAME}/${GCP_PROJECT}/${IMAGE_NAME}" cd "${DIR}/${IMAGE_NAME}" -docker build -t --no-cache ${IMAGE_NAME} . +docker build --no-cache -t ${IMAGE_NAME} . docker tag ${IMAGE_NAME} ${QUALIFIED_NAME} docker push ${QUALIFIED_NAME} \ No newline at end of file From 562adb1b90c078ac5481240b994fa4c82201eb28 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Thu, 23 Jan 2020 18:01:07 +0100 Subject: [PATCH 20/26] fix format string --- scripts/phabtalk/phabtalk.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/phabtalk/phabtalk.py b/scripts/phabtalk/phabtalk.py index 3cc144a..8768004 100755 --- a/scripts/phabtalk/phabtalk.py +++ b/scripts/phabtalk/phabtalk.py @@ -253,7 +253,7 @@ def _add_clang_tidy(report: BuildReport, results_dir: str, results_url: str, wor if severity == 'error': errors_count += 1 if ignore.match_file(file_name): - print('{} is ignored by pattern and no comment will be added') + print('{} is ignored by pattern and no comment will be added'.format(file_name)) else: inline_comments += 1 report.addLint({ From 180858cf416f777427dfcd32ebddb527d492b2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Thu, 23 Jan 2020 18:12:31 +0100 Subject: [PATCH 21/26] only deleting the folder if it exists --- Jenkins/Phabricator-windows-pipeline/Jenkinsfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Jenkins/Phabricator-windows-pipeline/Jenkinsfile b/Jenkins/Phabricator-windows-pipeline/Jenkinsfile index 3831703..05552e3 100644 --- a/Jenkins/Phabricator-windows-pipeline/Jenkinsfile +++ b/Jenkins/Phabricator-windows-pipeline/Jenkinsfile @@ -48,7 +48,8 @@ pipeline { echo "getting llvm-project... " dir("llvm-project") { - bat "rd /s/q build" + bat "" + bat 'if exist "build" rd /s/q "build"' git url: 'https://github.com/llvm/llvm-project.git' } powershell "New-Item -ItemType Directory -Force -Path ${RESULT_DIR}" From 563a115006e384c688651d7ea86fb30b13ec35a7 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Fri, 24 Jan 2020 09:06:30 +0100 Subject: [PATCH 22/26] fix git diff #108 --- scripts/lint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lint.sh b/scripts/lint.sh index 259cf79..e54f1d8 100755 --- a/scripts/lint.sh +++ b/scripts/lint.sh @@ -32,6 +32,6 @@ set -e git checkout -- . # clang-tidy -git diff -U0 HEAD^ | "${SCRIPT_DIR}/ignore_diff.py" "${SCRIPT_DIR}/clang-tidy.ignore" | clang-tidy-diff -p1 -quiet > "${TARGET_DIR}"/clang-tidy.txt +git diff -U0 HEAD | "${SCRIPT_DIR}/ignore_diff.py" "${SCRIPT_DIR}/clang-tidy.ignore" | clang-tidy-diff -p1 -quiet > "${TARGET_DIR}"/clang-tidy.txt echo "linters completed ======================================" From ed0fb93e67ac72bb3e3c1eacd66085a209eb6980 Mon Sep 17 00:00:00 2001 From: Mikhail Goncharov Date: Fri, 24 Jan 2020 10:06:42 +0100 Subject: [PATCH 23/26] updated buildkite to llvm-10 --- .../Dockerfile | 118 +++++++++--------- .../start_agent.sh | 0 .../agent-debian-testing-ssd/Dockerfile | 2 +- 3 files changed, 62 insertions(+), 58 deletions(-) rename containers/{agent-debian-testing-clang8-buildkite => agent-debian-testing-buildkite}/Dockerfile (80%) rename containers/{agent-debian-testing-clang8-buildkite => agent-debian-testing-buildkite}/start_agent.sh (100%) diff --git a/containers/agent-debian-testing-clang8-buildkite/Dockerfile b/containers/agent-debian-testing-buildkite/Dockerfile similarity index 80% rename from containers/agent-debian-testing-clang8-buildkite/Dockerfile rename to containers/agent-debian-testing-buildkite/Dockerfile index c2c9bbd..18f6314 100644 --- a/containers/agent-debian-testing-clang8-buildkite/Dockerfile +++ b/containers/agent-debian-testing-buildkite/Dockerfile @@ -1,57 +1,61 @@ -FROM debian:testing - -RUN apt-get update ;\ - apt-get install -y --no-install-recommends locales \ - cmake ninja-build git ca-certificates clang lld ccache python3 build-essential \ - clang-tidy clang-format \ - python3-psutil zip wget \ - openjdk-11-jdk \ - python3-pip python3-setuptools \ - swig python3-dev libedit-dev libncurses5-dev libxml2-dev liblzma-dev golang rsync jq; \ - apt-get clean - -# Make python3 default (needed by git-clang-format and others). -RUN rm -f /usr/bin/python && ln -s /usr/bin/python3 /usr/bin/python -# required for openssh server -RUN mkdir -p /run/sshd - -ARG user=buildkite -ARG group=buildkite -ARG uid=1000 -ARG gid=1000 -ARG AGENT_WORKDIR=/home/${user}/agent - -RUN mkdir -p /scripts - -COPY start_agent.sh /scripts/ - -# install python dependencies for the scripts -RUN pip3 install -r https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/phabtalk/requirements.txt - -RUN groupadd -g ${gid} ${group} ;\ - useradd -c "buildkite user" -d /home/${user} -u ${uid} -g ${gid} -m ${user} ;\ - mkdir /home/${user}/ccache - -RUN chown -R ${user}:${user} /home/${user} - -WORKDIR /home/${user} -ENV CCACHE_PATH=/mnt/disks/ssd0/ccache - -# configure locale -RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\ - locale-gen -ENV LANG en_US.UTF-8 -ENV LANGUAGE en_US:en -ENV LC_ALL en_US.UTF-8 - -# buildkite -RUN apt-get install -y apt-transport-https gnupg;\ - sh -c 'echo deb https://apt.buildkite.com/buildkite-agent stable main > /etc/apt/sources.list.d/buildkite-agent.list' ;\ - apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 32A37959C2FA5C3C99EFBC32A79206696452D198 ;\ - apt-get update ;\ - apt-get install -y buildkite-agent - -VOLUME /credentials - -CMD ["/scripts/start_agent.sh"] - +FROM debian:testing + +RUN echo "deb [trusted=yes] http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main\n$(cat /etc/apt/sources.list)" > /etc/apt/sources.list ;\ + apt-get update ;\ + apt-get install -y --no-install-recommends locales \ + cmake ninja-build git ca-certificates clang lld ccache python3 build-essential \ + clang-tidy clang-format \ + python3-psutil zip wget \ + openjdk-11-jdk \ + python3-pip python3-setuptools \ + swig python3-dev libedit-dev libncurses5-dev libxml2-dev liblzma-dev golang rsync jq; \ + apt-get clean + +# Make python3 default (needed by git-clang-format and others). +RUN rm -f /usr/bin/python && ln -s /usr/bin/python3 /usr/bin/python +RUN ls /usr/bin +# required for openssh server +RUN mkdir -p /run/sshd + +ARG user=buildkite +ARG group=buildkite +ARG uid=1000 +ARG gid=1000 +ARG AGENT_WORKDIR=/home/${user}/agent + +RUN mkdir -p /scripts + +COPY start_agent.sh /scripts/ + +# install python dependencies for the scripts +# ADD will checks that contentent of a file has changed. +ADD "https://raw.githubusercontent.com/google/llvm-premerge-checks/master/scripts/phabtalk/requirements.txt" requirements.txt +RUN pip3 install -r requirements.txt + +RUN groupadd -g ${gid} ${group} ;\ + useradd -c "buildkite user" -d /home/${user} -u ${uid} -g ${gid} -m ${user} ;\ + mkdir /home/${user}/ccache + +RUN chown -R ${user}:${user} /home/${user} + +WORKDIR /home/${user} +ENV CCACHE_PATH=/mnt/disks/ssd0/ccache + +# configure locale +RUN sed --in-place '/en_US.UTF-8/s/^#//' /etc/locale.gen ;\ + locale-gen +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +# buildkite +RUN apt-get install -y apt-transport-https gnupg;\ + sh -c 'echo deb https://apt.buildkite.com/buildkite-agent stable main > /etc/apt/sources.list.d/buildkite-agent.list' ;\ + apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 32A37959C2FA5C3C99EFBC32A79206696452D198 ;\ + apt-get update ;\ + apt-get install -y buildkite-agent + +VOLUME /credentials + +CMD ["/scripts/start_agent.sh"] + diff --git a/containers/agent-debian-testing-clang8-buildkite/start_agent.sh b/containers/agent-debian-testing-buildkite/start_agent.sh similarity index 100% rename from containers/agent-debian-testing-clang8-buildkite/start_agent.sh rename to containers/agent-debian-testing-buildkite/start_agent.sh diff --git a/containers/agent-debian-testing-ssd/Dockerfile b/containers/agent-debian-testing-ssd/Dockerfile index 426e85d..ac722a4 100644 --- a/containers/agent-debian-testing-ssd/Dockerfile +++ b/containers/agent-debian-testing-ssd/Dockerfile @@ -1,6 +1,6 @@ FROM debian:testing -RUN echo "deb [trusted=yes] http://apt.llvm.org/buster/ llvm-toolchain-buster main\n$(cat /etc/apt/sources.list)" > /etc/apt/sources.list;\ +RUN echo "deb [trusted=yes] http://apt.llvm.org/buster/ llvm-toolchain-buster-10 main\n$(cat /etc/apt/sources.list)" > /etc/apt/sources.list;\ apt-get update ;\ apt-get install -y --no-install-recommends locales \ cmake ninja-build git ca-certificates clang lld ccache python3 build-essential \ From 5d4a97a997fb2ac95ba302945a5b3677f17acae0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Mon, 27 Jan 2020 15:14:12 +0100 Subject: [PATCH 24/26] added error handling and logging to post action --- Jenkins/Phabricator-windows-pipeline/Jenkinsfile | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Jenkins/Phabricator-windows-pipeline/Jenkinsfile b/Jenkins/Phabricator-windows-pipeline/Jenkinsfile index 05552e3..527ad38 100644 --- a/Jenkins/Phabricator-windows-pipeline/Jenkinsfile +++ b/Jenkins/Phabricator-windows-pipeline/Jenkinsfile @@ -93,15 +93,17 @@ pipeline { // gather all result files in a folder, then upload everything to // Google Cloud Storage powershell """ - # get the console log + Write-Host "Getting the console log..." Invoke-WebRequest -OutFile console-log.txt -uri "http://jenkins.local:8080/job/${JOB_BASE_NAME}/${BUILD_NUMBER}/consoleText" -ErrorAction "Continue" - - Copy-Item "${LLVM_DIR}\\build\\CMakeCache.txt" - Copy-Item "${LLVM_DIR}\\build\\test-results.xml" - # upload files + Write-Host "Copying build artefacts..." + Copy-Item "${LLVM_DIR}\\build\\CMakeCache.txt" -ErrorAction=Continue + Copy-Item "${LLVM_DIR}\\build\\test-results.xml" -ErrorAction=Continue + + Write-Host "Uploading results to GCS..." \$ErrorActionPreference = 'SilentlyContinue' gsutil cp -Z *.* gs://llvm-premerge-checks/results/${MY_BUILD_ID}/ + Write-Host "Done." """ } // doesn't find junit results, not sure why... From 66f3d3ddc4287c3a6c39a86f8184434e9a032b21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Mon, 27 Jan 2020 15:27:00 +0100 Subject: [PATCH 25/26] logging details on clang tools versions --- Jenkins/Phabricator-pipeline/Jenkinsfile | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Jenkins/Phabricator-pipeline/Jenkinsfile b/Jenkins/Phabricator-pipeline/Jenkinsfile index 9de41e2..23f071d 100644 --- a/Jenkins/Phabricator-pipeline/Jenkinsfile +++ b/Jenkins/Phabricator-pipeline/Jenkinsfile @@ -46,7 +46,18 @@ pipeline { currentBuild.displayName += " D${drev_id}" currentBuild.description = "D${drev_id}" } - sh 'dpkg -l' // Report versions of the installed packages. + // Report versions of the installed packages. + sh ''' + echo Versions of various tools: + echo clang --version + clang --version + echo clang-tidy --version + clang-tidy --version + echo ld.lld --version + ld.lld --version + dpkg -l + ''' + } } stage("git checkout"){ From 74a5a24e927a17266f7cb6f3df014834222bbe55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=BChnel?= Date: Mon, 27 Jan 2020 16:24:45 +0100 Subject: [PATCH 26/26] changed ErrorAction --- Jenkins/Phabricator-windows-pipeline/Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Jenkins/Phabricator-windows-pipeline/Jenkinsfile b/Jenkins/Phabricator-windows-pipeline/Jenkinsfile index 527ad38..1b0093a 100644 --- a/Jenkins/Phabricator-windows-pipeline/Jenkinsfile +++ b/Jenkins/Phabricator-windows-pipeline/Jenkinsfile @@ -97,8 +97,8 @@ pipeline { Invoke-WebRequest -OutFile console-log.txt -uri "http://jenkins.local:8080/job/${JOB_BASE_NAME}/${BUILD_NUMBER}/consoleText" -ErrorAction "Continue" Write-Host "Copying build artefacts..." - Copy-Item "${LLVM_DIR}\\build\\CMakeCache.txt" -ErrorAction=Continue - Copy-Item "${LLVM_DIR}\\build\\test-results.xml" -ErrorAction=Continue + Copy-Item "${LLVM_DIR}\\build\\CMakeCache.txt" -ErrorAction SilentlyContinue + Copy-Item "${LLVM_DIR}\\build\\test-results.xml" -ErrorAction SilentlyContinue Write-Host "Uploading results to GCS..." \$ErrorActionPreference = 'SilentlyContinue'