~oddbloke/vmbuilder/jenkins_kvm

« back to all changes in this revision

Viewing changes to jenkins/CloudImages_VPS.sh

  • Committer: Robert Jennings
  • Date: 2016-05-12 13:58:01 UTC
  • mfrom: (748.1.4 jenkins_kvm)
  • Revision ID: robert.jennings@canonical.com-20160512135801-0p1mmmdxv6rrf3y2
Handle img rename in CloudImage_Azure.sh and remove cruft

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/bash
2
 
 
3
 
# Set default umask
4
 
umask 022
5
 
 
6
 
# Read in the common files
7
 
source "${kvm}/functions/common"
8
 
source "${kvm}/functions/retry"
9
 
 
10
 
# Apply the build stuff
11
 
find . -iname "*build_properties" | xargs -I FILE cp FILE .
12
 
[ -e "build_properties" ] &&
13
 
    source build_properties ||
14
 
    fail "Failed to read build_properties. I don't know what I'm doing!"
15
 
 
16
 
rm {failed,success} || /bin/true
17
 
 
18
 
# Copy the target disk image
19
 
disk_orig="${SUITE}-server-cloudimg-${ARCH}-disk1.img"
20
 
disk_cp="${disk_orig//cloudimg/cloudimg-vps}"
21
 
disk_root="/srv/ec2-images/${SUITE}/${SERIAL:-current}"
22
 
disk_working="${WORKSPACE}/${disk_cp}"
23
 
raw_f="${WORKSPACE}/raw_f-$(date +%s).img"
24
 
 
25
 
cp "${disk_root}/${disk_orig}" "${disk_working}" ||
26
 
    fail "Unable to copy ${disk_orig} from ${disk_root}"
27
 
 
28
 
# Launch KVM to do the work
29
 
${kvm}/launch_kvm.sh \
30
 
        --id "${ARCH}-${BUILD_ID}" \
31
 
        --mem 1024 \
32
 
        --user-data "${kvm}/config/cloud-vps.cfg" \
33
 
        --cloud-config "${kvm}/templates/img-vps.tmpl" \
34
 
        --extra-disk "${disk_working}" \
35
 
        --disk-gb 1 \
36
 
        --raw-disk "${raw_f}" \
37
 
        --raw-size 1 \
38
 
        --img-url /srv/builder/images/precise-builder-latest.img ||
39
 
            fail "KVM instance failed to build image."
40
 
 
41
 
# Remove the results
42
 
rm "${raw_f}" || /bin/true