<?xml version="1.0" encoding="UTF-8"?><project>
  <actions/>
  <description>Plugin readonly master branch Bazel build for Gerrit stable-3.5&lt;!-- Managed by Jenkins Job Builder --&gt;</description>
  <keepDependencies>false</keepDependencies>
  <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
  <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
  <concurrentBuild>false</concurrentBuild>
  <assignedNode>bazel-debian</assignedNode>
  <canRoam>false</canRoam>
  <properties>
    <jenkins.model.BuildDiscarderProperty>
      <strategy class="hudson.tasks.LogRotator">
        <daysToKeep>20</daysToKeep>
        <numToKeep>-1</numToKeep>
        <artifactDaysToKeep>20</artifactDaysToKeep>
        <artifactNumToKeep>-1</artifactNumToKeep>
      </strategy>
    </jenkins.model.BuildDiscarderProperty>
    <hudson.security.AuthorizationMatrixProperty>
      <permission>hudson.model.Item.Discover:anonymous</permission>
      <permission>hudson.model.Item.Read:anonymous</permission>
      <permission>hudson.model.Item.ExtendedRead:anonymous</permission>
    </hudson.security.AuthorizationMatrixProperty>
  </properties>
  <scm class="hudson.plugins.git.GitSCM">
    <configVersion>2</configVersion>
    <userRemoteConfigs>
      <hudson.plugins.git.UserRemoteConfig>
        <name>origin</name>
        <refspec>+refs/heads/*:refs/remotes/origin/*</refspec>
        <url>https://gerrit.googlesource.com/a/plugins/readonly</url>
        <credentialsId>gerrit.googlesource.com</credentialsId>
      </hudson.plugins.git.UserRemoteConfig>
    </userRemoteConfigs>
    <branches>
      <hudson.plugins.git.BranchSpec>
        <name>*/master</name>
      </hudson.plugins.git.BranchSpec>
    </branches>
    <disableSubmodules>false</disableSubmodules>
    <recursiveSubmodules>false</recursiveSubmodules>
    <doGenerateSubmoduleConfigurations>false</doGenerateSubmoduleConfigurations>
    <remotePoll>false</remotePoll>
    <gitTool>Default</gitTool>
    <submoduleCfg class="list"/>
    <reference/>
    <gitConfigName/>
    <gitConfigEmail/>
    <extensions>
      <hudson.plugins.git.extensions.impl.WipeWorkspace/>
    </extensions>
  </scm>
  <triggers class="vector">
    <hudson.triggers.SCMTrigger>
      <spec>H/50 * * * *</spec>
      <ignorePostCommitHooks>false</ignorePostCommitHooks>
    </hudson.triggers.SCMTrigger>
  </triggers>
  <builders>
    <hudson.tasks.Shell>
      <command>#!/bin/bash -e
echo "machine gerrit.googlesource.com login $GS_GIT_USER password $GS_GIT_PASS"&gt;&gt; ~/.netrc
chmod 600 ~/.netrc
</command>
    </hudson.tasks.Shell>
    <hudson.tasks.Shell>
      <command>#!/bin/bash -e

. set-java.sh 11

echo "Building plugin readonly/master with Gerrit/stable-3.5"

git remote show gerrit &gt; /dev/null 2&gt;&amp;1 || git remote add gerrit https://gerrit.googlesource.com/a/gerrit
git fetch gerrit stable-3.5
git checkout -fb stable-3.5 gerrit/stable-3.5
git submodule update --init
git read-tree -u --prefix=plugins/readonly origin/master
git fetch --tags origin

for file in external_plugin_deps.bzl external_package.json
do
  if [ -f plugins/readonly/$file ]
  then
    cp -f plugins/readonly/$file plugins/
  fi
done

PLUGIN_SCM_BASE_URL="https://gerrit.googlesource.com/a"
for extraPlugin in 
do
    pushd ..
    git clone -b master $PLUGIN_SCM_BASE_URL/plugins/$extraPlugin
    popd
    pushd plugins
    ln -s ../../$extraPlugin .
    popd
done

TARGETS=$(echo "plugins/{name}:{name}" | sed -e 's/{name}/readonly/g')
java -fullversion
bazelisk version
bazelisk build $BAZEL_OPTS $TARGETS

BAZEL_OPTS="$BAZEL_OPTS --flaky_test_attempts 3 \
                   --test_timeout 3600 \
                   --test_tag_filters=-flaky \
                   --test_env DOCKER_HOST=$DOCKER_HOST"
bazelisk test $BAZEL_OPTS //tools/bzl:always_pass_test plugins/readonly/...

for JAR in $(find bazel-bin/plugins/readonly -maxdepth 1 -name readonly*.jar)
do
    PLUGIN_VERSION=$(git describe  --always origin/master)
    echo -e "Implementation-Version: $PLUGIN_VERSION" &gt; MANIFEST.MF
    jar ufm $JAR MANIFEST.MF &amp;&amp; rm MANIFEST.MF
    DEST_JAR=bazel-bin/plugins/readonly/$(basename $JAR)
    [ "$JAR" -ef "$DEST_JAR" ] || mv $JAR $DEST_JAR
    echo "$PLUGIN_VERSION" &gt; bazel-bin/plugins/readonly/$(basename $JAR-version)
done
</command>
    </hudson.tasks.Shell>
    <hudson.tasks.Shell>
      <command>#!/bin/bash -e

curl -L https://gerrit-review.googlesource.com/projects/plugins%2Freadonly/config | \
     tail -n +2 &gt; bazel-bin/plugins/readonly/readonly.json

</command>
    </hudson.tasks.Shell>
  </builders>
  <publishers>
    <hudson.tasks.ArtifactArchiver>
      <artifacts>bazel-bin/plugins/readonly/readonly.jar, bazel-bin/plugins/readonly/readonly.jar-version, bazel-bin/plugins/readonly/readonly.json, 
</artifacts>
      <allowEmptyArchive>false</allowEmptyArchive>
      <onlyIfSuccessful>false</onlyIfSuccessful>
      <fingerprint>false</fingerprint>
      <defaultExcludes>true</defaultExcludes>
      <caseSensitive>true</caseSensitive>
      <latestOnly>false</latestOnly>
    </hudson.tasks.ArtifactArchiver>
  </publishers>
  <buildWrappers>
    <hudson.plugins.build__timeout.BuildTimeoutWrapper>
      <strategy class="hudson.plugins.build_timeout.impl.AbsoluteTimeOutStrategy">
        <timeoutMinutes>60</timeoutMinutes>
      </strategy>
      <operationList>
        <hudson.plugins.build__timeout.operations.FailOperation/>
      </operationList>
    </hudson.plugins.build__timeout.BuildTimeoutWrapper>
    <hudson.plugins.timestamper.TimestamperBuildWrapper/>
    <org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper>
      <bindings>
        <org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding>
          <usernameVariable>GS_GIT_USER</usernameVariable>
          <passwordVariable>GS_GIT_PASS</passwordVariable>
          <credentialsId>gerrit.googlesource.com</credentialsId>
        </org.jenkinsci.plugins.credentialsbinding.impl.UsernamePasswordMultiBinding>
      </bindings>
    </org.jenkinsci.plugins.credentialsbinding.impl.SecretBuildWrapper>
  </buildWrappers>
</project>