blob: 4656c9c7ac788164eacbb8bb82b329c945368e32 [file] [log] [blame]
Zack Williams3403ff42019-08-13 18:30:42 -07001# JJB Macros for ONF jobs
2
pierventrefb03d642020-07-02 23:10:12 +02003# basic string parameters for onf projects
4# differs from lf-infra-parameters as it allows to speficy a different gerrit project
5- parameter:
6 name: onf-infra-parameters
7 parameters:
8 - string:
9 name: PROJECT
10 default: '{project}'
11 - string:
12 name: STREAM
13 default: '{stream}'
14 - string:
15 name: GERRIT_PROJECT
16 default: '{gerrit_project}'
17 - string:
18 name: GERRIT_BRANCH
19 default: '{stream}'
20 - string:
21 name: GERRIT_REFSPEC
22 default: "refs/heads/{stream}"
23 - string:
24 name: sha1
25 default: "origin/{stream}"
26
Zack Williams3403ff42019-08-13 18:30:42 -070027# control how long builds and artifact are retained
28# differs from lf-infra-properties as it retains artifacts
29- property:
30 name: onf-infra-properties
31 properties:
32 - build-discarder:
33 days-to-keep: '{build-days-to-keep}'
34 artifact-num-to-keep: '{artifact-num-to-keep}'
35
pierventrefb03d642020-07-02 23:10:12 +020036- property:
37 name: onf-infra-docker-properties
38 properties:
39 - docker-container:
40 credentials-id: '{docker-credentials-id}'
41 docker-registry-url: '{docker-registry}'
Zack Williams3403ff42019-08-13 18:30:42 -070042
43# trigger on gerrit patchsets and actions
44# docs: https://docs.openstack.org/infra/jenkins-job-builder/triggers.html#triggers.gerrit
45# Uses a regex based project match
46- trigger:
47 name: onf-infra-gerrit-trigger-patchset
48 triggers:
49 - gerrit:
50 server-name: '{gerrit-server-name}'
51 dependency-jobs: '{dependency-jobs}'
52 silent-start: true
53 trigger-on:
54 - patchset-created-event:
55 exclude-drafts: true
56 exclude-trivial-rebase: false
57 exclude-no-code-change: false
58 - draft-published-event
59 - comment-added-contains-event:
60 comment-contains-value: '(?i)^.*recheck$'
61 projects:
62 - project-compare-type: REG_EXP
63 project-pattern: '{project-regexp}'
64 branches:
65 - branch-compare-type: REG_EXP
66 branch-pattern: '{branch-regexp}'
67 file-paths:
68 - compare-type: REG_EXP
69 pattern: '{file-include-regexp}'
70
71
72# same as lf-infra-gerrit-scm, but allows checkouts to a subdir of $WORKSPACE
73# with the `basedir` option
74#
75# `basedir` serves the same function as `destination-dir` in the repo scm
76# macros, seems strange that they're named differently.
77- scm:
78 name: onf-infra-gerrit-scm
79 scm:
80 - git:
81 credentials-id: '{jenkins-ssh-credential}'
82 url: '{git-url}'
83 refspec: '{refspec}'
84 branches:
85 - 'refs/heads/{branch}'
86 skip-tag: true
87 wipe-workspace: true
88 submodule:
89 recursive: '{submodule-recursive}'
90 choosing-strategy: '{choosing-strategy}'
91 basedir: '{basedir}'
92
93
94# trigger for gerrit patch submission
95- trigger:
96 name: onf-infra-gerrit-trigger-merge
97 triggers:
98 - gerrit:
99 server-name: '{gerrit-server-name}'
100 dependency-jobs: '{dependency-jobs}'
101 silent-start: true
102 trigger-on:
103 - change-merged-event
104 projects:
105 - project-compare-type: REG_EXP
106 project-pattern: '{project-regexp}'
107 branches:
108 - branch-compare-type: REG_EXP
109 branch-pattern: '{branch-regexp}'
110 file-paths:
111 - compare-type: REG_EXP
112 pattern: '{file-include-regexp}'
113
114# wrapper to provide SSH key and fill in ~/.ssh/known_hosts file for use with rsync
115- wrapper:
116 name: onf-infra-rsync-wrappers
117 wrappers:
118 - mask-passwords
119 - timeout:
120 type: absolute
121 timeout: '{build-timeout}'
122 timeout-var: 'BUILD_TIMEOUT'
123 fail: true
124 - timestamps
125 - ssh-agent-credentials:
126 users:
127 - '{jenkins-ssh-credential}'
128 - config-file-provider:
129 files:
130 - file-id: known_hosts
131 target: '$HOME/.ssh/known_hosts'
132
pierventrefb03d642020-07-02 23:10:12 +0200133# publisher to clean up the workspace after the build whatever the result
134- publisher:
135 name: onf-infra-wscleanup-publisher
136 publishers:
137 - workspace-cleanup:
138 clean-if:
139 - success: true
140 - unstable: true
141 - failure: true
142 - aborted: true
143 - not-built: true
144 dirmatch: false
145 fail-build: true
146 clean-parent: false
147 disable-deferred-wipeout: false