c866d89b524fd7fb3b4c32a8286d26687fccd1ae
[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         - 'opnfv-build-ubuntu-defaults'
76
77     scm:
78         - git-scm
79
80     triggers:
81         - timed: '@midnight'
82
83     builders:
84         - trigger-builds:
85           - project: 'onosfw-build-{stream}'
86             git-revision: true
87             block: true
88
89 - job-template:
90     name: 'onosfw-build-{stream}'
91
92     disabled: '{obj:disabled}'
93
94     parameters:
95         - project-parameter:
96             project: '{project}'
97         - 'opnfv-build-ubuntu-defaults'
98         - string:
99             name: GS_URL
100             default: '$GS_BASE{gs-pathname}'
101             description: "Directory where the build artifact will be located upon the completion     of the build."
102
103     scm:
104         - git-scm
105
106     builders:
107         - 'builder-onosfw-helloworld'
108
109 ########################
110 # builder macros
111 ########################
112 - builder:
113     name: 'builder-onosfw-build'
114     builders:
115         - shell: |
116             #!/bin/bash
117             set -o errexit
118             set -o nounset
119             set -o pipefail
120
121             # log info to console
122             echo "Starting the build of $PROJECT. This could take some time..."
123             echo "--------------------------------------------------------"
124             echo
125
126             # create the cache directory if it doesn't exist
127             [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
128             [[ -d $BUILD_DIRECTORY ]] || mkdir -p $BUILD_DIRECTORY
129
130             # set OPNFV_ARTIFACT_VERSION
131             export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
132
133             # start the build
134             cd $WORKSPACE/
135             ./ci/build.sh  $BUILD_DIRECTORY/
136
137             # list the build artifacts
138             ls -al $BUILD_DIRECTORY
139
140             # save information regarding artifact into file
141             (
142                 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
143                 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
144                 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
145                 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
146                 echo "OPNFV_ARTIFACT_SHA512SUM=$(sha512sum $BUILD_DIRECTORY/onosfw.iso | cut -d' ' -f1)"
147                 echo "OPNFV_BUILD_URL=$BUILD_URL"
148             ) > $BUILD_DIRECTORY/opnfv.properties
149             echo
150             echo "--------------------------------------------------------"
151             echo "Done!"
152
153
154 - builder:
155     name: 'builder-onosfw-upload-artifact'
156     builders:
157         - shell: |
158             #!/bin/bash
159             set -o errexit
160             set -o nounset
161             set -o pipefail
162
163             # log info to console
164             echo "Uploading the $INSTALLER artifact. This could take some time..."
165             echo "--------------------------------------------------------"
166             echo
167
168             # source the opnfv.properties to get ARTIFACT_VERSION
169             source $BUILD_DIRECTORY/opnfv.properties
170
171             # upload artifact and additional files to google storage
172             gsutil cp $BUILD_DIRECTORY/onosfw.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
173             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
174             gsutil cp $BUILD_DIRECTORY/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
175
176             echo
177             echo "--------------------------------------------------------"
178             echo "Done!"
179             echo "Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
180
181
182 - builder:
183     name: 'builder-onosfw-helloworld'
184     builders:
185         - shell: |
186             #!/bin/bash
187             echo "Hello world!"