| <?xml version='1.0' encoding='UTF-8'?> |
| <!-- |
| Copyright 2017 The Bazel Authors. All rights reserved. |
| |
| Licensed under the Apache License, Version 2.0 (the "License"); |
| you may not use this file except in compliance with the License. |
| You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| 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. |
| --> |
| <project> |
| <actions/> |
| <description>Run Bazel benchmark for new changes</description> |
| <keepDependencies>false</keepDependencies> |
| <properties> |
| <com.coravy.hudson.plugins.github.GithubProjectProperty> |
| <projectUrl>{{ variables.GITHUB_URL }}</projectUrl> |
| </com.coravy.hudson.plugins.github.GithubProjectProperty> |
| </properties> |
| <scm class="hudson.plugins.git.GitSCM"> |
| <configVersion>2</configVersion> |
| <userRemoteConfigs> |
| <hudson.plugins.git.UserRemoteConfig> |
| <refspec>+refs/heads/*:refs/remotes/origin/* +refs/notes/*:refs/notes/*</refspec> |
| <url>{{ variables.GITHUB_URL }}</url> |
| </hudson.plugins.git.UserRemoteConfig> |
| </userRemoteConfigs> |
| <branches> |
| <hudson.plugins.git.BranchSpec> |
| <name>master</name> |
| </hudson.plugins.git.BranchSpec> |
| </branches> |
| <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations> |
| <submoduleCfg class="list"/> |
| <extensions> |
| <hudson.plugins.git.extensions.impl.CleanBeforeCheckout/> |
| <hudson.plugins.git.extensions.impl.AuthorInChangelog/> |
| </extensions> |
| </scm> |
| <quietPeriod>5</quietPeriod> |
| <assignedNode>benchmark</assignedNode> |
| <canRoam>false</canRoam> |
| <disabled>false</disabled> |
| <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding> |
| <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding> |
| <triggers> |
| <hudson.triggers.TimerTrigger> |
| <spec>H H * * *</spec> |
| </hudson.triggers.TimerTrigger> |
| </triggers> |
| <concurrentBuild>false</concurrentBuild> |
| <builders> |
| <hudson.tasks.Shell> |
| <command>#!/bin/bash |
| echo "Getting all the changes..." |
| curl "http://ci.bazel.io/view/Bazel%20bootstrap%20and%20maintenance/job/Bazel-Benchmark/$BUILD_NUMBER/api/xml?wrapper=changes&xpath=//changeSet//commitId" > change.log |
| sed change.log -i -e "s/<\/commitId>/\n/g; s/<commitId>//g; s/<changes>//g; s/<\/changes>//g" |
| if [ ! -s change.log ]; then |
| echo "No new changes. Exit." |
| exit 0 |
| fi |
| |
| # Add bazel to the PATH |
| PATH=$PATH:$HOME/.bazel/latest/bin |
| |
| # build benchmark |
| echo "Building benchmark..." |
| bazel build src/tools/benchmark/java/com/google/devtools/build/benchmark \ |
| --spawn_strategy=standalone --genrule_strategy=standalone |
| |
| # run benchmark |
| filename="build_$BUILD_NUMBER.json" |
| version_string="" |
| while read line |
| do |
| version_string+=" --versions=${line}" |
| done < change.log |
| |
| mkdir output |
| bazel-bin/src/tools/benchmark/java/com/google/devtools/build/benchmark/benchmark \ |
| --workspace=${WORKSPACE}/benchmark_workspace \ |
| --output=${WORKSPACE}/output/${filename} \ |
| ${version_string} |
| </command> |
| </hudson.tasks.Shell> |
| </builders> |
| <publishers> |
| <hudson.tasks.ArtifactArchiver> |
| <artifacts>output/*.json</artifacts> |
| <allowEmptyArchive>true</allowEmptyArchive> |
| <onlyIfSuccessful>false</onlyIfSuccessful> |
| <fingerprint>false</fingerprint> |
| <defaultExcludes>true</defaultExcludes> |
| </hudson.tasks.ArtifactArchiver> |
| <hudson.plugins.parameterizedtrigger.BuildTrigger> |
| <configs> |
| <hudson.plugins.parameterizedtrigger.BuildTriggerConfig> |
| <configs> |
| <hudson.plugins.parameterizedtrigger.CurrentBuildParameters/> |
| </configs> |
| <projects>Bazel-Push-Benchmark-Output</projects> |
| <condition>UNSTABLE_OR_BETTER</condition> |
| <triggerWithNoParameters>false</triggerWithNoParameters> |
| </hudson.plugins.parameterizedtrigger.BuildTriggerConfig> |
| </configs> |
| </hudson.plugins.parameterizedtrigger.BuildTrigger> |
| </publishers> |
| <buildWrappers> |
| <hudson.plugins.build__timeout.BuildTimeoutWrapper> |
| <strategy class="hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy"> |
| <timeoutMinutes>1200</timeoutMinutes> |
| </strategy> |
| <operationList> |
| <hudson.plugins.build__timeout.operations.FailOperation/> |
| <hudson.plugins.build__timeout.operations.WriteDescriptionOperation> |
| <description>Timed out</description> |
| </hudson.plugins.build__timeout.operations.WriteDescriptionOperation> |
| </operationList> |
| </hudson.plugins.build__timeout.BuildTimeoutWrapper> |
| </buildWrappers> |
| </project> |