blob: 81b573917bdedfa95c3050492bfda9164db97a8f [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:
- reviewdb
- 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
--java_toolchain=//tools:error_prone_warnings_toolchain
scm:
- git:
url: https://gerrit.googlesource.com/a/gerrit
credentials-id: gerrit.googlesource.com
refspec: $REFSPEC
branches:
- $BRANCH
submodule:
disable: true
skip-tag: true
basedir: gerrit
wrappers:
- credentials-binding:
- username-password-separated:
credential-id: gerrit.googlesource.com
username: GS_GIT_USER
password: GS_GIT_PASS
- 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:
name: Gerrit-verifier-bazel
description: 'Gerrit build of open change with Bazel'
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-bazel-build.sh
- shell: !include-raw-escape: set-docker-host.sh
- shell: !include-raw-escape: gerrit-bazel-verifier-test.sh
- shell: !include-raw-escape: gerrit-bazel-cat-test-log.sh
publishers:
- archive:
artifacts: >
gerrit/bazel-bin/release.war,
gerrit/bazel-bin/*api/*api.jar,
gerrit/bazel-bin/gerrit-acceptance-framework/*.jar
excludes: 'gerrit/bazel-bin/plugins/core*/**/*.jar'
- job-template:
name: Gerrit-verifier-{config}
description: 'Gerrit build of open change with {config}'
defaults: verifier-defaults
node: bazel-{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: set-docker-host.sh
- shell: !include-raw-escape: gerrit-bazel-verifier-test.sh
- shell: !include-raw-escape: gerrit-bazel-cat-test-log.sh
publishers:
- archive:
artifacts: >
gerrit/bazel-bin/*.war,gerrit/bazel-bin/plugins/*/*.jar,
gerrit/bazel-bin/*api/*api.jar,
gerrit/bazel-bin/gerrit-acceptance-framework/*.jar
excludes: 'gerrit/bazel-bin/plugins/core*/**/*.jar'
- project:
name: Gerrit-verifier-bazel
config:
- chrome80
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: master
days-to-keep: 90
prune-dead-branches: true
scm:
- gerrit:
url: https://gerrit-review.googlesource.com/a/gerrit
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