Merge lp:~psivaa/uci-engine/lander-jenkins-gpg-key-import into lp:uci-engine/mthood

Proposed by Para Siva
Status: Merged
Merged at revision: 415
Proposed branch: lp:~psivaa/uci-engine/lander-jenkins-gpg-key-import
Merge into: lp:uci-engine/mthood
Diff against target: 92 lines (+28/-11)
3 files modified
charms/precise/lander-jenkins/config.yaml (+5/-1)
charms/precise/lander-jenkins/hooks/hooks.py (+21/-9)
juju-deployer/lander.yaml.tmpl (+2/-1)
To merge this branch: bzr merge lp:~psivaa/uci-engine/lander-jenkins-gpg-key-import
Reviewer Review Type Date Requested Status
Andy Doan (community) Approve
Review via email: mp+220247@code.launchpad.net

Commit message

GPG import into lander jenkins installation. This also includes 'proper' fixes of parameterized plugin installation. (The plugin is confirmed to be installed now )

Description of the change

GPG import into lander jenkins installation. This also includes 'proper' fixes of parameterized plugin installation. (The plugin is confirmed to be installed now ) Apologies for missing it earlier.

To post a comment you must log in.
Revision history for this message
Andy Doan (doanac) wrote :

looks awfully familiar :)

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

Thanks. yes. still i missed it in the first MP :)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'charms/precise/lander-jenkins/config.yaml'
--- charms/precise/lander-jenkins/config.yaml 2014-05-16 18:32:52 +0000
+++ charms/precise/lander-jenkins/config.yaml 2014-05-20 12:42:25 +0000
@@ -64,10 +64,14 @@
64 type: string64 type: string
65 default: "https://updates.jenkins-ci.org/"65 default: "https://updates.jenkins-ci.org/"
66 description: Site to download plugin .hpi files from.66 description: Site to download plugin .hpi files from.
67 proxy_url:67 proxy-url:
68 type: string68 type: string
69 default: ""69 default: ""
70 description: The http proxy url for private clouds.70 description: The http proxy url for private clouds.
71 ppa-gpg-key:
72 type: string
73 default: ""
74 description: GPG key fingerprint for the PPA
71 main:75 main:
72 type: string76 type: string
73 default: ""77 default: ""
7478
=== modified file 'charms/precise/lander-jenkins/hooks/hooks.py'
--- charms/precise/lander-jenkins/hooks/hooks.py 2014-05-16 19:14:04 +0000
+++ charms/precise/lander-jenkins/hooks/hooks.py 2014-05-20 12:42:25 +0000
@@ -161,13 +161,13 @@
161 juju_info('Installing {} from {}'.format(plugin_file, url))161 juju_info('Installing {} from {}'.format(plugin_file, url))
162 plugin_file = os.path.join(JENKINS_HOME, 'plugins', plugin_file)162 plugin_file = os.path.join(JENKINS_HOME, 'plugins', plugin_file)
163163
164 if config['proxy_url']:164 if config['proxy-url']:
165 cmd = ['https_proxy=%s' % config['proxy_url'], 'wget',165 juju_info('Proxy {} is used'.format(config['proxy-url']))
166 '-O', plugin_file, url]166 cmd = ('https_proxy=%s http_proxy=%s wget -O %s %s' %
167 juju_info('Proxy {} is used'.format(config['proxy_url']))167 (config['proxy-url'], config['proxy-url'], plugin_file, url))
168 else:168 else:
169 cmd = ['wget', '-O', plugin_file, url]169 cmd = ('wget -O %s %s' % (plugin_file, url))
170170 juju_info('Command {} is used'.format(cmd))
171 subprocess.check_call(cmd, shell=True)171 subprocess.check_call(cmd, shell=True)
172 cmd = ['chown', '-R', '{}.{}'.format(JENKINS_USER, JENKINS_GROUP),172 cmd = ['chown', '-R', '{}.{}'.format(JENKINS_USER, JENKINS_GROUP),
173 plugin_file]173 plugin_file]
@@ -269,11 +269,23 @@
269 subprocess.check_call(['/sbin/start', _service_name(config)])269 subprocess.check_call(['/sbin/start', _service_name(config)])
270270
271271
272def import_ppa_keys(config):
273 cmd = ['apt-key', 'adv', '--keyserver', 'keyserver.ubuntu.com',
274 '--recv-keys', config['ppa-gpg-key']]
275 try:
276 subprocess.check_call(cmd)
277 except:
278 juju_log(MSG_ERROR, "Error importing repo key")
279
280
272def config_changed(config):281def config_changed(config):
273 juju_info("Config: %s" % config)282 juju_info("Config: %s" % config)
274 if config['proxy_url']:283 if config['proxy-url']:
275 juju_info('Setting up apt with {}'.format(config['proxy_url']))284 juju_info('Setting up apt with {}'.format(config['proxy-url']))
276 setup_apt_proxy(config)285 setup_apt_proxy(config)
286 if config['ppa-gpg-key']:
287 juju_info('Importing key for {}'.format(config['ppa-gpg-key']))
288 import_ppa_keys(config)
277 add_dependencies(config)289 add_dependencies(config)
278 create_jobs(config)290 create_jobs(config)
279 create_user(config)291 create_user(config)
@@ -352,7 +364,7 @@
352364
353365
354def setup_apt_proxy(config):366def setup_apt_proxy(config):
355 proxy_url = config['proxy_url']367 proxy_url = config['proxy-url']
356 apt_conf = textwrap.dedent("""\368 apt_conf = textwrap.dedent("""\
357 Acquire::http::proxy "%s";369 Acquire::http::proxy "%s";
358 Acquire::https::proxy "%s";370 Acquire::https::proxy "%s";
359371
=== modified file 'juju-deployer/lander.yaml.tmpl'
--- juju-deployer/lander.yaml.tmpl 2014-05-16 18:32:52 +0000
+++ juju-deployer/lander.yaml.tmpl 2014-05-20 12:42:25 +0000
@@ -35,7 +35,8 @@
35 vcs: ${CI_CODE_SOURCE}35 vcs: ${CI_CODE_SOURCE}
36 branch: ${CI_BRANCH}36 branch: ${CI_BRANCH}
37 tarball: ${CI_PAYLOAD_URL}37 tarball: ${CI_PAYLOAD_URL}
38 proxy_url: ${CI_PRIVATE_HTTP_PROXY}38 proxy-url: ${CI_PRIVATE_HTTP_PROXY}
39 ppa-gpg-key: ${CI_PPA_GPG_KEY}
39 bot_username: lander-bot40 bot_username: lander-bot
40 bot_password: lander-bot41 bot_password: lander-bot
41 sources: ${CI_PPA}42 sources: ${CI_PPA}

Subscribers

People subscribed via source and target branches