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