Merge lp:~timrchavez/charm-helpers/jenkins-slave-fix-slave-relation-joined into lp:charm-helpers

Proposed by Timothy R. Chavez
Status: Rejected
Rejected by: Jorge Niedbalski
Proposed branch: lp:~timrchavez/charm-helpers/jenkins-slave-fix-slave-relation-joined
Merge into: lp:charm-helpers
Diff against target: 190 lines (+128/-0)
11 files modified
config.yaml (+8/-0)
copyright (+17/-0)
hooks/install (+28/-0)
hooks/install.d/README (+7/-0)
hooks/slave-relation-changed (+25/-0)
hooks/slave-relation-departed (+3/-0)
hooks/slave-relation-joined (+20/-0)
hooks/start (+3/-0)
hooks/stop (+3/-0)
metadata.yaml (+13/-0)
revision (+1/-0)
To merge this branch: bzr merge lp:~timrchavez/charm-helpers/jenkins-slave-fix-slave-relation-joined
Reviewer Review Type Date Requested Status
Jorge Niedbalski (community) Disapprove
Marco Ceppi Needs Information
Review via email: mp+214991@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Marco Ceppi (marcoceppi) wrote :

I'm confused, is this supposed to be merged in to charm-helpers or in to jenkins-slave?

review: Needs Information
Revision history for this message
Jorge Niedbalski (niedbalski) wrote :

This seems to be wrongly proposed, this should be proposed against the jenkins-slave charm.

review: Disapprove

Unmerged revisions

11. By Timothy R. Chavez

Add missing 'relation-set' of 'slaveaddress' so that Jenkins slaves can
be added to the Jenkins master via the 'juju add-relation' interface.
Currently the Jenkins master hook assumes (see: master-relation-changed)
that the Jenkins slave sets 'slaveaddress' and will use value to add the
slave. If no value is set for 'slaveaddress', it will be empty, and the
'addnode' script it passes the value to will fail.

10. By James Page

Fix configuration issue and add extension features

9. By James Page

Made myself the maintainer

8. By Timothy R. Chavez

Normalize indentation in the install hook.

7. By James Page

Updates for revision and private-address

6. By James Page

Fixes for juju renaming

5. By James Page

Updated formula to work on natty and oneiric

4. By James Page

General tidy and added configuration options

3. By James Page

Renamed copyright

2. By James Page

Added license file

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'config.yaml'
2--- config.yaml 1970-01-01 00:00:00 +0000
3+++ config.yaml 2014-04-09 16:45:21 +0000
4@@ -0,0 +1,8 @@
5+options:
6+ tools:
7+ type: string
8+ default: git gcc make bzr
9+ description: Tooling to deploy on jenkins slave node
10+ labels:
11+ type: string
12+ description: Jenkins labels to associate with jenkins slave node
13
14=== added file 'copyright'
15--- copyright 1970-01-01 00:00:00 +0000
16+++ copyright 2014-04-09 16:45:21 +0000
17@@ -0,0 +1,17 @@
18+Format: http://dep.debian.net/deps/dep5/
19+
20+Files: *
21+Copyright: Copyright 2011, Canonical Ltd., All Rights Reserved.
22+License: GPL-3
23+ This program is free software: you can redistribute it and/or modify
24+ it under the terms of the GNU General Public License as published by
25+ the Free Software Foundation, either version 3 of the License, or
26+ (at your option) any later version.
27+ .
28+ This program is distributed in the hope that it will be useful,
29+ but WITHOUT ANY WARRANTY; without even the implied warranty of
30+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
31+ GNU General Public License for more details.
32+ .
33+ You should have received a copy of the GNU General Public License
34+ along with this program. If not, see <http://www.gnu.org/licenses/>.
35
36=== added directory 'hooks'
37=== added symlink 'hooks/config-changed'
38=== target is u'install'
39=== added file 'hooks/install'
40--- hooks/install 1970-01-01 00:00:00 +0000
41+++ hooks/install 2014-04-09 16:45:21 +0000
42@@ -0,0 +1,28 @@
43+#!/bin/bash
44+
45+set -eu
46+
47+install_slave () {
48+ juju-log "Installing jenkins-slave..."
49+ apt-get -y install -qq jenkins-slave wget
50+}
51+[[ -f /etc/init/jenkins-slave.conf ]] || install_slave
52+
53+# Install some tools - can get set up deployment time
54+install_tools () {
55+ juju-log "Installing tools..."
56+ apt-get -y install -qq `config-get tools`
57+}
58+install_tools
59+
60+# Execute any hook overlay which may be provided
61+# by forks of this charm
62+if [ -d hooks/install.d ]
63+then
64+ for i in `ls -1 hooks/install.d/*`
65+ do
66+ [[ -x $i ]] && . ./$i
67+ done
68+fi
69+
70+exit 0
71
72=== added directory 'hooks/install.d'
73=== added file 'hooks/install.d/README'
74--- hooks/install.d/README 1970-01-01 00:00:00 +0000
75+++ hooks/install.d/README 2014-04-09 16:45:21 +0000
76@@ -0,0 +1,7 @@
77+This directory can be used to extend the function
78+of the jenkins master charm without changing any
79+of the base hooks.
80+
81+Files must be executable otherwise the install hook
82+(which is also run on upgrade-charm and config-changed
83+hooks) will not execute them.
84
85=== added symlink 'hooks/slave-relation-broken'
86=== target is u'slave-relation-departed'
87=== added file 'hooks/slave-relation-changed'
88--- hooks/slave-relation-changed 1970-01-01 00:00:00 +0000
89+++ hooks/slave-relation-changed 2014-04-09 16:45:21 +0000
90@@ -0,0 +1,25 @@
91+#!/bin/bash
92+
93+set -e
94+
95+# Setup connection to master instance once set
96+url=$(relation-get url)
97+
98+if [ "x$url" = "x" ]; then
99+ juju-log "Master hasn't exported its url yet, exiting..."
100+ exit 0
101+fi
102+
103+# Set the slave hostname to match the juju unit
104+# in the jenkins master instance
105+slavehost=`echo ${JUJU_UNIT_NAME} | sed s,/,-,`
106+
107+juju-log "Configuring jenkins-slave with $url..."
108+sed -i -e "s!^JENKINS_HOSTNAME.*!JENKINS_HOSTNAME=${slavehost}!" \
109+ -e "s!^#*JENKINS_URL.*!JENKINS_URL=${url}!" \
110+ /etc/default/jenkins-slave
111+
112+juju-log "Restarting jenkins-slave..."
113+# Startup the jenkins-slave service
114+stop jenkins-slave 2>/dev/null || true
115+start jenkins-slave
116
117=== added file 'hooks/slave-relation-departed'
118--- hooks/slave-relation-departed 1970-01-01 00:00:00 +0000
119+++ hooks/slave-relation-departed 2014-04-09 16:45:21 +0000
120@@ -0,0 +1,3 @@
121+#!/bin/bash
122+
123+stop jenkins-slave || true
124
125=== added file 'hooks/slave-relation-joined'
126--- hooks/slave-relation-joined 1970-01-01 00:00:00 +0000
127+++ hooks/slave-relation-joined 2014-04-09 16:45:21 +0000
128@@ -0,0 +1,20 @@
129+#!/bin/bash
130+
131+set -e
132+
133+# Set the slave hostname to match the juju unit
134+# in the jenkins master instance
135+slavehost=`echo ${JUJU_UNIT_NAME} | sed s,/,-,`
136+noexecutors=`cat /proc/cpuinfo | grep processor | wc -l`
137+config_labels=`config-get labels`
138+labels=`uname -p`
139+
140+if [ -n "$config_labels" ]; then
141+ labels=$config_labels
142+fi
143+
144+# Set all relations
145+relation-set executors=$noexecutors
146+relation-set labels="$labels"
147+relation-set slavehost=$slavehost
148+relation-set slaveaddress=`unit-get private-address`
149
150=== added file 'hooks/start'
151--- hooks/start 1970-01-01 00:00:00 +0000
152+++ hooks/start 2014-04-09 16:45:21 +0000
153@@ -0,0 +1,3 @@
154+#!/bin/bash
155+
156+start jenkins-slave || true
157
158=== added file 'hooks/stop'
159--- hooks/stop 1970-01-01 00:00:00 +0000
160+++ hooks/stop 2014-04-09 16:45:21 +0000
161@@ -0,0 +1,3 @@
162+#!/bin/bash
163+
164+stop jenkins-slave
165
166=== added symlink 'hooks/upgrade-charm'
167=== target is u'install'
168=== added file 'metadata.yaml'
169--- metadata.yaml 1970-01-01 00:00:00 +0000
170+++ metadata.yaml 2014-04-09 16:45:21 +0000
171@@ -0,0 +1,13 @@
172+ensemble: formula
173+name: jenkins-slave
174+maintainer: James Page <james.page@ubuntu.com>
175+summary: Jenkins CI Slave
176+description: |
177+ Jenkins is a Continous Integration server supporting
178+ flexible continous integration and deployment methodologies
179+ and more.
180+ .
181+ This formula provides support for jenkins slaves
182+provides:
183+ slave:
184+ interface: jenkins-slave
185
186=== added file 'revision'
187--- revision 1970-01-01 00:00:00 +0000
188+++ revision 2014-04-09 16:45:21 +0000
189@@ -0,0 +1,1 @@
190+9

Subscribers

People subscribed via source and target branches