Merge "fixes for docs-build.sh migration"
[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: 'master'
14             gs-pathname: ''
15 #        - brahmaputra:
16 #            branch: 'stable/brahmaputra'
17 #            gs-pathname: '/brahmaputra'
18
19     project: 'onosfw'
20
21 ########################
22 # job templates
23 ########################
24 - job-template:
25     name: 'onosfw-verify-{stream}'
26
27     parameters:
28         - project-parameter:
29             project: '{project}'
30         - gerrit-parameter:
31             branch: '{branch}'
32         - 'opnfv-build-ubuntu-defaults'
33
34     scm:
35         - gerrit-trigger-scm:
36             credentials-id: '{ssh-credentials}'
37             refspec: '$GERRIT_REFSPEC'
38             choosing-strategy: 'gerrit'
39
40     triggers:
41         - gerrit:
42             trigger-on:
43                 - patchset-created-event:
44                     exclude-drafts: 'false'
45                     exclude-trivial-rebase: 'false'
46                     exclude-no-code-change: 'false'
47                 - draft-published-event
48                 - comment-added-contains-event:
49                     comment-contains-value: 'recheck'
50                 - comment-added-contains-event:
51                     comment-contains-value: 'reverify'
52             projects:
53               - project-compare-type: 'ANT'
54                 project-pattern: '{project}'
55                 branches:
56                   - branch-compare-type: 'ANT'
57                     branch-pattern: '**/{branch}'
58                 forbidden-file-paths:
59                   - compare-type: ANT
60                     pattern: 'docs/**|.gitignore'
61
62     builders:
63         - 'builder-onosfw-helloworld'
64
65 - job-template:
66     name: 'onosfw-daily-{stream}'
67
68     parameters:
69         - project-parameter:
70             project: '{project}'
71         - 'opnfv-build-ubuntu-defaults'
72
73     scm:
74         - git-scm:
75             credentials-id: '{ssh-credentials}'
76             refspec: ''
77             branch: '{branch}'
78
79     triggers:
80         - timed: '@midnight'
81
82     builders:
83         - trigger-builds:
84           - project: 'onosfw-build-{stream}'
85             git-revision: true
86             block: true
87
88 - job-template:
89     name: 'onosfw-build-{stream}'
90
91     parameters:
92         - project-parameter:
93             project: '{project}'
94         - 'opnfv-build-ubuntu-defaults'
95         - string:
96             name: GS_URL
97             default: '$GS_BASE{gs-pathname}'
98             description: "Directory where the build artifact will be located upon the completion     of the build."
99
100     scm:
101         - git-scm:
102             credentials-id: '{ssh-credentials}'
103             refspec: ''
104             branch: '{branch}'
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_MD5SUM=$(md5sum $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!"