blob: 68b057dabb3603d3a0fce73479e8d1d0f6f1e3f9 [file] [log] [blame]
Zack Williams7468c362018-04-06 09:52:30 -07001---
2# CORD JJB macros
3
4# control how long builds and artifact are retained
5- property:
6 name: cord-infra-properties
7 properties:
8 - build-discarder:
9 days-to-keep: '{build-days-to-keep}'
10 artifact-num-to-keep: '{artifact-num-to-keep}'
11
12# checkout entire source tree with repo
13# docs: https://docs.openstack.org/infra/jenkins-job-builder/scm.html#scm.repo
14- scm:
15 name: cord-infra-gerrit-repo-scm
16 scm:
17 - repo:
Zack Williamsc27ca2d2018-04-11 13:16:45 -070018 manifest-url: '{manifest-url}'
Zack Williams7468c362018-04-06 09:52:30 -070019 manifest-branch: '{branch}'
20 destination-dir: '{destination-dir}'
21 jobs: 4
22 reset-first: true
23 depth: 1
24
Zack Williams15a31c82018-08-29 15:10:03 -070025# same as lf-infra-gerrit-scm, but allows checkouts to a subdir of $WORKSPACE
26# with the `basedir` option
27#
28# `basedir` serves the same function as `destination-dir` in the repo scm
29# macros, seems strange that they're named differently.
30- scm:
31 name: cord-infra-gerrit-scm
32 scm:
33 - git:
34 credentials-id: '{jenkins-ssh-credential}'
35 url: '{git-url}'
36 refspec: '{refspec}'
37 branches:
38 - 'refs/heads/{branch}'
39 skip-tag: true
40 wipe-workspace: true
41 submodule:
42 recursive: '{submodule-recursive}'
43 choosing-strategy: '{choosing-strategy}'
44 basedir: '{basedir}'
45
Zack Williamsc27ca2d2018-04-11 13:16:45 -070046# download a specific patchset after checking out entire source tree with repo
Zack Williams7468c362018-04-06 09:52:30 -070047# docs: https://docs.openstack.org/infra/jenkins-job-builder/builders.html#builders.inject
48- builder:
49 name: cord-infra-gerrit-repo-patch
50 builders:
51 - inject:
52 properties-content: |
Zack Williamsc27ca2d2018-04-11 13:16:45 -070053 DESTINATION_DIR={destination-dir}
Zack Williams7468c362018-04-06 09:52:30 -070054 GERRIT_PROJECT={project}
55 GERRIT_CHANGE_NUMBER={change-number}
56 GERRIT_PATCHSET_NUMBER={patchset-number}
57 - shell: !include-raw-escape: shell/repopatch.sh
58
Kailash Khalasi02cd79c2018-04-30 15:05:09 -070059# sonarqube-ongoing-coverage
60- builder:
61 name: cord-infra-sonarqube
62 builders:
Zack Williamsefc1cb92018-07-17 14:11:08 -070063 - inject:
64 properties-content: |
Zack Williams9d98e602018-07-17 15:11:31 -070065 SONAR_PREP_COMMANDS={sonar-prep-commands}
Zack Williamsefc1cb92018-07-17 14:11:08 -070066 - shell: !include-raw-escape: shell/sonarprep.sh
Kailash Khalasi02cd79c2018-04-30 15:05:09 -070067 - sonar:
Zack Williamseb042292019-01-14 17:12:29 -070068 sonar-name: 'sonar.opencord.org'
Kailash Khalasi02cd79c2018-04-30 15:05:09 -070069 java-opts: '-Xmx1280m'
70 properties: |
71 sonar.sources=.
72 sonar.projectKey={project}_$GERRIT_BRANCH
73 sonar.python.pylint=/usr/local/bin/pylint
Zack Williams9d98e602018-07-17 15:11:31 -070074 sonar.java.binaries={sonar-java-binaries}
Kailash Khalasi02cd79c2018-04-30 15:05:09 -070075
Zack Williams7468c362018-04-06 09:52:30 -070076# trigger on gerrit patchsets and actions
77# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
78- trigger:
79 name: cord-infra-gerrit-trigger-patchset
80 triggers:
Zack Williamse64341b2018-04-10 22:14:35 -070081 - gerrit:
82 server-name: '{gerrit-server-name}'
83 dependency-jobs: '{dependency-jobs}'
84 silent-start: true
85 trigger-on:
86 - patchset-created-event:
87 exclude-drafts: true
88 exclude-trivial-rebase: false
89 exclude-no-code-change: true
90 - draft-published-event
91 - comment-added-contains-event:
92 comment-contains-value: '(?i)^.*recheck$'
93 projects:
94 - project-compare-type: REG_EXP
95 project-pattern: '{project-regexp}'
96 branches:
97 - branch-compare-type: REG_EXP
98 branch-pattern: '{branch-regexp}'
Zack Williamsc27ca2d2018-04-11 13:16:45 -070099 file-paths:
100 - compare-type: REG_EXP
101 pattern: '{file-include-regexp}'
Zack Williams7468c362018-04-06 09:52:30 -0700102
103# trigger on gerrit commits/merges
104- trigger:
105 name: cord-infra-gerrit-trigger-merge
106 triggers:
Zack Williamse64341b2018-04-10 22:14:35 -0700107 - gerrit:
108 server-name: '{gerrit-server-name}'
109 dependency-jobs: '{dependency-jobs}'
Zack Williams9ac51db2018-04-16 16:44:24 -0700110 silent-start: true
Zack Williamse64341b2018-04-10 22:14:35 -0700111 trigger-on:
112 - change-merged-event
113 projects:
114 - project-compare-type: REG_EXP
115 project-pattern: '{project-regexp}'
116 branches:
117 - branch-compare-type: REG_EXP
118 branch-pattern: '{branch-regexp}'
Zack Williamsc27ca2d2018-04-11 13:16:45 -0700119 file-paths:
120 - compare-type: REG_EXP
121 pattern: '{file-include-regexp}'
Zack Williams5aa37e12019-02-13 13:28:29 -0700122
123# wrapper to provide pypi config file
124
125- wrapper:
126 name: cord-pypi-wrapper
127 wrappers:
128 - mask-passwords
129 - timeout:
130 type: absolute
131 timeout: '{build-timeout}'
132 timeout-var: 'BUILD_TIMEOUT'
133 fail: true
134 - timestamps
135 - ssh-agent-credentials:
136 users:
137 - '{jenkins-ssh-credential}'
138 - config-file-provider:
139 files:
140 - file-id: pypirc
141 target: '$HOME/.pypirc'
142 - file-id: pipconf
143 target: '$HOME/.config/pip/pip.conf'