diff options
-rwxr-xr-x | ci/create_glance_image.sh | 37 | ||||
-rwxr-xr-x | ci/daily.sh | 104 | ||||
-rwxr-xr-x | ci/detect_installer.sh | 15 | ||||
-rwxr-xr-x | ci/generate-admin-rc.sh | 30 | ||||
-rwxr-xr-x | ci/launch_docker_container.sh | 29 |
5 files changed, 129 insertions, 86 deletions
diff --git a/ci/create_glance_image.sh b/ci/create_glance_image.sh index 8811897..e99de8c 100755 --- a/ci/create_glance_image.sh +++ b/ci/create_glance_image.sh @@ -8,13 +8,38 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -echo "Checking for Ubuntu 16.04 image in Glance" -IMAGE=`openstack image list | grep "Ubuntu 16.04 x86_64"` +ARCH="${ARCH:-$(uname -m)}" + +IMAGE_NAME="Ubuntu 16.04 ${ARCH}" + +echo "Checking for ${IMAGE_NAME} in Glance" + +IMAGE="$(openstack image list | grep "${IMAGE_NAME}")" +PROPERTIES="" if [ -z "$IMAGE" ] then - wget -q https://cloud-images.ubuntu.com/releases/16.04/release/ubuntu-16.04-server-cloudimg-amd64-disk1.img - openstack image create "Ubuntu 16.04 x86_64" --disk-format qcow2 --public \ - --container-format bare --file ubuntu-16.04-server-cloudimg-amd64-disk1.img + + case "${ARCH}" in + aarch64) + FILE=ubuntu-16.04-server-cloudimg-arm64-uefi1.img + PROPERTIES="--property hw_firmware_type=uefi --property hw_video_model=vga" + ;; + armhf) + FILE=ubuntu-16.04-server-cloudimg-armhf-disk1.img + ;; + x86_64) + FILE=ubuntu-16.04-server-cloudimg-amd64-disk1.img + ;; + *) + echo "Unsupported architecture: ${ARCH}" + exit 1 + ;; + esac + + wget --continue -q "https://cloud-images.ubuntu.com/releases/16.04/release/${FILE}" + openstack image create "${IMAGE_NAME}" --disk-format qcow2 --public \ + ${PROPERTIES} \ + --container-format bare --file "${FILE}" fi -openstack image show "Ubuntu 16.04 x86_64" +openstack image show "${IMAGE_NAME}" diff --git a/ci/daily.sh b/ci/daily.sh index 6548cb0..0170b41 100755 --- a/ci/daily.sh +++ b/ci/daily.sh @@ -8,10 +8,10 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -if [ -z $WORKSPACE ] +if [ -z "$WORKSPACE" ] then - cd `dirname $0`/.. - WORKSPACE=`pwd` + cd "$(dirname "$0")/.." || exit 1 + WORKSPACE="$(pwd)" fi docker-compose --version @@ -21,10 +21,12 @@ then exit 1 fi -git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng $WORKSPACE/ci/job/releng +rm -rf "${WORKSPACE}/ci/job/releng" +git clone --depth 1 https://gerrit.opnfv.org/gerrit/releng "${WORKSPACE}/ci/job/releng" -virtualenv $WORKSPACE/ci/job/storperf_daily_venv -source $WORKSPACE/ci/job/storperf_daily_venv/bin/activate +virtualenv "${WORKSPACE}/ci/job/storperf_daily_venv" +# shellcheck source=/dev/null +source "${WORKSPACE}/ci/job/storperf_daily_venv/bin/activate" pip install --upgrade setuptools==33.1.1 pip install functools32==3.2.3.post2 @@ -33,85 +35,97 @@ pip install osc_lib==1.3.0 pip install python-openstackclient==3.7.0 pip install python-heatclient==1.7.0 -$WORKSPACE/ci/generate-admin-rc.sh -echo "TEST_DB_URL=http://testresults.opnfv.org/test/api/v1" >> $WORKSPACE/ci/job/admin.rc -$WORKSPACE/ci/generate-environment.sh +"${WORKSPACE}/ci/generate-admin-rc.sh" +echo "TEST_DB_URL=http://testresults.opnfv.org/test/api/v1" >> "${WORKSPACE}/ci/job/admin.rc" +"${WORKSPACE}/ci/generate-environment.sh" -. $WORKSPACE/ci/job/environment.rc +# shellcheck source=/dev/null +source "${WORKSPACE}/ci/job/environment.rc" while read -r env do export "$env" -done < $WORKSPACE/ci/job/admin.rc +done < "${WORKSPACE}/ci/job/admin.rc" export AGENT_COUNT=${AGENT_COUNT:-$CINDER_NODES} export BLOCK_SIZES=${BLOCK_SIZES:-16384} export STEADY_STATE_SAMPLES=${STEADY_STATE_SAMPLES:-10} -export DEADLINE=${DEADLINE:-`expr $STEADY_STATE_SAMPLES \* 3`} +export DEADLINE=${DEADLINE:-$((STEADY_STATE_SAMPLES * 3))} export DISK_TYPE=${DISK_TYPE:-unspecified} export QUEUE_DEPTHS=${QUEUE_DEPTHS:-4} -export POD_NAME=${NODE_NAME:-`hostname`} +export POD_NAME=${NODE_NAME:-$(hostname)} export SCENARIO_NAME=${DEPLOY_SCENARIO:-none} export TEST_CASE=${TEST_CASE:-snia_steady_state} -export VERSION=`echo ${BUILD_TAG#*daily-} | cut -d- -f1` +export VERSION=$(echo ${BUILD_TAG#*daily-} | cut -d- -f1) export VOLUME_SIZE=${VOLUME_SIZE:-2} export WORKLOADS=${WORKLOADS:-ws,rs,rw} +ARCH="${ARCH:-$(uname -m)}" +IMAGE_NAME="Ubuntu 16.04 ${ARCH}" + echo ========================================================================== echo Environment env | sort echo ========================================================================== -$WORKSPACE/ci/remove_docker_container.sh -$WORKSPACE/ci/delete_stack.sh -$WORKSPACE/ci/create_glance_image.sh -$WORKSPACE/ci/create_storperf_flavor.sh -$WORKSPACE/ci/launch_docker_container.sh -$WORKSPACE/ci/create_stack.sh $AGENT_COUNT $VOLUME_SIZE "Ubuntu 16.04 x86_64" $NETWORK +"$WORKSPACE/ci/remove_docker_container.sh" +"$WORKSPACE/ci/delete_stack.sh" +"$WORKSPACE/ci/create_glance_image.sh" +"$WORKSPACE/ci/create_storperf_flavor.sh" +"$WORKSPACE/ci/launch_docker_container.sh" +"$WORKSPACE/ci/create_stack.sh" "${AGENT_COUNT}" "${VOLUME_SIZE}" "${IMAGE_NAME}" "${NETWORK}" -export WORKLOAD=_warm_up,$WORKLOADS -export BLOCK_SIZE=$BLOCK_SIZES -export QUEUE_DEPTH=$QUEUE_DEPTHS +export WORKLOAD="_warm_up,${WORKLOADS}" +export BLOCK_SIZE="${BLOCK_SIZES}" +export QUEUE_DEPTH="${QUEUE_DEPTHS}" -echo ========================================================================== -echo Starting run of $WORKLOAD $BLOCK_SIZE $QUEUE_DEPTH -echo ========================================================================== +echo "==========================================================================" +echo "Starting run of ${WORKLOAD} ${BLOCK_SIZE} ${QUEUE_DEPTH}" +echo "==========================================================================" -JOB=`$WORKSPACE/ci/start_job.sh \ - | awk '/job_id/ {print $2}' | sed 's/"//g'` -curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \ - -o $WORKSPACE/ci/job/status.json +JOB=$("${WORKSPACE}/ci/start_job.sh" \ + | awk '/job_id/ {print $2}' | sed 's/"//g') +curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=${JOB}&type=status" \ + -o "${WORKSPACE}/ci/job/status.json" -JOB_STATUS=`cat $WORKSPACE/ci/job/status.json | awk '/Status/ {print $2}' | cut -d\" -f2` -while [ "$JOB_STATUS" != "Completed" ] +JOB_STATUS=$(awk '/Status/ {print $2}' "${WORKSPACE}/ci/job/status.json" | cut -d\" -f2) +while [ "${JOB_STATUS}" != "Completed" ] do sleep 600 - mv $WORKSPACE/ci/job/status.json $WORKSPACE/ci/job/old-status.json - curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=status" \ - -o $WORKSPACE/ci/job/status.json - JOB_STATUS=`cat $WORKSPACE/ci/job/status.json | awk '/Status/ {print $2}' | cut -d\" -f2` - if diff $WORKSPACE/ci/job/status.json $WORKSPACE/ci/job/old-status.json >/dev/null + mv "${WORKSPACE}/ci/job/status.json" "${WORKSPACE}/ci/job/old-status.json" + curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=${JOB}&type=status" \ + -o "${WORKSPACE}/ci/job/status.json" + JOB_STATUS=$(awk '/Status/ {print $2}' "${WORKSPACE}/ci/job/status.json" | cut -d\" -f2) + if diff "${WORKSPACE}/ci/job/status.json" "${WORKSPACE}/ci/job/old-status.json" >/dev/null then - cat $WORKSPACE/ci/job/status.json + cat "${WORKSPACE}/ci/job/status.json" fi done set +e + +echo ========================================================================== +echo StorPerf Master logs +echo ========================================================================== +docker logs storperf-master +echo ========================================================================== + echo "Deleting stack for cleanup" -curl -s -X DELETE --header 'Accept: application/json' 'http://127.0.0.1:5000/api/v1.0/configurations' +curl -s -X DELETE --header 'Accept: application/json' \ + 'http://127.0.0.1:5000/api/v1.0/configurations' -curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=$JOB&type=metadata" \ - -o $WORKSPACE/ci/job/report.json +curl -s -X GET "http://127.0.0.1:5000/api/v1.0/jobs?id=${JOB}&type=metadata" \ + -o "${WORKSPACE}/ci/job/report.json" -$WORKSPACE/ci/remove_docker_container.sh +"${WORKSPACE}/ci/remove_docker_container.sh" -sudo rm -rf $WORKSPACE/ci/job/carbon -sudo find $WORKSPACE/docker --name '*.db' -exec rm -fv {} \; +sudo rm -rf "${WORKSPACE}/ci/job/carbon" +sudo find "${WORKSPACE}/docker" -name '*.db' -exec rm -fv {} \; echo ========================================================================== echo Final report echo ========================================================================== -cat $WORKSPACE/ci/job/report.json +cat "${WORKSPACE}/ci/job/report.json" exit 0 diff --git a/ci/detect_installer.sh b/ci/detect_installer.sh index 035b7e2..afa1f74 100755 --- a/ci/detect_installer.sh +++ b/ci/detect_installer.sh @@ -8,15 +8,16 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -which juju 2>/dev/null -if [ $? -eq 0 ] -then +if which juju >/dev/null 2>&1 ; then INSTALLER=joid fi -sudo virsh list --all | grep undercloud >/dev/null -if [ $? -eq 0 ] -then + +if sudo virsh list --all | grep -q undercloud ; then INSTALLER=apex fi -echo $INSTALLER
\ No newline at end of file +if sudo virsh list --all | grep -q cfg01 ; then + INSTALLER=fuel +fi + +echo $INSTALLER diff --git a/ci/generate-admin-rc.sh b/ci/generate-admin-rc.sh index 3c0b33a..e1e6bc9 100755 --- a/ci/generate-admin-rc.sh +++ b/ci/generate-admin-rc.sh @@ -8,21 +8,20 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -cd `dirname $0` - -# TODO: Switch based on installer type, for now this is hard coded to JOID only +cd $(dirname "$0") if [ ! -d job ] then mkdir job fi -export INSTALLER=`./detect_installer.sh` +SSH_KEY="" +INSTALLER="$(./detect_installer.sh)" case $INSTALLER in joid) - export OS_AUTH_URL=http://`juju status keystone | grep public | awk '{print $2}'`:5000/v2.0 - export OS_USERNAME=admin - export OS_PASSWORD=openstack + OS_AUTH_URL=http://`juju status keystone | grep public | awk '{print $2}'`:5000/v2.0 + OS_USERNAME=admin + OS_PASSWORD=openstack cat << EOF > job/openstack.rc export OS_AUTH_URL=$OS_AUTH_URL export OS_USERNAME=$OS_USERNAME @@ -31,14 +30,25 @@ export OS_TENANT_NAME=admin export OS_PROJECT_NAME=admin EOF ;; + fuel) + INSTALLER_IP=$(sudo virsh domifaddr cfg01 | grep ipv4 | awk '{print $4}' | cut -d/ -f1) + export BRANCH="${BRANCH:-master}" + SSH_KEY="-s /var/lib/opnfv/mcp.rsa" + ;; apex) - INSTALLER_IP=`sudo virsh domifaddr undercloud | grep ipv4 | awk '{print $4}' | cut -d/ -f1` + INSTALLER_IP=$(sudo virsh domifaddr undercloud | grep ipv4 | awk '{print $4}' | cut -d/ -f1) ;; + *) + echo "Unknown installer ${INSTALLER}" + exit 1 esac -if [ ! -z $INSTALLER_IP ] +if [ ! -z "${INSTALLER_IP}" ] then - ./job/releng/utils/fetch_os_creds.sh -i $INSTALLER -a $INSTALLER_IP -d job/openstack.rc + CMD="./job/releng/utils/fetch_os_creds.sh -i $INSTALLER -a $INSTALLER_IP $SSH_KEY -d job/openstack.rc" + echo $CMD + $CMD + echo export OS_PROJECT_NAME=admin >> job/openstack.rc fi diff --git a/ci/launch_docker_container.sh b/ci/launch_docker_container.sh index 2411ce0..ff28e05 100755 --- a/ci/launch_docker_container.sh +++ b/ci/launch_docker_container.sh @@ -8,32 +8,25 @@ # http://www.apache.org/licenses/LICENSE-2.0 ############################################################################## -cd `dirname $0` -ci=`pwd` +cd "$(dirname "$0")" || exit 1 +ci=$(pwd) -cd ${ci}/../docker-compose +cd "${ci}/../docker-compose" || exit 1 -export ENV_FILE=${ci}/job/admin.rc -export CARBON_DIR=${ci}/job/carbon/ +export ENV_FILE="${ci}/job/admin.rc" +export CARBON_DIR="${ci}/job/carbon/" -if [ ! -d ${ci}/job/carbon ] +if [ ! -d "${ci}/job/carbon" ] then - mkdir ${ci}/job/carbon -fi - -if [ -z ${ARCH} ] -then - ARCH=x86_64 + mkdir -p "${ci}/job/carbon" fi +ARCH="${ARCH:-$(uname -m)}" export ARCH -if [ -z ${DOCKER_TAG} ] -then - DOCKER_TAG=latest -fi +DOCKER_TAG="${DOCKER_TAG:-latest}" -export TAG=${DOCKER_TAG} +export TAG="${ARCH}-${DOCKER_TAG}" docker-compose pull docker-compose up -d @@ -42,7 +35,7 @@ echo "Waiting for StorPerf to become active" ATTEMPTS=20 -while [ $(curl -s -o /dev/null -I -w "%{http_code}" -X GET http://127.0.0.1:5000/api/v1.0/configurations) != "200" ] +while [ "$(curl -s -o /dev/null -I -w '%{http_code}' -X GET http://127.0.0.1:5000/api/v1.0/configurations)" != "200" ] do ATTEMPTS=$((ATTEMPTS - 1)) if [ ${ATTEMPTS} -le 1 ] |