Merge lp:~sinzui/juju-release-tools/build-with-cloud-templates into lp:juju-release-tools

Proposed by Curtis Hovey
Status: Merged
Merged at revision: 242
Proposed branch: lp:~sinzui/juju-release-tools/build-with-cloud-templates
Merge into: lp:juju-release-tools
Diff against target: 36 lines (+13/-4)
1 file modified
build_package.py (+13/-4)
To merge this branch: bzr merge lp:~sinzui/juju-release-tools/build-with-cloud-templates
Reviewer Review Type Date Requested Status
Martin Packman (community) Approve
Review via email: mp+280217@code.launchpad.net

Description of the change

Build arm64 binary packages.

This branch makes a few changes to support building arm64 packages, and as a consequence, allows us to stop pre-populating the lxc download template cache to machines on private networks. We discovered that the images for lxc "download" template are not maintained; the wily arm64 image is from June of the year! Even the ppc64el images are not updated as often as the amd64 images. Only lxc cloud images are genuinely current.

I previously tried and abandoned an effort to use the lxc ubuntu-cloud template because it was unreliable on ppc64el. It is also unreliable on arm64. We know understand that cloud init is changing the /etc/apt/sources.list, and the config is invalid for arm64 ad ppc64el. The lesser archs prefer ports.ubuntu.com/ubuntu-ports.

A. We now use the ubuntu-cloud template. This also means we don't need special egress rules for building on canonical networks.

B. We poll for cloud init to complete. This is done by tailing the cloud-init-output.log. The egrep call is case-insensitive because precise is "cloud-init", trusty and above is "Cloud-init"

C. For arm64 and ppc64el, we rewrite the archives that point to archives.ubuntu.com/ubuntu to ports.ubuntu.com/ubuntu-ports

This is tested on arm64 wily, ppc64el trusty, amd64 trusty.

We still cannot build on precise because the kernel does not support lxc-attach. We can switch from lxc-attach to ssh in the future if we wish.

To post a comment you must log in.
Revision history for this message
Martin Packman (gz) wrote :

Looks good, one thing to fix, see inline comment.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'build_package.py'
2--- build_package.py 2015-11-25 15:42:33 +0000
3+++ build_package.py 2015-12-10 23:33:33 +0000
4@@ -36,7 +36,7 @@
5
6 CREATE_LXC_TEMPLATE = """\
7 set -eu
8-sudo lxc-create -t download -n {container} -- -d ubuntu -r {series} -a {arch}
9+sudo lxc-create -t ubuntu-cloud -n {container} -- -r {series} -a {arch}
10 sudo mkdir /var/lib/lxc/{container}/rootfs/workspace
11 echo "lxc.mount.entry = {build_dir} workspace none bind 0 0" |
12 sudo tee -a /var/lib/lxc/{container}/config
13@@ -48,11 +48,20 @@
14 set -eu
15 echo "\nInstalling common build deps.\n"
16 cd workspace
17- while ! ifconfig | grep -q "addr:10.0."; do
18- echo "Waiting for network"
19- sleep 1
20+ # Wait for Cloud-init to complete to indicate the machine is in a ready
21+ # state with network to do work,
22+ while ! tail -1 /var/log/cloud-init-output.log | \
23+ egrep -q 'Cloud-init .* finished'; do
24+ echo "Waiting for Cloud-init to finish."
25+ sleep 5
26 done
27 set +e
28+ # The cloud-init breaks arm64 and ppc64el /etc/apt/sources.list.
29+ if [[ $(dpkg --print-architecture) =~ ^(arm64|ppc64el)$ ]]; then
30+ sed -i \
31+ -e 's,archive.ubuntu.com/ubuntu,ports.ubuntu.com/ubuntu-ports,' \
32+ /etc/apt/sources.list
33+ fi
34 # Adding the ppa directly to sources.list without the archive key
35 # requires apt to be run with --force-yes
36 echo "{ppa}" >> /etc/apt/sources.list

Subscribers

People subscribed via source and target branches