Merge lp:~canonical-platform-qa/snappy-ecosystem-tests/adding-setup-script into lp:snappy-ecosystem-tests

Proposed by Heber Parrucci
Status: Merged
Approved by: Omer Akram
Approved revision: 34
Merged at revision: 32
Proposed branch: lp:~canonical-platform-qa/snappy-ecosystem-tests/adding-setup-script
Merge into: lp:snappy-ecosystem-tests
Diff against target: 117 lines (+77/-6)
4 files modified
mk-venv (+12/-4)
requirements-setup.txt (+2/-0)
run_setup (+62/-0)
snappy_ecosystem_tests/environment/managers.py (+1/-2)
To merge this branch: bzr merge lp:~canonical-platform-qa/snappy-ecosystem-tests/adding-setup-script
Reviewer Review Type Date Requested Status
Omer Akram (community) Approve
platform-qa-bot continuous-integration Approve
Review via email: mp+319115@code.launchpad.net

Commit message

Adding setup shell script for setting up the environment

Description of the change

Add a setup shell script in order to install the python dependencies needed for setting up the environment.

To post a comment you must log in.
Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Needs Fixing (continuous-integration)
33. By Heber Parrucci

Fixing pylint issue

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
34. By Heber Parrucci

changing pip for pip3

Revision history for this message
platform-qa-bot (platform-qa-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Omer Akram (om26er) wrote :

Setup failed for me, am I missing something ? http://paste.ubuntu.com/24131475/

Also I had to install virtualenv manually.

review: Needs Fixing
Revision history for this message
Heber Parrucci (heber013) wrote :

> Setup failed for me, am I missing something ?
> http://paste.ubuntu.com/24131475/
>
> Also I had to install virtualenv manually.

Seems that the same error we got some days ago when creating the virtual env for running the tests.
The problem is when building wheel for cryptography. Check if you have the following packages in your system:

$ sudo apt-get install libffi-dev
$ sudo apt-get install libssl-dev

Notice that the virtual env is created properly on Jenkins (though it fails in another part because of a proxy issue that is being resolved by IS people):
https://platform-qa-jenkins.ubuntu.com/view/QA%20Jobs/view/System%20Tests/job/run_snappy_ecosystem_tests/8/

Revision history for this message
Omer Akram (om26er) wrote :

Would be nice to have a fully reproducible environment without the need to fiddle with package installation manually. So we need to first check if pip is installed, otherwise exit the script. After that we should make sure to install libffi-dev and libssl-dev. Should also install virtualenv with pip. After that the script should proceed. Obviously not something for this MR to block on but something to aim for.

After installing the package I was able to get the environment setup.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'mk-venv'
2--- mk-venv 2017-02-09 20:09:40 +0000
3+++ mk-venv 2017-03-07 15:11:37 +0000
4@@ -32,13 +32,21 @@
5 proxy="$2"
6 shift # past argument
7 ;;
8+ -r|--requirements)
9+ requirements="$2"
10+ shift # past argument
11+ ;;
12 esac
13 shift # past argument or value
14 done
15
16-if [ "$proxy" ]; then
17- echo "Using proxy: $proxy to install dependencies"
18- pip install --proxy $proxy -r requirements.txt
19+if [ -z "$requirements" ]; then
20+ requirements=requirements.txt
21+fi
22+
23+if [ ! -z "$proxy" ]; then
24+ echo "Using proxy: ${proxy} to install dependencies"
25+ pip3 install --proxy ${proxy} -r ${requirements}
26 else
27- pip install -r requirements.txt
28+ pip3 install -r ${requirements}
29 fi
30
31=== added file 'requirements-setup.txt'
32--- requirements-setup.txt 1970-01-01 00:00:00 +0000
33+++ requirements-setup.txt 2017-03-07 15:11:37 +0000
34@@ -0,0 +1,2 @@
35+pylxd
36+retrying
37
38=== added file 'run_setup'
39--- run_setup 1970-01-01 00:00:00 +0000
40+++ run_setup 2017-03-07 15:11:37 +0000
41@@ -0,0 +1,62 @@
42+#!/bin/bash
43+
44+#
45+# Snappy Ecosystem Tests
46+# Copyright (C) 2017 Canonical
47+#
48+# This program is free software: you can redistribute it and/or modify
49+# it under the terms of the GNU General Public License as published by
50+# the Free Software Foundation, either version 3 of the License, or
51+# (at your option) any later version.
52+#
53+# This program is distributed in the hope that it will be useful,
54+# but WITHOUT ANY WARRANTY; without even the implied warranty of
55+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56+# GNU General Public License for more details.
57+#
58+# You should have received a copy of the GNU General Public License
59+# along with this program. If not, see <http://www.gnu.org/licenses/>.
60+#
61+
62+while [[ $# -gt 1 ]]
63+do
64+
65+key="$1"
66+
67+case $key in
68+ --proxy)
69+ proxy="$2"
70+ shift # past argument
71+ ;;
72+ -m|--mode)
73+ mode="$2"
74+ shift # past argument
75+ ;;
76+ --profile)
77+ profile="$2"
78+ shift # past argument
79+ ;;
80+esac
81+shift # past argument or value
82+done
83+
84+. ./mk-venv -r requirements-setup.txt --proxy ${proxy}
85+
86+if [ -z "$mode" ]; then
87+ mode=lxd
88+fi
89+
90+if [ -z "$profile" ]; then
91+ profile=staging
92+fi
93+ve/bin/python3 -m snappy_ecosystem_tests.environment.setup --mode ${mode} --profile ${profile}
94+
95+result=$?
96+deactivate
97+
98+if [ $result != 0 ]; then
99+ echo -e -n "Environment setup FAILED.\n"
100+ exit 1;
101+else
102+ echo -e -n "Environment setup PASSED.\n"
103+fi
104
105=== modified file 'snappy_ecosystem_tests/environment/managers.py'
106--- snappy_ecosystem_tests/environment/managers.py 2017-03-03 18:09:16 +0000
107+++ snappy_ecosystem_tests/environment/managers.py 2017-03-07 15:11:37 +0000
108@@ -114,8 +114,7 @@
109 # Allow export of environment variables over ssh.
110 container.execute(shlex.split(COMMAND_ALLOW_ENV_VARS.format(
111 ' '.join(PROFILES[profile][container_type]
112- ['environment_variables'].keys()))
113- ))
114+ ['environment_variables'].keys()))))
115 container.execute(shlex.split('service ssh restart'))
116
117 def setup(self, profile):

Subscribers

People subscribed via source and target branches