4 - 'apex-verify-{stream}'
5 - 'apex-merge-{stream}'
6 - 'apex-daily-{stream}'
8 # stream: branch with - in place of / (eg. stable-arno)
9 # branch: branch (eg. stable/arno)
20 name: 'apex-verify-{stream}'
24 project-type: freestyle
29 artifactDaysToKeep: -1
34 gs-pathname: '{gs-pathname}'
42 default: ssh://gerrit.opnfv.org:29418/$PROJECT
43 description: "Used for overriding the GIT URL coming from parameters macro."
47 credentials-id: '{ssh-credentials}'
48 refspec: '$GERRIT_REFSPEC'
49 choosing-strategy: 'gerrit'
52 - ssh-agent-credentials:
53 user: '{ssh-credentials}'
58 - patchset-created-event:
59 exclude-drafts: 'false'
60 exclude-trivial-rebase: 'false'
61 exclude-no-code-change: 'false'
62 - draft-published-event
63 - comment-added-contains-event:
64 comment-contains-value: 'recheck'
65 - comment-added-contains-event:
66 comment-contains-value: 'reverify'
68 - project-compare-type: 'ANT'
69 project-pattern: 'apex'
71 - branch-compare-type: 'ANT'
72 branch-pattern: '**/master'
79 - 'apex-deploy-virtual'
80 - 'apex-workspace-cleanup'
83 name: 'apex-merge-{stream}'
85 # builder-merge job to run JJB update
87 # This job's purpose is to update all the JJB
91 project-type: freestyle
96 artifactDaysToKeep: -1
101 gs-pathname: '{gs-pathname}'
109 default: ssh://gerrit.opnfv.org:29418/$PROJECT
110 description: "Used for overriding the GIT URL coming from parameters macro."
113 - gerrit-trigger-scm:
114 credentials-id: '{ssh-credentials}'
116 choosing-strategy: 'default'
119 - ssh-agent-credentials:
120 user: '{ssh-credentials}'
125 - change-merged-event
126 - comment-added-contains-event:
127 comment-contains-value: 'remerge'
129 - project-compare-type: 'ANT'
130 project-pattern: 'apex'
132 - branch-compare-type: 'ANT'
133 branch-pattern: '**/master'
134 forbidden-file-paths:
140 - 'apex-deploy-virtual'
141 - 'apex-workspace-cleanup'
144 name: 'apex-daily-{stream}'
146 # Job template for daily builders
148 # Required Variables:
149 # stream: branch with - in place of / (eg. stable)
150 # branch: branch (eg. stable)
155 project-type: freestyle
158 daysToKeep: '{build-days-to-keep}'
159 numToKeep: '{build-num-to-keep}'
160 artifactDaysToKeep: '{build-artifact-days-to-keep}'
161 artifactNumToKeep: '{build-artifact-num-to-keep}'
167 gs-pathname: '{gs-pathname}'
173 default: ssh://gerrit.opnfv.org:29418/$PROJECT
174 description: "Used for overriding the GIT URL coming from parameters macro."
178 credentials-id: '{ssh-credentials}'
183 - ssh-agent-credentials:
184 user: '{ssh-credentials}'
191 - 'apex-upload-artifact'
192 - 'apex-deploy-virtual'
193 - 'apex-workspace-cleanup'
195 ########################
197 ########################
202 name: BUILD_DIRECTORY
203 default: $WORKSPACE/build_output
204 description: "Directory where the build artifact will be located upon the completion of the build."
206 name: CACHE_DIRECTORY
207 default: $HOME/opnfv/cache/{gs-pathname}
208 description: "Directory where the cache to be used during the build is located."
211 default: https://gerrit.opnfv.org/gerrit/$PROJECT
212 description: "Used for overriding the GIT URL coming from Global Jenkins configuration in case if the stuff is done on none-LF HW."
215 default: artifacts.opnfv.org/$PROJECT/{gs-pathname}
216 description: "URL to Google Storage."
220 description: "Build Flags"
222 ########################
224 ########################
233 # log info to console
234 echo "Starting the build of Apex using OpenStack Master packages. This will take some time..."
235 echo "---------------------------------------------------------------------------------------"
236 echo "Build flags for this build are ${FLAGS}"
237 echo "---------------------------------------------------------------------------------------"
239 # create the cache directory if it doesn't exist
240 [[ -d $CACHE_DIRECTORY ]] || mkdir -p $CACHE_DIRECTORY
241 # set OPNFV_ARTIFACT_VERSION
242 export OPNFV_ARTIFACT_VERSION=$(date -u +"%Y-%m-%d_%H-%M-%S")
245 ./build.sh $FLAGS -v $OPNFV_ARTIFACT_VERSION -c file://$CACHE_DIRECTORY $BUILD_DIRECTORY
246 RPM_VERSION=$(grep Version $BUILD_DIRECTORY/../build/opnfv-apex.spec | awk '{ print $2 }')-$(echo $OPNFV_ARTIFACT_VERSION | tr -d '_-')
247 # list the contents of BUILD_OUTPUT directory
248 ls -al $BUILD_DIRECTORY
249 # save information regarding artifact into file
251 echo "OPNFV_ARTIFACT_VERSION=$OPNFV_ARTIFACT_VERSION"
252 echo "OPNFV_GIT_URL=$(git config --get remote.origin.url)"
253 echo "OPNFV_GIT_SHA1=$(git rev-parse HEAD)"
254 echo "OPNFV_ARTIFACT_URL=$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
255 echo "OPNFV_ARTIFACT_MD5SUM=$(md5sum $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso | cut -d' ' -f1)"
256 echo "OPNFV_SRPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.src.rpm"
257 echo "OPNFV_RPM_URL=$GS_URL/opnfv-apex-$RPM_VERSION.noarch.rpm"
258 echo "OPNFV_RPM_MD5SUM=$(md5sum $BUILD_DIRECTORY/opnfv-apex-$RPM_VERSION.noarch.rpm | cut -d' ' -f1)"
259 echo "OPNFV_BUILD_URL=$BUILD_URL"
260 ) > $WORKSPACE/opnfv.properties
262 echo "--------------------------------------------------------"
265 name: 'apex-workspace-cleanup'
273 # delete everything that is in $WORKSPACE
274 /bin/rm -rf $WORKSPACE
277 name: 'apex-upload-artifact'
285 # log info to console
286 echo "Uploading the Apex artifact. This could take some time..."
287 echo "--------------------------------------------------------"
290 # source the opnfv.properties to get ARTIFACT_VERSION
291 source $WORKSPACE/opnfv.properties
293 # upload artifact and additional files to google storage
294 gsutil cp $BUILD_DIRECTORY/OPNFV-CentOS-7-x86_64-$OPNFV_ARTIFACT_VERSION.iso gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso > gsutil.iso.log 2>&1
295 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_RPM_URL) gs://$GS_URL/$(basename $OPNFV_RPM_URL) > gsutil.iso.log 2>&1
296 gsutil cp $BUILD_DIRECTORY/$(basename $OPNFV_SRPM_URL) gs://$GS_URL/$(basename $OPNFV_SRPM_URL) > gsutil.iso.log 2>&1
297 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.properties > gsutil.properties.log 2>&1
298 gsutil cp $WORKSPACE/opnfv.properties gs://$GS_URL/latest.properties > gsutil.latest.log 2>&1
301 echo "--------------------------------------------------------"
303 echo "ISO Artifact is available as http://$GS_URL/opnfv-$OPNFV_ARTIFACT_VERSION.iso"
304 echo "RPM Artifact is available as http://$GS_URL/$(basename $OPNFV_RPM_URL)"
307 name: 'apex-deploy-virtual'
315 # log info to console
316 echo "Starting the Apex virtual deployment."
317 echo "--------------------------------------------------------"
320 # check if we got the file
321 if [[ -f opnfv.properties ]]; then
322 # source the file so we get OPNFV vars
323 source opnfv.properties
324 RPM_INSTALL_PATH=build_output/$(basename $OPNFV_RPM_URL)
326 # get the latest.properties file in order to get info regarding latest artifact
327 curl -s -o $WORKSPACE/opnfv.properties http://$GS_URL/latest.properties
328 [[ -f opnfv.properties ]] || exit 1
330 # source the file so we get OPNFV vars
331 source opnfv.properties
332 RPM_INSTALL_PATH=$RPM_URL
335 # update / install the new rpm
336 if rpm -q opnfv-apex > /dev/null; then
337 if sudo yum update -y $RPM_INSTALL_PATH | grep "does not update installed package"; then
338 sudo yum downgrade -y $RPM_INSTALL_PATH;
341 sudo yum install -y $RPM_INSTALL_PATH;
344 # cleanup virtual machines before we start
346 # initiate virtual deployment
350 echo "--------------------------------------------------------"
353 #######################
355 ########################