Merge lp:~fginther/adt-image-mapper/called-by-tarmac into lp:adt-image-mapper

Proposed by Francis Ginther
Status: Merged
Approved by: Francis Ginther
Approved revision: 6
Merged at revision: 6
Proposed branch: lp:~fginther/adt-image-mapper/called-by-tarmac
Merge into: lp:adt-image-mapper
Diff against target: 106 lines (+102/-0)
1 file modified
called-by-tarmac.py (+102/-0)
To merge this branch: bzr merge lp:~fginther/adt-image-mapper/called-by-tarmac
Reviewer Review Type Date Requested Status
Celso Providelo (community) Approve
Review via email: mp+253142@code.launchpad.net

Commit message

Add 'called-by-tarmac.py' to execute unit tests automatically by tarmac.

Description of the change

Add 'called-by-tarmac.py' to execute unit tests automatically by tarmac.

To post a comment you must log in.
Revision history for this message
Celso Providelo (cprov) :
review: Approve
Revision history for this message
Ubuntu CI Bot (uci-bot) wrote :
Download full text (13.1 KiB)

The attempt to merge lp:~fginther/adt-image-mapper/called-by-tarmac into lp:adt-image-mapper failed. Below is the output from the failed tests.

Using base prefix '/usr'
New python executable in /tmp/venv-adt-image-mapperbsiv4kvj/bin/python3
Also creating executable in /tmp/venv-adt-image-mapperbsiv4kvj/bin/python
Installing setuptools, pip...done.
Running virtualenv with interpreter /usr/bin/python3
Ignoring indexes: https://pypi.python.org/simple/
Downloading/unpacking cffi (from -r requirements.txt (line 5))
  Running setup.py (path:/tmp/venv-adt-image-mapperbsiv4kvj/build/cffi/setup.py) egg_info for package cffi

Downloading/unpacking pyasn1 (from -r requirements.txt (line 6))
  Running setup.py (path:/tmp/venv-adt-image-mapperbsiv4kvj/build/pyasn1/setup.py) egg_info for package pyasn1

Downloading/unpacking flask==0.10.1 (from -r requirements.txt (line 7))
  Running setup.py (path:/tmp/venv-adt-image-mapperbsiv4kvj/build/flask/setup.py) egg_info for package flask

    warning: no files found matching '*' under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'docs/_themes/.git'
Downloading/unpacking gunicorn==19.3.0 (from -r requirements.txt (line 8))
Downloading/unpacking python-glanceclient==0.14.0 (from -r requirements.txt (line 9))
Downloading/unpacking python-keystoneclient==1.2.0 (from -r requirements.txt (line 10))
Downloading/unpacking pycparser (from cffi->-r requirements.txt (line 5))
  Running setup.py (path:/tmp/venv-adt-image-mapperbsiv4kvj/build/pycparser/setup.py) egg_info for package pycparser

Downloading/unpacking Werkzeug>=0.7 (from flask==0.10.1->-r requirements.txt (line 7))
  Running setup.py (path:/tmp/venv-adt-image-mapperbsiv4kvj/build/Werkzeug/setup.py) egg_info for package Werkzeug

    warning: no previously-included files matching '*.pyc' found under directory 'docs'
    warning: no previously-included files matching '*.pyo' found under directory 'docs'
    warning: no previously-included files matching '*.pyc' found under directory 'tests'
    warning: no previously-included files matching '*.pyo' found under directory 'tests'
    warning: no previously-included files matching '*.pyc' found under directory 'examples'
    warning: no previously-included files matching '*.pyo' found under directory 'examples'
    no previously-included directories found matching 'docs/_build'
    no previously-included directories found matching 'docs/_themes'
Downloading/unpacking Jinja2>=2.4 (from flask==0.10.1->-r requirements.txt (line 7))
  Running setup.py (path:/tmp/venv-adt-image-ma...

Revision history for this message
Paul Larson (pwlars) wrote :

This runs locally for me as long as I have python3-dev installed. I checked tarmac and it seems to have it installed already though. Could it be something in the way tarmac is calling it?

Revision history for this message
Francis Ginther (fginther) wrote :

plars, I had the exact same thought and just barely beat you to it. I just installed python3-dev on the tarmac system (testing this branch before and seeing the same failure). Now it's passing so re-approving.

Revision history for this message
Celso Providelo (cprov) wrote :

We might say that is the expected setup environment documented in our charms:

{{{
REQUIRED_PACKAGES = ['python-virtualenv', 'python3-dev']
}}}

And we got lucky that tarmac already had venv support (from the uci-e times).

We should update our tarmac charm/config for supporting py3 projects.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'called-by-tarmac.py'
2--- called-by-tarmac.py 1970-01-01 00:00:00 +0000
3+++ called-by-tarmac.py 2015-03-17 15:07:45 +0000
4@@ -0,0 +1,102 @@
5+#!/usr/bin/env python3
6+#
7+# adt-image-mapper
8+# Copyright (C) 2015 Canonical
9+#
10+# This program is free software: you can redistribute it and/or modify
11+# it under the terms of the GNU General Public License as published by
12+# the Free Software Foundation, either version 3 of the License, or
13+# (at your option) any later version.
14+#
15+# This program is distributed in the hope that it will be useful,
16+# but WITHOUT ANY WARRANTY; without even the implied warranty of
17+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18+# GNU General Public License for more details.
19+#
20+# You should have received a copy of the GNU General Public License
21+# along with this program. If not, see <http://www.gnu.org/licenses/>.
22+#
23+# called-by-tarmac.py is intended to be called by the tarmac merge engine
24+# to perform automatic unit testing on branch landing.
25+# It replaces the manual commands:
26+# bzr branch $PIP_CACHE_BRANCH pip_cache
27+# virtualenv -p python3 ve && \
28+# ./ve/bin/pip install --no-index --find-links=pip-cache \
29+# -r requirements.txt && \
30+# ./ve/bin/pip install -r test_requirements.txt && \
31+# ./ve/bin/python3 setup.py test && \
32+# rm -rf ve
33+#
34+
35+import os
36+import subprocess
37+import sys
38+import tempfile
39+
40+SERVICE_NAME = 'adt-image-mapper'
41+VENV_DIR = 'venv-{}'.format(SERVICE_NAME)
42+PIP_DIR = 'pip-cache-'.format(SERVICE_NAME)
43+PIP_CACHE_BRANCH = 'lp:~canonical-ci-engineering/{}/' \
44+ 'pip-cache'.format(SERVICE_NAME)
45+
46+
47+def _run_command(cmd):
48+ '''Run the command and return the return code or 0 on success.'''
49+
50+ print('INFO: Executing: {}'.format(' '.join(cmd)))
51+ try:
52+ subprocess.check_call(cmd, stderr=subprocess.STDOUT)
53+ except subprocess.CalledProcessError as e:
54+ print('ERROR: Calling `{}` failed (with code {})'.format(
55+ e.cmd, e.returncode))
56+ return e.returncode
57+ return 0
58+
59+
60+def main():
61+ with tempfile.TemporaryDirectory(PIP_DIR) as pip_dir, \
62+ tempfile.TemporaryDirectory(prefix=VENV_DIR) as ve_dir:
63+ pip_cache = os.path.join(pip_dir, 'cache')
64+ all_cmds = (
65+ [
66+ 'bzr',
67+ 'branch',
68+ PIP_CACHE_BRANCH,
69+ pip_cache,
70+ ],
71+ [
72+ 'virtualenv',
73+ '-p',
74+ 'python3',
75+ ve_dir,
76+ ],
77+ [
78+ os.path.join(ve_dir, 'bin', 'pip'),
79+ 'install',
80+ '--no-index',
81+ '--find-links={}'.format(pip_cache),
82+ '-r',
83+ 'requirements.txt',
84+ ],
85+ [
86+ os.path.join(ve_dir, 'bin', 'pip'),
87+ 'install',
88+ '-r',
89+ 'test_requirements.txt',
90+ ],
91+ [
92+ os.path.join(ve_dir, 'bin', 'python3'),
93+ 'setup.py',
94+ 'test',
95+ ],
96+ )
97+ for cmd in all_cmds:
98+ ret = _run_command(cmd)
99+ if ret:
100+ # A cmd failed, bubble up the return code to the caller
101+ return ret
102+ return 0
103+
104+
105+if __name__ == '__main__':
106+ sys.exit(main())

Subscribers

People subscribed via source and target branches