Merge lp:~adeuring/vmbuilder/jenkins_kvm-optionally-use-juju-test-packages into lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm

Proposed by Abel Deuring
Status: Merged
Merge reported by: Abel Deuring
Merged at revision: not available
Proposed branch: lp:~adeuring/vmbuilder/jenkins_kvm-optionally-use-juju-test-packages
Merge into: lp:~ubuntu-on-ec2/vmbuilder/jenkins_kvm
Diff against target: 172 lines (+60/-8)
5 files modified
build-juju-local.sh (+16/-1)
handle-xdeb.py (+15/-0)
launch_kvm.sh (+9/-3)
standalone.sh (+4/-2)
templates/img-juju.tmpl (+16/-2)
To merge this branch: bzr merge lp:~adeuring/vmbuilder/jenkins_kvm-optionally-use-juju-test-packages
Reviewer Review Type Date Requested Status
Abel Deuring (community) Needs Resubmitting
Ben Howard (community) Disapprove
Review via email: mp+229606@code.launchpad.net

Description of the change

The Juju QA team wants to build and test Vagrant boxes with debian packages that are regularily built by the team's CI infrastructure.

This branch adds two new environment variables, JUJU_CORE_PKG and JUJU_LOCAL_PKG. If they are defined, launch_kvm.sh adds the package files specificied by the variables to the cloud-init data and img-juju.tmpl installs them.

To post a comment you must log in.
Revision history for this message
Ben Howard (darkmuggle-deactivatedaccount) wrote :

I'm okay with changing launch_kvm, however, changes must be generic and not specific. launch_kvm is used to buid a variety of images.

review: Disapprove
455. By Abel Deuring

Pass optional could-init files to launch_kvm.sh and standalone.sh via command a line parameter; add these parameter in build-juju-local.sh when then env variables JUJU_CORE_PKG or JUJU_LOCAL_PKG are set.

Revision history for this message
Abel Deuring (adeuring) wrote :

> I'm okay with changing launch_kvm, however, changes must be generic and not
> specific. launch_kvm is used to buid a variety of images.

I've changed launch_kvm.sh and standalone.sh to accept accept another parameter, --cloud-init-file. The value(s) of this parameter is(are) passed to write-mime-multipart.

review: Needs Resubmitting
456. By Abel Deuring

standalone.sh: Prevent processing of --fetch_new consuming the next parameter.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'build-juju-local.sh'
--- build-juju-local.sh 2014-07-25 21:29:07 +0000
+++ build-juju-local.sh 2014-08-14 07:58:38 +0000
@@ -37,7 +37,10 @@
37test_cmd_exists sstream-query simplestreams37test_cmd_exists sstream-query simplestreams
3838
39# This defines what gets built39# This defines what gets built
40build_for=${BUILD_FOR:-trusty:amd64 precise:amd64}40build_for=(${BUILD_FOR:-trusty:amd64 precise:amd64})
41[ -n "${JUJU_CORE_PKG}" -o -n "${JUJU_LOCAL_PKG}" ] && \
42 [ ${#build_for[@]} -ge 2 ] && \
43 fail "JUJU_CORE_PKG and JUJU_LOCAL_PKG can be specified only for a single build target."
4144
42for build in ${build_for[@]};45for build in ${build_for[@]};
43do46do
@@ -62,6 +65,18 @@
62 )65 )
6366
64 [ ! -e "${builder_img}" ] && cmd+=("--fetch_new")67 [ ! -e "${builder_img}" ] && cmd+=("--fetch_new")
68 if [ -n "${JUJU_CORE_PKG}" -o -n "${JUJU_LOCAL_PKG}" ]; then
69 cmd+=("--cloud-init-file ${mydir}/handle-xdeb.py:text/part-handler")
70 if [ -n "${JUJU_CORE_PKG}" ]; then
71 cmd+=("--cloud-init-file ${JUJU_CORE_PKG}:application/x-deb")
72 echo "JUJU_CORE_PKG=$(basename $JUJU_CORE_PKG)" > ${tmp_dir}/juju-sources.sh
73 fi
74 if [ -n "${JUJU_LOCAL_PKG}" ]; then
75 cmd+=("--cloud-init-file ${JUJU_LOCAL_PKG}:application/x-deb")
76 echo "JUJU_LOCAL_PKG=$(basename $JUJU_LOCAL_PKG)" >> ${tmp_dir}/juju-sources.sh
77 fi
78 cmd+=("--cloud-init-file ${tmp_dir}/juju-sources.sh:application/x-shellscript")
79 fi
6580
66 [ -e "${results_d_arch}/${suite}-server-cloudimg-${arch}-juju-vagrant-disk1.img" ] ||81 [ -e "${results_d_arch}/${suite}-server-cloudimg-${arch}-juju-vagrant-disk1.img" ] ||
67 ( cd ${results_d_arch} && ${cmd[@]} )82 ( cd ${results_d_arch} && ${cmd[@]} )
6883
=== added file 'handle-xdeb.py'
--- handle-xdeb.py 1970-01-01 00:00:00 +0000
+++ handle-xdeb.py 2014-08-14 07:58:38 +0000
@@ -0,0 +1,15 @@
1handler_version = 2
2
3
4def list_types():
5 return(["application/x-deb", "application/x-shellscript"])
6
7
8def handle_part(data, ctype, filename, payload, frequency):
9 import os
10 if ctype in ("__begin__", "__end__"):
11 return
12
13 dest = os.path.join(data.get_ipath(), filename)
14 with open(dest, 'w') as out:
15 out.write(payload)
016
=== modified file 'launch_kvm.sh'
--- launch_kvm.sh 2014-06-24 19:40:10 +0000
+++ launch_kvm.sh 2014-08-14 07:58:38 +0000
@@ -17,12 +17,13 @@
17 --raw-disk <ARG> Name of RAW disk to create and attach.17 --raw-disk <ARG> Name of RAW disk to create and attach.
18 --raw-size <ARG> Size of RAW disk in GB.18 --raw-size <ARG> Size of RAW disk in GB.
19 --extra-disk <ARG> Add an extra disk, starting with /dev/vdd19 --extra-disk <ARG> Add an extra disk, starting with /dev/vdd
20 --cloud-init-file <ARG> Additional file for the cloud-init data
20EOF21EOF
21exit 122exit 1
22}23}
2324
24short_opts="h"25short_opts="h"
25long_opts="id:,ssh_port,disk-gb:,mem:,bzr-automated-ec2-builds:,cloud-config:,user-data:,kernel-url:,img-url:,raw-disk:,raw-size:,smp:,extra-disk:,help"26long_opts="id:,ssh_port,disk-gb:,mem:,bzr-automated-ec2-builds:,cloud-config:,user-data:,kernel-url:,img-url:,raw-disk:,raw-size:,smp:,extra-disk:,cloud-init-file:,help"
26getopt_out=$(getopt --name "${0##*/}" \27getopt_out=$(getopt --name "${0##*/}" \
27 --options "${short_opts}" --long "${long_opts}" -- "$@") &&28 --options "${short_opts}" --long "${long_opts}" -- "$@") &&
28 eval set -- "${getopt_out}" ||29 eval set -- "${getopt_out}" ||
@@ -52,6 +53,7 @@
52 --raw-size) raw_size="$2"; shift;;53 --raw-size) raw_size="$2"; shift;;
53 --smp) smp_opts="$2"; shift;;54 --smp) smp_opts="$2"; shift;;
54 --extra-disk) [ -z "${extra_disk}" ] && extra_disk=$2 || extra_disk="${extra_disk} $2"; shift;;55 --extra-disk) [ -z "${extra_disk}" ] && extra_disk=$2 || extra_disk="${extra_disk} $2"; shift;;
56 --cloud-init-file) [ -z "${cloud_init_files}" ] && cloud_init_files=$2 || cloud_init_files="${cloud_init_files} $2"; shift;;
55 -h|--help) usage; exit 0;;57 -h|--help) usage; exit 0;;
56 --) shift; break;;58 --) shift; break;;
57 esac59 esac
@@ -78,8 +80,12 @@
78[ -z "${ccloud}" ] && fail "Must define cloud-config script via --cloud-config"80[ -z "${ccloud}" ] && fail "Must define cloud-config script via --cloud-config"
7981
80debug "Creating Cloud-Init configuration..."82debug "Creating Cloud-Init configuration..."
81write-mime-multipart -o "${work_d}/user-data.txt" "${ccloud}" "${ud}" ||83write_mime_args=(
82 fail "Unable to create user-data"84 -o "${work_d}/user-data.txt"
85 "${ccloud}"
86 "${ud}")
87write_mime_args+=(${cloud_init_files[@]})
88write-mime-multipart ${write_mime_args[@]} || fail "Unable to create user-data"
8389
84echo "instance-id: $(uuidgen)" > "${work_d}/meta-data"90echo "instance-id: $(uuidgen)" > "${work_d}/meta-data"
85echo "local-hostname: builder" >> "${work_d}/meta-data"91echo "local-hostname: builder" >> "${work_d}/meta-data"
8692
=== modified file 'standalone.sh'
--- standalone.sh 2014-07-10 21:50:47 +0000
+++ standalone.sh 2014-08-14 07:58:38 +0000
@@ -71,7 +71,7 @@
71}71}
7272
73short_opts="h"73short_opts="h"
74long_opts="suite:,use_img:,install,streams:,template:,addin:,arch:,resize:,config:,final_img:,cloud_cfg:,fetch_new,resize_final:"74long_opts="suite:,use_img:,install,streams:,template:,addin:,arch:,resize:,config:,final_img:,cloud_cfg:,fetch_new,resize_final:,cloud-init-file:"
75getopt_out=$(getopt --name "${0##*/}" \75getopt_out=$(getopt --name "${0##*/}" \
76 --options "${short_opts}" --long "${long_opts}" -- "$@") &&76 --options "${short_opts}" --long "${long_opts}" -- "$@") &&
77 eval set -- "${getopt_out}" ||77 eval set -- "${getopt_out}" ||
@@ -105,8 +105,9 @@
105 --config) config="${2}"; shift;;105 --config) config="${2}"; shift;;
106 --cloud_cfg) cloud_cfg="${2}"; shift;;106 --cloud_cfg) cloud_cfg="${2}"; shift;;
107 --final_img) final_img="${2}"; shift;;107 --final_img) final_img="${2}"; shift;;
108 --fetch_new) fetch_new=1; shift;;108 --fetch_new) fetch_new=1;;
109 --resize_final) resize_final="${2}"; shift;;109 --resize_final) resize_final="${2}"; shift;;
110 --cloud-init-file) [ -z "${cloud_init_files}" ] && cloud_init_files="--cloud-init-file ${2}" || cloud_init_files="${cloud_init_files} --cloud-init-file ${2}"; shift;;
110 -h|--help) usage; exit 0;;111 -h|--help) usage; exit 0;;
111 --) shift; break;;112 --) shift; break;;
112 esac113 esac
@@ -256,6 +257,7 @@
256 "--raw-disk $(readlink -f $raw_f)"257 "--raw-disk $(readlink -f $raw_f)"
257 "--raw-size ${raw_size:-20}"258 "--raw-size ${raw_size:-20}"
258 "--img-url $(readlink -f $mod_img)"259 "--img-url $(readlink -f $mod_img)"
260 "${cloud_init_files[@]}"
259)261)
260262
261# Run the command263# Run the command
262264
=== modified file 'templates/img-juju.tmpl'
--- templates/img-juju.tmpl 2014-08-08 07:48:18 +0000
+++ templates/img-juju.tmpl 2014-08-14 07:58:38 +0000
@@ -316,7 +316,6 @@
316 byobu316 byobu
317 lxc317 lxc
318 cgroup-lite318 cgroup-lite
319 juju-core
320 bzr319 bzr
321 git320 git
322 mongodb-server321 mongodb-server
@@ -324,9 +323,13 @@
324 python-pip323 python-pip
325 libnss-myhostname324 libnss-myhostname
326 rsyslog-gnutls325 rsyslog-gnutls
327 juju-local
328 )326 )
329327
328instance_dir=$(dirname $(dirname $(readlink -f $0)))
329[ -e ${instance_dir}/juju-sources.sh ] && source ${instance_dir}/juju-sources.sh
330[ -z ${JUJU_CORE_PKG} ] && pkgs+=(juju-core)
331[ -z ${JUJU_LOCAL_PKG} ] && pkgs+=(juju-local)
332
330if [ "${suite}" == "precise" ]; then333if [ "${suite}" == "precise" ]; then
331 pkgs+=(linux-headers-generic-lts-raring334 pkgs+=(linux-headers-generic-lts-raring
332 linux-generic-lts-raring)335 linux-generic-lts-raring)
@@ -355,6 +358,17 @@
355xchroot apt-get -y update358xchroot apt-get -y update
356xchroot update-grub359xchroot update-grub
357360
361if [ -n "${JUJU_CORE_PKG}" ] ; then
362 cp ${instance_dir}/${JUJU_CORE_PKG} ${mp}/tmp/
363 xchroot dpkg -i /tmp/${JUJU_CORE_PKG}
364fi
365
366if [ -n "${JUJU_LOCAL_PKG}" ] ; then
367 cp ${instance_dir}/${JUJU_LOCAL_PKG} ${mp}/tmp/
368 xchroot apt-get install -y cpu-checker juju-mongodb
369 xchroot dpkg -i /tmp/${JUJU_LOCAL_PKG}
370fi
371
358# Gets rid of an annoying message for shell provisioner372# Gets rid of an annoying message for shell provisioner
359xchroot sed -i "s|mesg n|tty -s \&\& mesg n|g" /root/.profile373xchroot sed -i "s|mesg n|tty -s \&\& mesg n|g" /root/.profile
360374

Subscribers

People subscribed via source and target branches