Merge lp:~juju-qa/charms/precise/jenkins-slave/trunk into lp:charms/jenkins-slave

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 13
Proposed branch: lp:~juju-qa/charms/precise/jenkins-slave/trunk
Merge into: lp:charms/jenkins-slave
Diff against target: 143 lines (+79/-29)
4 files modified
README.md (+23/-0)
hooks/install (+48/-21)
hooks/install.d/README.md (+7/-7)
metadata.yaml (+1/-1)
To merge this branch: bzr merge lp:~juju-qa/charms/precise/jenkins-slave/trunk
Reviewer Review Type Date Requested Status
Charles Butler (community) Approve
Review via email: mp+219749@code.launchpad.net

Description of the change

These changes allow jenkins-slave charm to be deployed to trusty and utopic.

Jenkins was removed from Ubuntu trusty. It is not possible to install jenkins from Ubuntu archives on trusty.
I need to deploy trusty jenkins-slaves into closed networks. I cannot install the slave via PPA.
I also intend to relate the trusty jenkins-slave to a precise jenkins master.

Jenkins as a sordid history of introducing incompatibilities with previous version. A small version change can prevent a slave from talking to a master or break hundreds of plugins. I choose to include the precise jenkins-slave package in the charm to ensure this charm is compatible with the only master jenkins a user can deploy (a precise one).

I refactored install to make it easier to read and more robust.

You don't have to accept this, but since I have a queue of people wanting this charm, mine will be the one used in the wild, and by other Canonical divisions :)

To post a comment you must log in.
Revision history for this message
Charles Butler (lazypower) wrote :

Greetings,

I've had a chance to review this great jenkins slave submission! I do have a few nit picks with commentary on how to improve, they are as follows:

The README, while now being present - is still extremely light on details. It would be nice to cover all the basics of a readme. If you have the charm-tools package installed, issue 'charm add readme' and fill out the pertinent portions of the readme that effect the jenkins-slave charm complete with but not limited to:

- Configuration
- Upstream Details on where to file bugs/ how to contact the maintainer
- adding the details from hooks/install.d into the main README
- Adding details on how to provide a newer DPKG than whats packaged in the charm

In the metadata.yaml, where James Page is still the listed maintainer. Is the Juju QA team taking over the Jenkins Charm suite? If so, it would be brilliant if you could set the QA team as the maintainer of the charm in the metadata.

While I like the concept of fat charms and using the deb packaged within the charm itself, it would be another great addition to add the option for installation from a PPA - such as outlined here: https://wiki.jenkins-ci.org/display/JENKINS/Installing+Jenkins+on+Ubuntu

All in all this is a great submission. I deployed 3 nodes, everything seems to be in order.

Thank you for a great submission! I look forward to seeing future contributions.

review: Approve
Revision history for this message
Curtis Hovey (sinzui) wrote :

We cannot add support for the jenkins built debs until the jenkins master charm is updated to support it. The slave must match the master for all series. That is why I chose to reuse the precise deb...ubuntu and juju charms only support precise jenkins masters of version 1.424.6+dfsg-1ubuntu0.2 at this time :(

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'README.md'
2--- README.md 1970-01-01 00:00:00 +0000
3+++ README.md 2014-05-15 19:05:29 +0000
4@@ -0,0 +1,23 @@
5+# Overview
6+
7+This charm provisions a Jenkins slave to connect to a Jenkins master.
8+This is the companion to the Jenkins charm.
9+
10+
11+# Usage
12+
13+To deploy a Jenkins slave you will also need to deploy the jenkins master
14+charm. This can be done as follows:
15+
16+ juju deploy jenkins
17+ juju deploy -n 5 jenkins-slave
18+ juju add-relation jenkins jenkins-slave
19+
20+There are cases where you want to provision a specific machine that
21+provides specific resources for tests, such as CPU architecture or
22+network access. You can deploy the extra slave like this:
23+
24+ juju add-machine <special-machine-private-ip>
25+ juju deploy --to <special-mabine-number> jenkins-slave ppc-slave
26+
27+See the Jenkins charm for more details.
28
29=== added directory 'files'
30=== added file 'files/jenkins-slave_1.424.6+dfsg-1ubuntu0.2_all.deb'
31Binary files files/jenkins-slave_1.424.6+dfsg-1ubuntu0.2_all.deb 1970-01-01 00:00:00 +0000 and files/jenkins-slave_1.424.6+dfsg-1ubuntu0.2_all.deb 2014-05-15 19:05:29 +0000 differ
32=== modified file 'hooks/install'
33--- hooks/install 2012-07-31 13:47:53 +0000
34+++ hooks/install 2014-05-15 19:05:29 +0000
35@@ -1,28 +1,55 @@
36 #!/bin/bash
37
38-set -eu
39-
40+set -eux
41+
42+
43+# Install the slave if it is not installed already.
44 install_slave () {
45- juju-log "Installing jenkins-slave..."
46- apt-get -y install -qq jenkins-slave wget
47+ juju-log "Installing jenkins-slave..."
48+ if [[ ! -f /etc/init/jenkins-slave.conf ]]
49+ then
50+ if [[ $(apt-cache madison jenkins-slave) =~ .*jenkins-slave.* ]]
51+ then
52+ apt-get -y install -qq jenkins-slave wget
53+ else
54+ # This series doesn't provide a jenkins.
55+ # Install the same slave package as the precise Jenkins master.
56+ apt-get -y install -qq wget adduser default-jre-headless upstart-job
57+ dpkg -i files/jenkins-slave_*.deb
58+ fi
59+ else
60+ juju-log "Jenkins-slave is already installed"
61+ fi
62 }
63-[[ -f /etc/init/jenkins-slave.conf ]] || install_slave
64-
65-# Install some tools - can get set up deployment time
66+
67+
68+# Install extra packages needed by the slave.
69 install_tools () {
70- juju-log "Installing tools..."
71- apt-get -y install -qq `config-get tools`
72-}
73+ juju-log "Installing tools..."
74+ apt-get -y install -qq $(config-get tools)
75+}
76+
77+
78+# Execute any hook overlay which may be provided
79+# by forks of this charm.
80+install_extra_hooks () {
81+ juju-log "Installing hooks..."
82+ if [[ -d hooks/install.d ]]
83+ then
84+ for i in $(ls -1 hooks/install.d/*)
85+ do
86+ if [[ -x $i ]]
87+ then
88+ source ./$i
89+ fi
90+ done
91+ else
92+ juju-log "No extra hooks found."
93+ fi
94+}
95+
96+
97+install_slave
98 install_tools
99-
100-# Execute any hook overlay which may be provided
101-# by forks of this charm
102-if [ -d hooks/install.d ]
103-then
104- for i in `ls -1 hooks/install.d/*`
105- do
106- [[ -x $i ]] && . ./$i
107- done
108-fi
109-
110+install_extra_hooks
111 exit 0
112
113=== renamed file 'hooks/install.d/README' => 'hooks/install.d/README.md'
114--- hooks/install.d/README 2012-07-27 09:43:45 +0000
115+++ hooks/install.d/README.md 2014-05-15 19:05:29 +0000
116@@ -1,7 +1,7 @@
117-This directory can be used to extend the function
118-of the jenkins master charm without changing any
119-of the base hooks.
120-
121-Files must be executable otherwise the install hook
122-(which is also run on upgrade-charm and config-changed
123-hooks) will not execute them.
124+# hooks/install.d
125+
126+This directory can be used to extend the function of the jenkins master
127+charm without changing any of the base hooks.
128+
129+Files must be executable otherwise the install hook (which is also run
130+on upgrade-charm and config-changed hooks) will not execute them.
131
132=== modified file 'metadata.yaml'
133--- metadata.yaml 2014-03-26 03:14:41 +0000
134+++ metadata.yaml 2014-05-15 19:05:29 +0000
135@@ -6,7 +6,7 @@
136 flexible continous integration and deployment methodologies
137 and more.
138 .
139- This formula provides support for jenkins slaves
140+ This charm provides support for jenkins slaves
141 categories:
142 - applications
143 provides:

Subscribers

People subscribed via source and target branches