summaryrefslogtreecommitdiffstats
path: root/ci/make_repo.sh
diff options
context:
space:
mode:
authorChigang(Justin) <chigang@huawei.com>2015-08-13 03:14:03 -0400
committerChigang(Justin) <chigang@huawei.com>2015-08-18 03:56:06 -0400
commit3656b2525c9b4e8c5e1f45625adb1cd143425dc0 (patch)
tree0836bcdf3d093d3d4f6cd40e4deedcbf93ebc976 /ci/make_repo.sh
parent7951b094df92c40417ec66c4be58871911bbed07 (diff)
Generate ppa repositories automatically
Openstack ppa repo will be generated by the patch.now we support openstack(juno) on trusty/centos7.1. there are two steps about how to generate the repo: 1. analyze the deployment script to find the deploying packages 2. use Docker as container to collect packages JIRA: COMPASS-15 Change-Id: I74ac57b70455643ecf9d32effd44a2e46f404f4e Signed-off-by: Chigang(Justin) <chigang@huawei.com>
Diffstat (limited to 'ci/make_repo.sh')
-rwxr-xr-xci/make_repo.sh79
1 files changed, 79 insertions, 0 deletions
diff --git a/ci/make_repo.sh b/ci/make_repo.sh
new file mode 100755
index 00000000..0f922a18
--- /dev/null
+++ b/ci/make_repo.sh
@@ -0,0 +1,79 @@
+#!/bin/bash
+set -ex
+
+WORK_PATH=$(cd "$(dirname "$0")"; pwd)
+REPO_PATH=${WORK_PATH}/repo
+UBUNTU_TAG="trusty"
+CENTOS_TAG="centos7"
+OPENSTACK_TAG="juno"
+DOCKER_TAG="${UBUNTU_TAG}/openstack-${OPENSTACK_TAG}"
+DOCKER_FILE=${WORK_PATH}/${UBUNTU_TAG}/${OPENSTACK_TAG}/Dockerfile
+DEPLOY_SCRIPT_PATH="$1"
+
+if [[ ! -d ${REPO_PATH} ]]; then
+ mkdir -p ${REPO_PATH}
+fi
+
+set +e
+sudo docker info
+if [[ $? != 0 ]]; then
+ wget -qO- https://get.docker.com/ | sh
+else
+ echo "docker is already installed!"
+fi
+set -e
+
+if [[ -e ${WORK_PATH}/cp_repo.sh ]]; then
+ rm -f ${WORK_PATH}/cp_repo.sh
+fi
+
+cat <<EOF >${WORK_PATH}/cp_repo.sh
+#!/bin/bash
+set -ex
+cp /*ppa.tar.gz /result
+EOF
+
+if [[ -e ${WORK_PATH}/install_packeages.sh ]]; then
+ rm -f ${WORK_PATH}/install_packages.sh
+fi
+
+# generate ubuntu 14.04 ppa
+sudo apt-get install python-yaml -y
+sudo apt-get install python-cheetah -y
+
+python gen_ins_pkg_script.py ${DEPLOY_SCRIPT_PATH} Debian Debian_juno.tmpl
+
+sudo docker build -t ${DOCKER_TAG} -f ${DOCKER_FILE} .
+
+mkdir -p ${REPO_PATH}
+sudo docker run -t -v ${REPO_PATH}:/result ${DOCKER_TAG}
+
+IMAGE_ID=$(sudo docker images|grep ${DOCKER_TAG}|awk '{print $3}')
+sudo docker rmi -f ${IMAGE_ID}
+
+if [[ -e ${WORK_PATH}/install_packages.sh ]]; then
+ rm -f ${WORK_PATH}/install_packages.sh
+fi
+
+# generate centos 7.1 ppa
+python gen_ins_pkg_script.py ${DEPLOY_SCRIPT_PATH} RedHat RedHat_juno.tmpl
+
+DOCKER_TAG="${CENTOS_TAG}/openstack-${OPENSTACK_TAG}"
+DOCKER_FILE=${WORK_PATH}/${CENTOS_TAG}/${OPENSTACK_TAG}/Dockerfile
+
+sudo docker build -t ${DOCKER_TAG} -f ${DOCKER_FILE} .
+
+mkdir -p ${REPO_PATH}
+sudo docker run -t -v ${REPO_PATH}:/result ${DOCKER_TAG}
+
+IMAGE_ID=$(sudo docker images|grep ${DOCKER_TAG}|awk '{print $3}')
+sudo docker rmi -f ${IMAGE_ID}
+
+if [[ -e ${WORK_PATH}/install_packages.sh ]]; then
+ rm -f ${WORK_PATH}/install_packages.sh
+fi
+
+if [[ -e ${WORK_PATH}/cp_repo.sh ]]; then
+ rm -f ${WORK_PATH}/cp_repo.sh
+fi
+