Merge "Improve trove guest image build script"
This commit is contained in:
commit
774cb66671
@ -4,4 +4,3 @@ pkg-map
|
|||||||
source-repositories
|
source-repositories
|
||||||
svc-map
|
svc-map
|
||||||
pip-and-virtualenv
|
pip-and-virtualenv
|
||||||
ubuntu-docker
|
|
||||||
|
@ -1,15 +1,42 @@
|
|||||||
guest-agent:
|
guest-agent:
|
||||||
installtype: package
|
installtype: package
|
||||||
|
acl:
|
||||||
|
acpid:
|
||||||
|
arch: i386, amd64, arm64, s390x
|
||||||
|
apparmor:
|
||||||
|
apt-transport-https:
|
||||||
build-essential:
|
build-essential:
|
||||||
python3-all:
|
cloud-guest-utils:
|
||||||
python3-all-dev:
|
cloud-init:
|
||||||
python3-pip:
|
cron:
|
||||||
python3-sqlalchemy:
|
dbus:
|
||||||
|
dkms:
|
||||||
|
dmeventd:
|
||||||
|
ethtool:
|
||||||
|
gpg-agent:
|
||||||
|
ifenslave:
|
||||||
|
ifupdown:
|
||||||
|
iptables:
|
||||||
|
isc-dhcp-client:
|
||||||
libxml2-dev:
|
libxml2-dev:
|
||||||
libxslt1-dev:
|
libxslt1-dev:
|
||||||
libffi-dev:
|
libffi-dev:
|
||||||
libssl-dev:
|
libssl-dev:
|
||||||
libyaml-dev:
|
libyaml-dev:
|
||||||
|
less:
|
||||||
|
logrotate:
|
||||||
|
netbase:
|
||||||
|
open-vm-tools:
|
||||||
|
arch: i386, amd64
|
||||||
openssh-client:
|
openssh-client:
|
||||||
openssh-server:
|
openssh-server:
|
||||||
|
pollinate:
|
||||||
|
psmisc:
|
||||||
|
python3-sqlalchemy:
|
||||||
rsync:
|
rsync:
|
||||||
|
rsyslog:
|
||||||
|
ubuntu-cloudimage-keyring:
|
||||||
|
ureadahead:
|
||||||
|
uuid-runtime:
|
||||||
|
vim-tiny:
|
||||||
|
vlan:
|
||||||
|
@ -6,4 +6,4 @@
|
|||||||
set -e
|
set -e
|
||||||
set -o xtrace
|
set -o xtrace
|
||||||
|
|
||||||
apt-get clean
|
apt-get --assume-yes purge --auto-remove
|
||||||
|
@ -14,6 +14,7 @@ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
|
|||||||
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu ${DIB_RELEASE} stable"
|
add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu ${DIB_RELEASE} stable"
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y -qq docker-ce >/dev/null
|
apt-get install -y -qq docker-ce >/dev/null
|
||||||
|
apt-get clean
|
||||||
|
|
||||||
echo "Adding ${GUEST_USERNAME} user to docker group"
|
echo "Adding ${GUEST_USERNAME} user to docker group"
|
||||||
usermod -aG docker ${GUEST_USERNAME}
|
usermod -aG docker ${GUEST_USERNAME}
|
||||||
|
@ -15,8 +15,14 @@ function build_guest_image() {
|
|||||||
local working_dir=$(dirname ${image_output})
|
local working_dir=$(dirname ${image_output})
|
||||||
local root_password=${TROVE_ROOT_PASSWORD}
|
local root_password=${TROVE_ROOT_PASSWORD}
|
||||||
|
|
||||||
local elementes="base vm"
|
|
||||||
local trove_elements_path=${PATH_TROVE}/integration/scripts/files/elements
|
local trove_elements_path=${PATH_TROVE}/integration/scripts/files/elements
|
||||||
|
# For system-wide installs, DIB will automatically find the elements, so we only check local path
|
||||||
|
if [[ "${DIB_LOCAL_ELEMENTS_PATH}" ]]; then
|
||||||
|
export ELEMENTS_PATH=${trove_elements_path}:${DIB_LOCAL_ELEMENTS_PATH}
|
||||||
|
else
|
||||||
|
export ELEMENTS_PATH=${trove_elements_path}
|
||||||
|
fi
|
||||||
|
|
||||||
local GUEST_IMAGESIZE=${GUEST_IMAGESIZE:-3}
|
local GUEST_IMAGESIZE=${GUEST_IMAGESIZE:-3}
|
||||||
local GUEST_CACHEDIR=${GUEST_CACHEDIR:-"$HOME/.cache/image-create"}
|
local GUEST_CACHEDIR=${GUEST_CACHEDIR:-"$HOME/.cache/image-create"}
|
||||||
sudo rm -rf ${GUEST_CACHEDIR}
|
sudo rm -rf ${GUEST_CACHEDIR}
|
||||||
@ -33,29 +39,29 @@ function build_guest_image() {
|
|||||||
manage_ssh_keys
|
manage_ssh_keys
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For system-wide installs, DIB will automatically find the elements, so we only check local path
|
|
||||||
if [[ "${DIB_LOCAL_ELEMENTS_PATH}" ]]; then
|
|
||||||
export ELEMENTS_PATH=${trove_elements_path}:${DIB_LOCAL_ELEMENTS_PATH}
|
|
||||||
else
|
|
||||||
export ELEMENTS_PATH=${trove_elements_path}
|
|
||||||
fi
|
|
||||||
|
|
||||||
export DIB_RELEASE=${guest_release}
|
|
||||||
export DIB_CLOUD_INIT_DATASOURCES="ConfigDrive"
|
|
||||||
export DIB_CLOUD_INIT_ETC_HOSTS="localhost"
|
|
||||||
|
|
||||||
# https://cloud-images.ubuntu.com/releases is more stable than the daily
|
|
||||||
# builds (https://cloud-images.ubuntu.com/xenial/current/),
|
|
||||||
# e.g. sometimes SHA256SUMS file is missing in the daily builds website.
|
|
||||||
# Ref: diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball
|
|
||||||
declare -A image_file_mapping=( ["xenial"]="ubuntu-16.04-server-cloudimg-amd64-root.tar.gz" ["bionic"]="ubuntu-18.04-server-cloudimg-amd64.squashfs" )
|
|
||||||
export DIB_CLOUD_IMAGES="https://cloud-images.ubuntu.com/releases/${DIB_RELEASE}/release/"
|
|
||||||
export BASE_IMAGE_FILE=${image_file_mapping[${DIB_RELEASE}]}
|
|
||||||
|
|
||||||
TEMP=$(mktemp -d ${working_dir}/diskimage-create.XXXXXXX)
|
TEMP=$(mktemp -d ${working_dir}/diskimage-create.XXXXXXX)
|
||||||
pushd $TEMP > /dev/null
|
pushd $TEMP > /dev/null
|
||||||
|
|
||||||
elementes="$elementes ${guest_os}"
|
# Prepare elements for diskimage-builder
|
||||||
|
export DIB_CLOUD_INIT_ETC_HOSTS="localhost"
|
||||||
|
local elementes="base vm"
|
||||||
|
|
||||||
|
# Only support ubuntu at the moment.
|
||||||
|
if [[ "${guest_os}" == "ubuntu" ]]; then
|
||||||
|
export DIB_RELEASE=${guest_release}
|
||||||
|
# https://cloud-images.ubuntu.com/releases is more stable than the daily
|
||||||
|
# builds (https://cloud-images.ubuntu.com/xenial/current/),
|
||||||
|
# e.g. sometimes SHA256SUMS file is missing in the daily builds website.
|
||||||
|
# Ref: diskimage_builder/elements/ubuntu/root.d/10-cache-ubuntu-tarball
|
||||||
|
declare -A image_file_mapping=( ["xenial"]="ubuntu-16.04-server-cloudimg-amd64-root.tar.gz" ["bionic"]="ubuntu-18.04-server-cloudimg-amd64.squashfs" )
|
||||||
|
export DIB_CLOUD_IMAGES="https://cloud-images.ubuntu.com/releases/${DIB_RELEASE}/release/"
|
||||||
|
export BASE_IMAGE_FILE=${image_file_mapping[${DIB_RELEASE}]}
|
||||||
|
elementes="$elementes ubuntu-minimal"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export DIB_CLOUD_INIT_DATASOURCES=${DIB_CLOUD_INIT_DATASOURCES:-"ConfigDrive"}
|
||||||
|
elementes="$elementes cloud-init-datasources"
|
||||||
|
|
||||||
elementes="$elementes pip-and-virtualenv"
|
elementes="$elementes pip-and-virtualenv"
|
||||||
elementes="$elementes pip-cache"
|
elementes="$elementes pip-cache"
|
||||||
elementes="$elementes guest-agent"
|
elementes="$elementes guest-agent"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user