blob: 4d05c2f2a9ad563dc927502fc5cbc940a58f3669 [file] [log] [blame]
---
# CORD JJB macros
# control how long builds and artifact are retained
- property:
name: cord-infra-properties
properties:
- build-discarder:
days-to-keep: '{build-days-to-keep}'
artifact-num-to-keep: '{artifact-num-to-keep}'
# checkout entire source tree with repo
# docs: https://docs.openstack.org/infra/jenkins-job-builder/scm.html#scm.repo
- scm:
name: cord-infra-gerrit-repo-scm
scm:
- repo:
manifest-url: '{manifest-url}'
manifest-branch: '{branch}'
destination-dir: '{destination-dir}'
jobs: 4
reset-first: true
depth: 1
# same as lf-infra-gerrit-scm, but allows checkouts to a subdir of $WORKSPACE
# with the `basedir` option
#
# `basedir` serves the same function as `destination-dir` in the repo scm
# macros, seems strange that they're named differently.
- scm:
name: cord-infra-gerrit-scm
scm:
- git:
credentials-id: '{jenkins-ssh-credential}'
url: '{git-url}'
refspec: '{refspec}'
branches:
- 'refs/heads/{branch}'
skip-tag: true
wipe-workspace: true
submodule:
recursive: '{submodule-recursive}'
choosing-strategy: '{choosing-strategy}'
basedir: '{basedir}'
# download a specific patchset after checking out entire source tree with repo
# docs: https://docs.openstack.org/infra/jenkins-job-builder/builders.html#builders.inject
- builder:
name: cord-infra-gerrit-repo-patch
builders:
- inject:
properties-content: |
DESTINATION_DIR={destination-dir}
GERRIT_PROJECT={project}
GERRIT_CHANGE_NUMBER={change-number}
GERRIT_PATCHSET_NUMBER={patchset-number}
- shell: !include-raw-escape: shell/repopatch.sh
# sonarqube-ongoing-coverage
- builder:
name: cord-infra-sonarqube
builders:
- inject:
properties-content: |
SONAR_PREP_COMMANDS={sonar-prep-commands}
- shell: !include-raw-escape: shell/sonarprep.sh
- sonar:
sonar-name: 'sonar.opencord.org'
java-opts: '-Xmx1280m'
properties: |
sonar.sources=.
sonar.projectKey={project}_$GERRIT_BRANCH
sonar.python.pylint=/usr/local/bin/pylint
sonar.java.binaries={sonar-java-binaries}
# trigger on gerrit patchsets and actions
# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
- trigger:
name: cord-infra-gerrit-trigger-patchset
triggers:
- gerrit:
server-name: '{gerrit-server-name}'
dependency-jobs: '{dependency-jobs}'
silent-start: true
trigger-on:
- patchset-created-event:
exclude-drafts: true
exclude-trivial-rebase: false
exclude-no-code-change: true
- draft-published-event
- comment-added-contains-event:
comment-contains-value: '(?i)^.*recheck$'
projects:
- project-compare-type: REG_EXP
project-pattern: '{project-regexp}'
branches:
- branch-compare-type: REG_EXP
branch-pattern: '{branch-regexp}'
file-paths:
- compare-type: REG_EXP
pattern: '{file-include-regexp}'
# trigger on gerrit commits/merges
- trigger:
name: cord-infra-gerrit-trigger-merge
triggers:
- gerrit:
server-name: '{gerrit-server-name}'
dependency-jobs: '{dependency-jobs}'
silent-start: true
trigger-on:
- change-merged-event
projects:
- project-compare-type: REG_EXP
project-pattern: '{project-regexp}'
branches:
- branch-compare-type: REG_EXP
branch-pattern: '{branch-regexp}'
file-paths:
- compare-type: REG_EXP
pattern: '{file-include-regexp}'