Restrict Gerrit Triggers to OPNFV Gerrit Server
[releng.git] / jjb / onosfw / onosfw.yml
1 - project:
2
3     name: onosfw
4
5     jobs:
6         - 'onosfw-verify-{stream}'
7         - 'onosfw-daily-{stream}'
8         - 'onosfw-build-{stream}'
9
10 # only master branch is enabled at the moment to keep no of jobs sane
11     stream:
12         - master:
13             branch: '{stream}'
14             gs-pathname: ''
15             disabled: false
16         - colorado:
17             branch: 'stable/{stream}'
18             gs-pathname: '/{stream}'
19             disabled: false
20
21     project: 'onosfw'
22
23 ########################
24 # job templates
25 ########################
26 - job-template:
27     name: 'onosfw-verify-{stream}'
28
29     disabled: '{obj:disabled}'
30
31     parameters:
32         - project-parameter:
33             project: '{project}'
34         - gerrit-parameter:
35             branch: '{branch}'
36         - 'opnfv-build-ubuntu-defaults'
37
38     scm:
39         - gerrit-trigger-scm:
40             credentials-id: '{ssh-credentials}'
41             refspec: '$GERRIT_REFSPEC'
42             choosing-strategy: 'gerrit'
43
44     triggers:
45         - gerrit:
46             server-name: 'gerrit.opnfv.org'
47             trigger-on:
48                 - patchset-created-event:
49                     exclude-drafts: 'false'
50                     exclude-trivial-rebase: 'false'
51                     exclude-no-code-change: 'false'
52                 - draft-published-event
53                 - comment-added-contains-event:
54                     comment-contains-value: 'recheck'
55                 - comment-added-contains-event:
56                     comment-contains-value: 'reverify'
57             projects:
58               - project-compare-type: 'ANT'
59                 project-pattern: '{project}'
60                 branches:
61                   - branch-compare-type: 'ANT'
62                     branch-pattern: '**/{branch}'
63                 forbidden-file-paths:
64                   - compare-type: ANT
65                     pattern: 'docs/**|.gitignore'
66
67     builders:
68         - 'builder-onosfw-helloworld'
69
70 - job-template:
71     name: 'onosfw-daily-{stream}'
72
73     disabled: '{obj:disabled}'
74
75     parameters:
76         - project-parameter:
77             project: '{project}'
78         - 'opnfv-build-ubuntu-defaults'
79
80     scm:
81         - git-scm:
82             credentials-id: '{ssh-credentials}'
83             refspec: ''
84             branch: '{branch}'
85
86     triggers:
87         - timed: '@midnight'
88
89     builders:
90         - trigger-builds:
91           - project: 'onosfw-build-{stream}'
92             git-revision: true
93             block: true
94
95 - job-template:
96     name: 'onosfw-build-{stream}'
97
98     disabled: '{obj:disabled}'
99
100     parameters:
101         - project-parameter:
102             project: '{project}'
103         - 'opnfv-build-ubuntu-defaults'
104         - string:
105             name: GS_URL
106             default: '$GS_BASE{gs-pathname}'
107             description: "Directory where the build artifact will be located upon the completion     of the build."
108
109     scm:
110         - git-scm:
111             credentials-id: '{ssh-credentials}'
112             refspec: ''
113             branch: '{branch}'
114
115     builders:
116         - 'builder-onosfw-helloworld'
117
118 ########################
119 # builder macros
120 ########################
121 - builder:
122     name: 'builder-onosfw-build'
123     builders:
124         - shell: |
125             #!/bin/bash
126             set -o errexit
127             set -o nounset
128             set -o pipefail
129
130             # log info to console
131             echo "Starting the build of $PROJECT. This could take some time..."
132             echo "--------------------------------------------------------"
133             echo
134
135             # create the cache directory if it doesn't exist
136             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
137             [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
138
139             # set OPNFV_ARTIFACT_VERSION
140             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
141
142             # start the build
143             cd $WORKSPACE/
144             ./ci/build.sh  $BUILD_DIRECTORY/
145
146             # list the build artifacts
147             ls -al $BUILD_DIRECTORY
148
149             # save information regarding artifact into file
150             (
151                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
152                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
153                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
154                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
155                 echo "OPNFV_ARTIFACT_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/onosfw.iso | cut -d' ' -f1)"
156                 echo "OPNFV_BUILD_URL=$BUILD_URL"
157             ) > $BUILD_DIRECTORY/opnfv.properties
158             echo
159             echo "--------------------------------------------------------"
160             echo "Done!"
161
162
163 - builder:
164     name: 'builder-onosfw-upload-artifact'
165     builders:
166         - shell: |
167             #!/bin/bash
168             set -o errexit
169             set -o nounset
170             set -o pipefail
171
172             # log info to console
173             echo "Uploading the $INSTALLER artifact. This could take some time..."
174             echo "--------------------------------------------------------"
175             echo
176
177             # source the opnfv.properties to get ARTIFACT_VERSION
178             source $BUILD_DIRECTORY/opnfv.properties
179
180             # upload artifact and additional files to google storage
181             gsutil cp $BUILD_DIRECTORY/onosfw.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
182             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
183             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
184
185             echo
186             echo "--------------------------------------------------------"
187             echo "Done!"
188             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
189
190
191 - builder:
192     name: 'builder-onosfw-helloworld'
193     builders:
194         - shell: |
195             #!/bin/bash
196             echo "Hello world!"