Merge lp:~psivaa/uci-engine/install-cu2d-from-tarball into lp:uci-engine

Proposed by Para Siva
Status: Work in progress
Proposed branch: lp:~psivaa/uci-engine/install-cu2d-from-tarball
Merge into: lp:uci-engine
Diff against target: 176 lines (+99/-13)
4 files modified
charms/precise/chroot-builder/config.yaml (+17/-0)
charms/precise/chroot-builder/hooks/hooks.py (+73/-12)
cupstream2distro/chroot-tools/.pbuilderrc (+0/-1)
juju-deployer/branch-source-builder.yaml.tmpl (+9/-0)
To merge this branch: bzr merge lp:~psivaa/uci-engine/install-cu2d-from-tarball
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Evan (community) Approve
Review via email: mp+224080@code.launchpad.net

Commit message

Install cupstream2distro from the uci-engine tarball and remove the eatmydata LD_PRELOAD errors seen during deployment.

Description of the change

To install cupstream2distro from the uci-engine tarball rather than from lp:lp:cupstream2distro/uci-airline and to remove the eatmydata LD_PRELOAD errors seen during deployment.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:600
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/910/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/910/rebuild

review: Approve (continuous-integration)
Revision history for this message
Evan (ev) wrote :

Comments inline.

review: Needs Fixing
600. By Celso Providelo

[r=Andy Doan, PS Jenkins bot] Series of assorted small fixes related to the task-force for staging deployment and acceptance tests. from Celso Providelo

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

There is possibly another way to solve this problem, although I haven't figured out yet if it will work. The /cupstream2distro path is already being installed under /srv/${service_name}/.../cupstream2distro by the rabbit-worker charm that installs the parent. The problem I ran into was getting that path to the .pbuilerrc file. AFAICT, in order to communicate the full path, we'd have to create a specific relationship (something-like 'rabbit-worker-extension') that passes the path via a relationship variable.

The solution proposed here actually works :-), and I think is the better solution for now. I have no further comments, so once ev's are addressed, we can merge this.

601. By Joe Talbott

[r=Andy Doan, PS Jenkins bot] ticket-system - Add openid and oauth2 support.

  * This is essentially a NOP at this point and shouldn't affect deployments as the
    API does not yet require authentication.
  from Joe Talbott

602. By Andy Doan

[r=Evan Dandrea, PS Jenkins bot] rabbit-worker charm: update logs directory

This makes the upstart logging location for our rabbit workers consistent
to what i/s requires. The log directories will become:

 /srv/ci-airline-imagebuild-worker/logs/upstart.log
 /srv/ci-airline-bsb-worker/logs/upstart.log

 etc.

This had a side-effect of changing the upstart service names, which
I fixed the integration test cases for (as well as added one for
bsbuilder since one didn't exist)
  from Andy Doan

603. By Vincent Ladeuil

[r=PS Jenkins bot, Evan Dandrea] Ensures setup.sh fails when any setup.py component fails. 1333590 from Vincent Ladeuil

604. By Vincent Ladeuil

[r=Francis Ginther, PS Jenkins bot] Fallback to current dir (/srv/<service>) if HOME is not set for the test runner worker. 1331989 from Vincent Ladeuil

605. By Vincent Ladeuil

[r=PS Jenkins bot, Evan Dandrea] Add pep8/flake tests for juju-deployer and tests test files and fix found issues. from Vincent Ladeuil

606. By Andy Doan

[r=PS Jenkins bot, Evan Dandrea] lander charm: fix logging

i/s confirmed logging for this componet should go to:

 /srv/ci-airline-lander/logs

This required a few changes:

1) change the "service_dir" to use dashes and not underscores
This made a new upstart service name. This broke that json_status cgi
script *again*. So I tried to change this in a way that it can be
updated in the future without breakage.

2) update the "lander logs" location
We were logging results from processing tickets under "logs". I chaged
this to "lander-logs" so it won't collide with our upstart logs.

3) make the charm / upstart script smarter
This gets us logging in the correct place, but it also lets the upstart
job ensure the proper directories exist before the job is launched. This
makes things safer in the event someone deletes the logs directory and
restarts the service
  from Andy Doan

607. By Ursula Junque

[r=PS Jenkins bot, Celso Providelo] Fixes glitches on publisher from Ursula Junque

608. By Celso Providelo

[r=Andy Doan, PS Jenkins bot] Trivial fixes for ci-airline staging. from Celso Providelo

609. By Celso Providelo

[r=PS Jenkins bot, Andy Doan] Extend the current Webui to link to ticket artifacts using tempurls. from Celso Providelo

610. By Francis Ginther

[r=Andy Doan, PS Jenkins bot] Bump version of the upstart charm in production-only.yaml to account for the revision bump in the charm itself. from Francis Ginther

611. By Vincent Ladeuil

[r=Francis Ginther, PS Jenkins bot] Upload the run_test.py script explicitly without relying on cloud-init. 1333323 from Vincent Ladeuil

612. By Andy Doan

[r=Parameswaran Sivatharman, PS Jenkins bot] restish charm: fix to work with i/s requirement

As discussed with i/s this will get us going with:

 /srv/ci-airline-gatekeeper-restish/logs/access.log
 /srv/ci-airline-gatekeeper-restish/logs/gunicorn.log from Andy Doan

613. By Vincent Ladeuil

[r=Ursula Junque, PS Jenkins bot] Don't attempt to create ~/.ssh if it already exists. 1334146 from Vincent Ladeuil

614. By Para Siva

[r=Celso Providelo, PS Jenkins bot] This removes the creation and usage of ~/.ubuntu-ci. Consequently ubuntu-ci-autoconfig was removed. Requires -D and -S for development and staging deployments from Parameswaran Sivatharman

615. By Vincent Ladeuil

[r=Evan Dandrea, PS Jenkins bot, Andy Doan] Touch a stamp file to ensure the dependency is updated. from Vincent Ladeuil

616. By Andy Doan

[r=Paul Larson, PS Jenkins bot] django charm: remove need for hard-coded python paths

This lets us specify relative paths, so that our deployer files don't
require updates when we change the charm or service name from Andy Doan

617. By Andy Doan

[r=PS Jenkins bot, Francis Ginther, Evan Dandrea] lander: don't crash when no juju-relations exist

We are seeing something in production where the lander is starting
before the juju-relations directory exist. I'm actually surprised
this code ever worked well. This does a check so that we'll wait
properly.

I've also added a small engine-health-check so the exact error will be
visible in our webui.
  from Andy Doan

618. By Celso Providelo

[r=PS Jenkins bot, Francis Ginther, Evan Dandrea] Fixing TempUrl generation in canonistack/prodstack. from Celso Providelo

Revision history for this message
Para Siva (psivaa) wrote :

Thanks for the comments. Addressed where possible. charmhelpers dont seem to be much of help here. Just replied inline. Could you pls double check

619. By Ursula Junque

[r=Francis Ginther, Celso Providelo] Disables chroot-builder install during deployments, will be switched back on when fixing bug 1312271 from Ursula Junque

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:602
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/938/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/938/rebuild

review: Approve (continuous-integration)
620. By Andy Doan

[r=Paul Larson, PS Jenkins bot] restish charm: provide a way to run cron tasks from Andy Doan

Revision history for this message
Evan (ev) wrote :

Some small comments inline, but this is basically there. Resolve these and consider it an implicit +1 from me.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:603
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/941/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/941/rebuild

review: Needs Fixing (continuous-integration)
621. By Para Siva

Conflict resolving

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

PASSED: Continuous integration, rev:621
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/942/
Executed test runs:

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/uci-engine-ci/942/rebuild

review: Approve (continuous-integration)
Revision history for this message
Para Siva (psivaa) wrote :

Thanks for the comments again. Fixed them too. Holding it for https://bugs.launchpad.net/uci-engine/+bug/1312271 to be complete and as per http://bazaar.launchpad.net/~canonical-ci-engineering/uci-engine/trunk/revision/619

Revision history for this message
Para Siva (psivaa) wrote :

Review comments addressed

Unmerged revisions

621. By Para Siva

Conflict resolving

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charms/precise/chroot-builder/config.yaml'
--- charms/precise/chroot-builder/config.yaml 2014-05-27 06:04:10 +0000
+++ charms/precise/chroot-builder/config.yaml 2014-06-26 14:33:53 +0000
@@ -20,3 +20,20 @@
20 If specified, this will be used as the base url for downloading20 If specified, this will be used as the base url for downloading
21 pre-built chroots. The format for the individual files is:21 pre-built chroots. The format for the individual files is:
22 {chroot_base_url}/{series}-{architecture}.tgz22 {chroot_base_url}/{series}-{architecture}.tgz
23 install_root:
24 type: string
25 description: "The root directory the service will be installed in"
26 default: "/srv/"
27 tarball:
28 type: string
29 description: A URL to a tarball of the code
30 vcs:
31 default: "branch"
32 type: string
33 description: "Grab code from a bzr 'branch' or a URL to a 'tarball'"
34 branch:
35 type: string
36 description: "BZR branch the service lives in"
37 revno:
38 type: string
39 description: "Revision or tag to branch from"
2340
=== modified file 'charms/precise/chroot-builder/hooks/hooks.py'
--- charms/precise/chroot-builder/hooks/hooks.py 2014-06-03 18:34:17 +0000
+++ charms/precise/chroot-builder/hooks/hooks.py 2014-06-26 14:33:53 +0000
@@ -29,6 +29,8 @@
2929
30CHROOT_USER_HOME = '/root'30CHROOT_USER_HOME = '/root'
31CHROOT_ROOT_PATH = '/var/cache/pbuilder'31CHROOT_ROOT_PATH = '/var/cache/pbuilder'
32EAT_MY_DATA_PRELOAD_LINE = "export LD_PRELOAD=\"${LD_PRELOAD:+$LD_PRELOAD:}\
33/usr/lib/libeatmydata/libeatmydata.so\"\n"
3234
3335
34def juju_info(msg, level='INFO'):36def juju_info(msg, level='INFO'):
@@ -143,34 +145,93 @@
143 return 0145 return 0
144146
145147
148def _service_name(config):
149 '''Returns the service name in a form useful
150 for using as a directory component, with
151 characters that would need to be escaped replaced with _.'''
152 unit = core.hookenv.service_name()
153 for x in (':', '/', '"', "'"):
154 unit = unit.replace(x, '_')
155 return unit
156
157
158def _service_dir(config):
159 return os.path.join(config['install_root'], _service_name(config))
160
161
146def setup_dependencies(config):162def setup_dependencies(config):
147 required_packages = ['bzr', 'cowbuilder']163 required_packages = ['bzr', 'cowbuilder', 'eatmydata']
148 fetch.apt_update()164 fetch.apt_update()
149 juju_info('installing apt packages...')165 juju_info('installing apt packages...')
150 fetch.apt_install(required_packages, fatal=True)166 fetch.apt_install(required_packages, fatal=True)
151167
152168
153def setup_pbuilderrc(config):169def setup_pbuilderrc(config):
154 cu2d_dir = '/srv/cu2d'170 cu2d_dir = _service_dir(config)
155 if os.path.exists(cu2d_dir):171 if config.get('vcs') == 'tarball':
156 subprocess.check_call(['bzr', 'update', cu2d_dir])172 _install_from_tarball(config, os.path.exists(cu2d_dir))
157 else:173 else:
158 try:174 _install_from_bzr(config, os.path.exists(cu2d_dir))
159 subprocess.check_call(['bzr', 'branch',
160 'lp:cupstream2distro/uci-airline',
161 cu2d_dir])
162 except subprocess.CalledProcessError as e:
163 raise EnvironmentError(
164 'Could not get cu2d (return: {})'.format(e.returncode))
165175
166 shutil.copy(os.path.join(cu2d_dir, 'chroot-tools', '.pbuilderrc'),176 shutil.copy(os.path.join(cu2d_dir, 'cupstream2distro', 'chroot-tools',
177 '.pbuilderrc'),
167 CHROOT_USER_HOME)178 CHROOT_USER_HOME)
168179
169180
181def _install_from_tarball(config, upgrade):
182 tarball_url = config['tarball']
183 juju_info('grabbing service from tarball {}...'.format(tarball_url))
184 cu2d_dir = _service_dir(config)
185 if not upgrade:
186 juju_info(
187 'Creating service directory: {}'.format(cu2d_dir))
188 os.mkdir(cu2d_dir)
189 cmd = 'curl %s | tar -xzC %s' % (tarball_url, cu2d_dir)
190 subprocess.check_call(cmd, shell=True)
191
192
193def _install_from_bzr(config, upgrade):
194 juju_info('grabbing service from bzr...')
195
196 cu2d_dir = _service_dir(config)
197 rev = config.get('revno', '')
198
199 if upgrade:
200 args = ['bzr', 'pull']
201 if rev:
202 args.extend(['-r', rev])
203 subprocess.check_call(args, cwd=cu2d_dir)
204 return
205 else:
206 juju_info('deleting pre-existing service directory: %s' % cu2d_dir)
207 shutil.rmtree(cu2d_dir)
208
209 args = ['bzr', 'branch']
210 if rev:
211 args.extend(['-r', rev])
212 args.append(config['branch'])
213 args.append(cu2d_dir)
214 subprocess.check_call(args)
215
216
217def update_pbuilderrc(config):
218 pbuilderrc = os.path.join(CHROOT_USER_HOME, '.pbuilderrc')
219 if EAT_MY_DATA_PRELOAD_LINE not in open(pbuilderrc, 'rb').readlines()[-1]:
220 try:
221 fh = open(pbuilderrc, 'a')
222 fh.write(EAT_MY_DATA_PRELOAD_LINE)
223 except IOError:
224 print "Can't update pbuiderrc"
225 else:
226 print 'pbuilderrc updated for chroot'
227 fh.close()
228
229
170def config_changed(config):230def config_changed(config):
171 setup_dependencies(config)231 setup_dependencies(config)
172 setup_pbuilderrc(config)232 setup_pbuilderrc(config)
173 setup_chroots(config)233 setup_chroots(config)
234 update_pbuilderrc(config)
174235
175236
176def main():237def main():
177238
=== modified file 'cupstream2distro/chroot-tools/.pbuilderrc'
--- cupstream2distro/chroot-tools/.pbuilderrc 2014-06-10 20:42:46 +0000
+++ cupstream2distro/chroot-tools/.pbuilderrc 2014-06-26 14:33:53 +0000
@@ -30,4 +30,3 @@
30# EXTRAPACKAGES is not obeyed by 'cowbuilder --create' but running30# EXTRAPACKAGES is not obeyed by 'cowbuilder --create' but running
31# 'cowbuilder--update' will happily fix that.31# 'cowbuilder--update' will happily fix that.
32EXTRAPACKAGES="eatmydata pbuilder bzr bzr-builddeb"32EXTRAPACKAGES="eatmydata pbuilder bzr bzr-builddeb"
33export LD_PRELOAD="${LD_PRELOAD:+$LD_PRELOAD:}/usr/lib/libeatmydata/libeatmydata.so"
3433
=== modified file 'juju-deployer/branch-source-builder.yaml.tmpl'
--- juju-deployer/branch-source-builder.yaml.tmpl 2014-06-25 18:01:51 +0000
+++ juju-deployer/branch-source-builder.yaml.tmpl 2014-06-26 14:33:53 +0000
@@ -15,6 +15,14 @@
15 - ${CI_PPA}15 - ${CI_PPA}
16 install_keys: |16 install_keys: |
17 - ""17 - ""
18 ci-airline-bsb-chroot-builder:
19 charm: chroot-builder
20 options:
21 distros: trusty
22 architectures: amd64
23 vcs: ${CI_CODE_SOURCE}
24 branch: ${CI_BRANCH}
25 tarball: ${CI_PAYLOAD_URL}
18 ci-airline-rabbit:26 ci-airline-rabbit:
19 branch: lp:~canonical-ci-engineering/charms/precise/uci-engine/rabbitmq-server@4727 branch: lp:~canonical-ci-engineering/charms/precise/uci-engine/rabbitmq-server@47
20 charm: rabbitmq28 charm: rabbitmq
@@ -22,3 +30,4 @@
22 management_plugin: true30 management_plugin: true
23 relations:31 relations:
24 - [ci-airline-bsb-worker, ci-airline-rabbit]32 - [ci-airline-bsb-worker, ci-airline-rabbit]
33 - [ci-airline-bsb-worker, ci-airline-bsb-chroot-builder]

Subscribers

People subscribed via source and target branches