blob: ed1748b63f5ef3d3b8b6f9b1c641c9c6275d9532 [file] [log] [blame]
Aleksey Zvyagintsevb2199a42018-11-07 10:29:57 +00001#!/bin/bash
2
3set -ex
4
5export GERRIT_NAME=${GERRIT_NAME:-mcp-jenkins}
6# Would delete all .git folders.
7# Keep in mind, you would not able to get any other version or history!
8# Will ignore 'tempest' itself bz of:
9# ```
10# Exception: Versioning for this project requires either an sdist tarball, or access to an upstream git repository.
11# It's also possible that there is a mismatch between the package name in setup.cfg and the argument given to pbr.version.VersionInfo.
12# Project name tempest was given, but was not able to be found.
13# ```
14# FIXME|TODO Disabled by default.
15# Currently, pip not able to install any package w\o .git directory.
16# Should it be re-writed to tgz install or whatever?
17#export RELEASE_BUILD=${RELEASE_BUILD:-true}
18RELEASE_BUILD=false
19#
20export TEMPEST_TAG="${TEMPEST_TAG:-mcp/pike}"
21export HORIZON_TAG="${HORIZON_TAG:-mcp/pike}"
22export BARBICAN_TAG="${BARBICAN_TAG:-mcp/pike}"
23export DESIGNATE_TAG="${DESIGNATE_TAG:-mcp/pike}"
24export HEAT_TAG="${HEAT_TAG:-mcp/pike}"
25export IRONIC_TAG="${IRONIC_TAG:-mcp/pike}"
26export MANILA_TAG="${MANILA_TAG:-mcp/pike}"
27export TELEMETRY_TAG="${TELEMETRY_TAG:-mcp/pike}"
28export OCTAVIA_TAG="${OCTAVIA_TAG:-mcp/pike}"
29export PATROLE_TAG="${PATROLE_TAG:-0.4.x}"
30export TUNGSTEN_TAG="${TUNGSTEN_TAG:-0.1.x}"
31# global openstack requirements repo
32# This is the commit where tempest version is 17.2.0 in u-c
33export UPPER_CONSTRAINTS_TAG="${UPPER_CONSTRAINTS_TAG:-83b1de74834fbcdbe749e270c29e76cdc28f85d5}"
34
35function prepare(){
36 # TODO migrate to downstrem mirror?
37 mkdir -p data; pushd data
38 if [ ! -d openstack_requirements ] ; then
39 git clone https://github.com/openstack/requirements.git openstack_requirements
40 pushd openstack_requirements; git checkout $UPPER_CONSTRAINTS_TAG; popd
41 fi
42 sed -i -e "s|tempest=.*|git+file:///var/lib/tempest@${TEMPEST_TAG}#egg=tempest|g" \
43 openstack_requirements/upper-constraints.txt;
44 #
45 if [ ! -d tempest-horizon-plugin ] ; then
46 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/tempest-horizon tempest-horizon-plugin
47 pushd tempest-horizon-plugin ; git checkout $HORIZON_TAG; popd
48 fi
49 #
50 if [ ! -d barbican-tempest-plugin ] ; then
51 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/barbican-tempest-plugin
52 pushd barbican-tempest-plugin; git checkout $BARBICAN_TAG; popd
53 fi
54 #
55 if [ ! -d designate-tempest-plugin ] ; then
56 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/designate-tempest-plugin
57 pushd designate-tempest-plugin; git checkout $DESIGNATE_TAG; popd;
58 fi
59 #
60 if [ ! -d heat-tempest-plugin ] ; then
61 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/heat-tempest-plugin
62 pushd heat-tempest-plugin; git checkout $HEAT_TAG; popd
63 fi
64 #
65 if [ ! -d ironic-tempest-plugin ] ; then
66 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/ironic-tempest-plugin
67 pushd ironic-tempest-plugin; git checkout $IRONIC_TAG; popd;
68 fi
69 #
70 if [ ! -d manila-tempest-plugin ] ; then
71 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/manila-tempest-plugin
72 pushd manila-tempest-plugin; git checkout $MANILA_TAG; popd;
73 fi
74 #
75 if [ ! -d telemetry-tempest-plugin ] ; then
76 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/telemetry-tempest-plugin
77 pushd telemetry-tempest-plugin; git checkout $TELEMETRY_TAG; popd;
78 fi
79 #
80 if [ ! -d octavia-tempest-plugin ] ; then
81 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/octavia-tempest-plugin
82 pushd octavia-tempest-plugin; git checkout $OCTAVIA_TAG; popd;
83 fi
84 #
85 if [ ! -d patrole-tempest-plugin ] ; then
86 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/patrole patrole-tempest-plugin
87 pushd patrole-tempest-plugin; git checkout $PATROLE_TAG; popd;
88 fi
89 #
90 if [ ! -d tungsten-tempest-plugin ] ; then
91 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/contrail/tungsten-tempest tungsten-tempest-plugin
92 pushd tungsten-tempest-plugin; git checkout $TUNGSTEN_TAG; popd;
93 fi
94 #
95 if [ ! -d tempest ] ; then
96 git clone ssh://${GERRIT_NAME}@gerrit.mcp.mirantis.com:29418/packaging/sources/tempest tempest
97 pushd tempest ; git checkout $TEMPEST_TAG; popd
98 fi
99 #
100 if [[ "$(echo ${RELEASE_BUILD} | tr [:upper:] [:lower:] )" == "true" ]]; then
101 find . -maxdepth 2 -type d -iname .git -not -path '*tempest/.git*' | xargs --no-run-if-empty rm -rf
102 find . -maxdepth 2 -type f -iname .gitignore -or -iname .gitreview | xargs --no-run-if-empty rm -v
103 fi
104 popd
105 }
106
107function buildme(){
108 echo "=== Installing plugins"
109 plugins="tempest-horizon-plugin barbican-tempest-plugin designate-tempest-plugin heat-tempest-plugin ironic-tempest-plugin"
110 plugins="${plugins} manila-tempest-plugin telemetry-tempest-plugin octavia-tempest-plugin patrole-tempest-plugin tungsten-tempest-plugin"
111 for plugin in ${plugins}; do
112 echo "=== Installing plugin: ${plugin}"
113 pushd /var/lib/${plugin}
114 pip install --constraint /var/lib/openstack_requirements/upper-constraints.txt -r requirements.txt .
115 popd
116 done
117 echo "=== Installing tempest itself"
118 pushd /var/lib/tempest/
119 pip install .
120 popd
121 pip install junitxml
122 echo "BUILD_TIMESTAMP=$(date '+%Y-%m-%d-%H-%M-%S' -u)" > /etc/build_timestamp
123}
124
125############# body ############################################################
126
127case "$1" in
128
129buildme) echo "Attempt to buildme"
130 buildme
131 ;;
132*) echo "Attempt to prepare.."
133 prepare
134 ;;
135esac