Merge lp:~psivaa/uci-engine/lander-jenkins-plugin into lp:uci-engine/mthood

Proposed by Para Siva
Status: Superseded
Proposed branch: lp:~psivaa/uci-engine/lander-jenkins-plugin
Merge into: lp:uci-engine/mthood
Diff against target: 163 lines (+63/-36)
2 files modified
charms/precise/lander-jenkins/hooks/hooks.py (+61/-34)
juju-deployer/lander.yaml.tmpl (+2/-2)
To merge this branch: bzr merge lp:~psivaa/uci-engine/lander-jenkins-plugin
Reviewer Review Type Date Requested Status
Francis Ginther Needs Fixing
Review via email: mp+219018@code.launchpad.net

This proposal has been superseded by a proposal from 2014-05-16.

Commit message

Change to include parameterized-trigger plugin inside the charm instead of downloading it from the jenkins site to be made suitable for private mthood cloud

Note: For this to work well https://code.launchpad.net/~psivaa/charms/precise/jenkins/bundle-jenkins/+merge/215635 needs merging first

Description of the change

Change to include parameterized-trigger plugin inside the charm instead of downloading it from the jenkins site to be made suitable for private mthood cloud

Note: For this to work well https://code.launchpad.net/~psivaa/charms/precise/jenkins/bundle-jenkins/+merge/215635 needs merging first

To post a comment you must log in.
415. By Para Siva

Include mthood specific jenkins charm branch

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

I don't see how the plugin gets copied from the charm local directory to the jenkins plugin directory (see inline comment).

review: Needs Fixing

Unmerged revisions

415. By Para Siva

Include mthood specific jenkins charm branch

414. By Para Siva

plugin name format in yaml

413. By Para Siva

Plugins included in lander-jenkins

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== added directory 'charms/precise/lander-jenkins/files'
=== added directory 'charms/precise/lander-jenkins/files/plugins'
=== added file 'charms/precise/lander-jenkins/files/plugins/parameterized-trigger.hpi'
0Binary files charms/precise/lander-jenkins/files/plugins/parameterized-trigger.hpi 1970-01-01 00:00:00 +0000 and charms/precise/lander-jenkins/files/plugins/parameterized-trigger.hpi 2014-05-15 11:17:32 +0000 differ0Binary files charms/precise/lander-jenkins/files/plugins/parameterized-trigger.hpi 1970-01-01 00:00:00 +0000 and charms/precise/lander-jenkins/files/plugins/parameterized-trigger.hpi 2014-05-15 11:17:32 +0000 differ
=== modified file 'charms/precise/lander-jenkins/hooks/hooks.py'
--- charms/precise/lander-jenkins/hooks/hooks.py 2014-03-10 22:25:00 +0000
+++ charms/precise/lander-jenkins/hooks/hooks.py 2014-05-15 11:17:32 +0000
@@ -14,12 +14,12 @@
14sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))14sys.path.insert(0, os.path.join(os.environ['CHARM_DIR'], 'lib'))
15from charmhelpers import core15from charmhelpers import core
16from charmhelpers import fetch16from charmhelpers import fetch
17from charmhelpers.fetch import bzrurl
1817
19JENKINS_HOME = '/var/lib/jenkins'18JENKINS_HOME = '/var/lib/jenkins'
20JENKINS_USER = 'jenkins'19JENKINS_USER = 'jenkins'
21JENKINS_GROUP = 'nogroup'20JENKINS_GROUP = 'nogroup'
22NUM_EXECUTORS_LINE = ' <numExecutors>{}</numExecutors>\n'21NUM_EXECUTORS_LINE = ' <numExecutors>{}</numExecutors>\n'
22PLUGIN_LOCAL = os.path.join(os.environ['CHARM_DIR'], 'files/plugins')
2323
2424
25def juju_info(msg, level='INFO'):25def juju_info(msg, level='INFO'):
@@ -149,49 +149,76 @@
149 plugin_list = config['plugins'].split()149 plugin_list = config['plugins'].split()
150 plugins_site = config['plugins-site']150 plugins_site = config['plugins-site']
151 for plugin in plugin_list:151 for plugin in plugin_list:
152 if ':' in plugin:152 plugin = '{}.hpi'.format(plugin)
153 (name, version) = plugin.split(':')153 plugin_file = os.path.join(PLUGIN_LOCAL, plugin)
154 # A specific version is being requested154 if not os.path.exists(plugin_file):
155 url = '{}/download/plugins/{}/{}/{}.hpi'.format(155 if ':' in plugin:
156 plugins_site, name, version, name)156 (name, version) = plugin.split(':')
157 plugin_file = '{}-{}.hpi'.format(name, version)157 # A specific version is being requested
158 else:158 url = '{}/download/plugins/{}/{}/{}.hpi'.format(
159 url = '{}/latest/{}.hpi'.format(plugins_site, plugin)159 plugins_site, name, version, name)
160 plugin_file = '{}.hpi'.format(name)160 plugin_file = '{}-{}.hpi'.format(name, version)
161 juju_info('Installing {} from {}'.format(plugin_file, url))161 else:
162 plugin_file = os.path.join(JENKINS_HOME, 'plugins', plugin_file)162 url = '{}/latest/{}.hpi'.format(plugins_site, plugin)
163 cmd = ['wget', '-O', plugin_file, url]163 plugin_file = plugin
164 subprocess.check_call(cmd)164 juju_info('Installing {} from {}'.format(plugin_file, url))
165 plugin_file = os.path.join(JENKINS_HOME, 'plugins', plugin_file)
166 cmd = ['wget', '-O', plugin_file, url]
167 subprocess.check_call(cmd)
168
165 cmd = ['chown', '-R', '{}.{}'.format(JENKINS_USER, JENKINS_GROUP),169 cmd = ['chown', '-R', '{}.{}'.format(JENKINS_USER, JENKINS_GROUP),
166 plugin_file]170 plugin_file]
167 subprocess.check_call(cmd)171 subprocess.check_call(cmd)
168172
169173
170def _install_from_tarball(config):174def _install_from_tarball(config, upgrade):
171 juju_info('grabbing service from tarball...')175 juju_info('grabbing service from tarball...')
172 sdir = _service_dir(config)176 sdir = _service_dir(config)
177 if not upgrade:
178 if os.path.exists(sdir):
179 juju_info('deleting pre-existing service directory: %s' % sdir)
180 shutil.rmtree(sdir)
181 os.mkdir(sdir)
182 cmd = 'curl %s | tar -xzC %s' % (config['tarball'], sdir)
183 subprocess.check_call(cmd, shell=True)
184
185
186def _install_from_bzr(config, upgrade):
187 juju_info('grabbing service from bzr...')
188
189 sdir = _service_dir(config)
190 rev = config.get('revno', '')
191
192 if upgrade:
193 args = ['bzr', 'pull']
194 if rev:
195 args.extend(['-r', rev])
196 subprocess.check_call(args, cwd=sdir)
197 return
198
173 if os.path.exists(sdir):199 if os.path.exists(sdir):
174 juju_info('deleting pre-existing service directory: %s' % sdir)200 juju_info('deleting pre-existing service directory: %s' % sdir)
175 shutil.rmtree(sdir)201 shutil.rmtree(sdir)
176 os.mkdir(sdir)202
177 cmd = 'curl %s | tar -xzC %s' % (config['tarball'], sdir)203 args = ['bzr', 'branch']
178 subprocess.check_call(cmd, shell=True)204 if rev:
179205 args.extend(['-r', rev])
180206 args.append(config['branch'])
181def _install_from_bzr(config):207 args.append(sdir)
182 service_dir = _service_dir(config)208 subprocess.check_call(args)
183 bzr = bzrurl.BzrUrlFetchHandler()209
184 if os.path.exists(service_dir):210
185 juju_info('deleting pre-existing service directory: %s' % service_dir)211def install(config, upgrade=False):
186 shutil.rmtree(service_dir)
187 bzr.branch(config['branch'], service_dir)
188
189
190def install(config):
191 if config.get('vcs') == 'tarball':212 if config.get('vcs') == 'tarball':
192 _install_from_tarball(config)213 _install_from_tarball(config, upgrade)
193 else:214 else:
194 _install_from_bzr(config)215 _install_from_bzr(config, upgrade)
216
217
218def upgrade_charm(config):
219 install(config, True)
220 restart_jenkins(config)
221 restart_upstart(config)
195222
196223
197def create_unit_config(config):224def create_unit_config(config):
@@ -210,9 +237,9 @@
210 start on (local-filesystems and net-device-up IFACE=eth0)237 start on (local-filesystems and net-device-up IFACE=eth0)
211 stop on runlevel [!12345]238 stop on runlevel [!12345]
212239
213 # If the process quits unexpectadly trigger respawn it, unless it240 # If the process quits unexpectedly trigger respawn it
214 # fails 15 times within 5 seconds
215 respawn241 respawn
242 # unless it fails 15 times within 5 seconds
216 respawn limit 15 5243 respawn limit 15 5
217244
218 setuid {uid}245 setuid {uid}
219246
=== modified file 'juju-deployer/lander.yaml.tmpl'
--- juju-deployer/lander.yaml.tmpl 2014-03-14 10:37:28 +0000
+++ juju-deployer/lander.yaml.tmpl 2014-05-15 11:17:32 +0000
@@ -21,7 +21,7 @@
21 wsgi_wsgi_file: lander.wsgi:app21 wsgi_wsgi_file: lander.wsgi:app
22 lander-jenkins:22 lander-jenkins:
23 charm: jenkins23 charm: jenkins
24 branch: lp:~ci-engineering-private/charms/precise/jenkins/ci-train@6024 branch: lp:~ci-engineering-private/charms/precise/jenkins/mthood@61
25 constraints: "cpu-cores=2 mem=8 root-disk=8192M"25 constraints: "cpu-cores=2 mem=8 root-disk=8192M"
26 exposed: true26 exposed: true
27 options:27 options:
@@ -39,7 +39,7 @@
39 bot_password: lander-bot39 bot_password: lander-bot
40 sources: ${CI_PPA}40 sources: ${CI_PPA}
41 packages: "python-amqplib python-swiftclient lazr.enum"41 packages: "python-amqplib python-swiftclient lazr.enum"
42 plugins: "parameterized-trigger:2.14"42 plugins: "parameterized-trigger"
43 unit-config: include-base64://configs/unit_config.yaml43 unit-config: include-base64://configs/unit_config.yaml
44 main: ./run-python ./lander/lander/run_worker.py --service-name ts-django --service-port 8080 --delay 1044 main: ./run-python ./lander/lander/run_worker.py --service-name ts-django --service-port 8080 --delay 10
45 rabbit:45 rabbit:

Subscribers

People subscribed via source and target branches