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