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