blob: 5a0f25b8db0b084880c76d05f019789705870b2f [file] [log] [blame]
- builder:
name: set-git-credentials
builders:
- shell: |
#!/bin/bash -e
echo "machine gerrit.googlesource.com login $GS_GIT_USER password $GS_GIT_PASS">> ~/.netrc
chmod 600 ~/.netrc
- builder:
name: merge-target-branch
builders:
- shell: |
#!/bin/bash -e
cd gerrit
git fetch origin $TARGET_BRANCH
git config user.name "Jenkins Build"
git config user.email "jenkins@gerritforge.com"
git merge --no-commit --no-edit --no-ff FETCH_HEAD
- builder:
name: fetch-all-submodules
builders:
- shell: |
#!/bin/bash -e
set +x
cd gerrit
function fetch_submodules {
# We do need to call update even if we know it will fail: the submodules git needs
# to be initialised and made it pointing to the correct remote submodule URL
git submodule update > /dev/null 2> /dev/null || true
export SUBMODULES=$(git submodule status | awk '{print $2}')
for module in $SUBMODULES
do
echo "Fetching all changes refs for $module ..."
pushd $module > /dev/null
git fetch -q origin +refs/changes/*:refs/changes/*
popd > /dev/null
done
}
git submodule init
# Fetch submodules refs/changes as fallback action of a submodule update failure
echo "Updating all submodules ..."
git submodule update || ( fetch_submodules && git submodule update )
- defaults:
name: verifier-defaults
concurrent: true
parameters:
- string:
name: CHANGE_URL
description: 'Gerrit Change URL to build'
- string:
name: REFSPEC
description: 'Git refspec to use for fetching changes'
- string:
name: BRANCH
description: 'Git SHA1 of the path-set to verify'
- string:
name: TARGET_BRANCH
description: 'Git target branch of the change'
- choice:
name: MODE
choices:
- notedb
- polygerrit
- rbe
description: 'Type of verification to execute'
properties:
- authorization:
anonymous:
- job-discover
- job-read
- job-extended-read
- build-discarder:
days-to-keep: 30
- inject:
properties-content: >
BAZEL_OPTS=--remote_cache=https://gerrit-ci.gerritforge.com/cache
scm:
- git:
url: https://gerrit.googlesource.com/a/gerrit
reference-repo: /home/jenkins/gerrit-reference.git
credentials-id: gerrit.googlesource.com
refspec: $REFSPEC
branches:
- $BRANCH
submodule:
disable: true
reference-repo: /home/jenkins/gerrit-reference.git
skip-tag: true
basedir: gerrit
wrappers:
- timestamps
- credentials-binding:
- username-password-separated:
credential-id: gerrit.googlesource.com
username: GS_GIT_USER
password: GS_GIT_PASS
- text:
credential-id: remote_bb_key
variable: BB_API_KEY
- raw:
xml: |
<hudson.plugins.build__timeout.BuildTimeoutWrapper plugin="build-timeout@1.16">
<strategy class="hudson.plugins.build_timeout.impl.NoActivityTimeOutStrategy">
<timeoutSecondsString>750</timeoutSecondsString>
</strategy>
<operationList>
<hudson.plugins.build__timeout.operations.AbortOperation/>
</operationList>
</hudson.plugins.build__timeout.BuildTimeoutWrapper>
publishers:
- groovy-postbuild:
script: |
(manager.logContains('timed out') || manager.logContains('TIMEOUT in ')) \
? manager.buildAborted() : false
- job-template:
name: Gerrit-verifier-{config}
description: 'Gerrit build of open change with {config}'
defaults: verifier-defaults
node: bazel-debian-{config}
builders:
- set-git-credentials
- merge-target-branch
- fetch-all-submodules
- shell: !include-raw-escape: gerrit-bazel-cleancache.sh
- shell: !include-raw-escape: gerrit-bazel-build.sh
- shell: !include-raw-escape: gerrit-bazel-verifier-test.sh
- shell: !include-raw-escape: gerrit-bazel-cat-test-log.sh
properties:
- authorization:
anonymous:
- job-discover
- job-read
- job-extended-read
- build-discarder:
days-to-keep: 30
- inject:
properties-content: >
BAZEL_OPTS=--remote_cache=https://gerrit-ci.gerritforge.com/cache
- project:
name: Gerrit-verifier-bazel-chrome-latest
config:
- chrome-latest
jobs:
- 'Gerrit-verifier-{config}'
- job:
name: Gerrit-codestyle
description: 'Gerrit code-style checker for an open change'
defaults: verifier-defaults
node: bazel-debian
builders:
- set-git-credentials
- merge-target-branch
- fetch-all-submodules
- shell: !include-raw-escape: gerrit-bazel-cleancache.sh
- shell: !include-raw-escape: gerrit-codestyle-gjf.sh
- shell: !include-raw-escape: gerrit-codestyle-polygerrit-lint.sh
- shell: !include-raw-escape: gerrit-codestyle-buildifier.sh
- job:
name: 'Gerrit-verifier-pipeline'
description: Multi-branch pipeline to validate Gerrit
project-type: multibranch
node: server
days-to-keep: 90
prune-dead-branches: true
scm:
- gerrit:
url: https://gerrit-review.googlesource.com/a/gerrit
reference-repo: /home/jenkins/gerrit-reference.git
credentials-id: gerrit.googlesource.com
refspecs:
- '+refs/heads/*:refs/remotes/@{remote}/*'
filter-checks:
query-operator: 'SCHEME'
query-string: 'gerritforge'
property-strategies:
all-branches:
- suppress-scm-triggering: false
- pipeline-branch-durability-override: max-survivability
periodic-folder-trigger: 5m