Merge "joid: correct keystone ip fetch for noha mode - correct admin-password"
[releng.git] / jjb / functest / res-build.sh
1 #!/bin/bash
2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2016 Orange and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10 set -e
11 set -o pipefail
12
13 export PATH=$PATH:/usr/local/bin/
14
15 git_sha1="$(git rev-parse HEAD)"
16 res_build_date=$(date -u +"%Y-%m-%d_%H-%M-%S")
17
18 # Result directory in the jumphost
19 # to be used only with CI
20 dir_result="${HOME}/opnfv/functest/results"
21
22 # Clean the results directory
23 # remove json file for rally, export only html
24 # json should have been pushed into the DB
25 rm -f $dir_result/rally/*.json
26
27 # Several information are required: date and testbed
28 # date is generated by functest so on the artifact, the results shall be under functest/<testbed id>/date/
29 testbed=$NODE_NAME
30
31 project_artifact=logs/functest/$testbed/$res_build_date
32
33 # copy folder to artifact
34 if [ -d "$dir_result" ]; then
35     if [ "$(ls -A $dir_result)" ]; then
36           echo "copy result files to artifact $project_artifact"
37           gsutil -m cp -r "$dir_result" gs://artifacts.opnfv.org/"$project_artifact"/
38
39           # delete local results
40           # should not be useful as the container is about to die...just in case
41           rm -Rf /home/opnfv/functest/results/*
42     else
43           echo "Result folder is empty"
44     fi
45 else
46     echo "No result folder found"
47 fi