blob: b2b02e54a1f6ee05897ac70c73e04fc243d5f4b0 [file] [log] [blame]
#!/bin/bash
# pre-requirments:
# apt-get install cloud-localds
# Cloudimg: wget https://cloud-images.ubuntu.com/xenial/XXXX/xenial-server-cloudimg-amd64-disk1.img
# Packer: https://releases.hashicorp.com/packer/1.1.3/packer_1.1.3_linux_amd64.zip
# Those script - only example for variables, which should be passed to packer and
# overwrite variables under /scripts/ directory
# External script sources:
# http/bootstrap.saltstack.com.sh https://github.com/saltstack/salt-bootstrap
#
export IMAGE_NAME="trymcp"
#
export CLUSTER_MODEL="https://gerrit.mcp.mirantis.com/trymcp/drivetrain-model"
export CLUSTER_MODEL_REF="master"
export CLUSTER_NAME="try-mcp"
export MCP_VERSION="proposed"
export SALTSTACK_REPO="http://mirror.mirantis.com/${MCP_VERSION}/saltstack-2017.7/xenial xenial main"
export SALTSTACK_GPG="https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2017.7/SALTSTACK-GPG-KEY.pub"
export APT_MIRANTIS_SALT_REPO="http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial xenial main"
export APT_MIRANTIS_SALT_GPG="http://mirror.mirantis.com/${MCP_VERSION}/salt-formulas/xenial/archive-salt-formulas.key"
export GIT_SALT_FORMULAS_SCRIPTS="https://gerrit.mcp.mirantis.com/salt-formulas/salt-formulas-scripts"
export SCRIPTS_REF="master"
export UBUNTU_BASEURL="http://mirror.mirantis.com/${MCP_VERSION}/ubuntu/"
###
# Hard-coded folder in template
export PACKER_IMAGES_CACHE="${HOME}/packer_images_cache/"
mkdir -p "${PACKER_IMAGES_CACHE}"
export PACKER_LOG=1
pushd config-drive
if [ ! -e model ]; then
git clone ${CLUSTER_MODEL} model/
pushd model
git fetch ${CLUSTER_MODEL} ${CLUSTER_MODEL_REF} && git checkout FETCH_HEAD
pushd classes/system
git submodule init
git submodule update
popd
popd
fi
if [ ! -e salt_scripts ]; then
git clone ${GIT_SALT_FORMULAS_SCRIPTS} salt_scripts/
pushd salt_scripts
git fetch ${GIT_SALT_FORMULAS_SCRIPTS} ${SCRIPTS_REF} && git checkout FETCH_HEAD
popd
fi
popd
[ -f config-drive/cloudata.iso ] && rm -v config-drive/cloudata.iso
mkisofs -o config-drive/cloudata.iso -V cidata -r -J --quiet config-drive
# For qemu test-build:
packer build -only=qemu -parallel=false -on-error=ask template.json
#rm -rf ~/.packer.d/