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