Murano CI Rework: Cleanup old scripts and jobs
Change-Id: I35baf1e16be508c4e33b35095aa4ac1ed02840f5
This commit is contained in:
committed by
Victor Ryzhenkin
parent
ccb8890429
commit
95bf221ef5
@@ -1,19 +0,0 @@
|
||||
- job:
|
||||
name: Build_documentation
|
||||
description: 'Murano documents builder'
|
||||
project-type: freestyle
|
||||
block-downstream: false
|
||||
scm:
|
||||
- git:
|
||||
url: https://github.com/openstack/murano-docs.git
|
||||
triggers:
|
||||
- pollscm: "H/5 * * * *"
|
||||
builders:
|
||||
- shell: |
|
||||
cd ~
|
||||
sudo rm -rf murano-deployment
|
||||
git clone https://github.com/openstack/murano-deployment
|
||||
sh -xe murano-deployment/docs-builder/builder.sh
|
||||
publishers:
|
||||
- email:
|
||||
recipients: "smelikyan@mirantis.com, rkamaldinov@mirantis.com, efedorova@mirantis.com, tnurlygayanov@mirantis.com"
|
||||
@@ -1,58 +0,0 @@
|
||||
- job:
|
||||
name: gate-murano-agent-integration-fedora
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: |
|
||||
On commit job for murano agent
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: precise-devstack-cz
|
||||
|
||||
parameters:
|
||||
- bool:
|
||||
name: KEEP_VM_ALIVE
|
||||
- string:
|
||||
name: ZUUL_REF_OPT
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
|
||||
# DO NOT ENABLE xtrace OPTION HERE, OR YOU COMPROMISE YOUR PRIVATE KEY
|
||||
cat << EOF > ~/.ssh/id_rsa
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
-----END RSA PRIVATE KEY-----
|
||||
EOF
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
|
||||
|
||||
cat << EOF > ~/.ssh/config
|
||||
Host *
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
User stack
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
EOF
|
||||
|
||||
export ZUUL_REF=${ZUUL_REF:-$ZUUL_REF_OPT}
|
||||
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
|
||||
export DISTR_NAME='fedora'
|
||||
|
||||
bash ./murano-ci/scripts/murano-integration-tests-devstack.sh
|
||||
|
||||
publishers:
|
||||
- scp:
|
||||
site: 'localhost'
|
||||
files:
|
||||
- target: 'logs/$LOG_PATH/artifacts'
|
||||
source: 'artifacts/**'
|
||||
copy-console: true
|
||||
copy-after-failure: true
|
||||
- archive:
|
||||
artifacts: 'artifacts/**'
|
||||
allow-empty: 'true'
|
||||
@@ -1,58 +0,0 @@
|
||||
- job:
|
||||
name: gate-murano-agent-integration-ubuntu
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: |
|
||||
On commit job for murano agent
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: precise-devstack-cz
|
||||
|
||||
parameters:
|
||||
- bool:
|
||||
name: KEEP_VM_ALIVE
|
||||
- string:
|
||||
name: ZUUL_REF_OPT
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
|
||||
# DO NOT ENABLE xtrace OPTION HERE, OR YOU COMPROMISE YOUR PRIVATE KEY
|
||||
cat << EOF > ~/.ssh/id_rsa
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
-----END RSA PRIVATE KEY-----
|
||||
EOF
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
|
||||
|
||||
cat << EOF > ~/.ssh/config
|
||||
Host *
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
User stack
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
EOF
|
||||
|
||||
export ZUUL_REF=${ZUUL_REF:-$ZUUL_REF_OPT}
|
||||
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
|
||||
export DISTR_NAME='ubuntu'
|
||||
|
||||
bash ./murano-ci/scripts/murano-integration-tests-devstack.sh
|
||||
|
||||
publishers:
|
||||
- scp:
|
||||
site: 'localhost'
|
||||
files:
|
||||
- target: 'logs/$LOG_PATH/artifacts'
|
||||
source: 'artifacts/**'
|
||||
copy-console: true
|
||||
copy-after-failure: true
|
||||
- archive:
|
||||
artifacts: 'artifacts/**'
|
||||
allow-empty: 'true'
|
||||
@@ -1,20 +0,0 @@
|
||||
- job:
|
||||
name: jobs-updater
|
||||
node: master
|
||||
project-type: freestyle
|
||||
description: "<b>This job is managed by Jenkins Job Builder, do not edit it through WebUI."
|
||||
defaults: global
|
||||
disabled: false
|
||||
concurrent: false
|
||||
|
||||
scm:
|
||||
- git:
|
||||
url: https://git.openstack.org/openstack/murano-deployment
|
||||
branches:
|
||||
- "master"
|
||||
|
||||
triggers:
|
||||
- pollscm: "* * * * * "
|
||||
|
||||
builders:
|
||||
- shell: "sudo jenkins-jobs update murano-ci/jobs"
|
||||
@@ -1,61 +0,0 @@
|
||||
- job:
|
||||
name: murano-dashboard-heartbeat-cz
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: |
|
||||
Heartbeat job to ensure that code from master branch works.
|
||||
Job runs every 3 hrs.
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: precise-devstack-cz
|
||||
|
||||
parameters:
|
||||
- bool:
|
||||
name: KEEP_VM_ALIVE
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
triggers:
|
||||
- timed: "H */3 * * *"
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
|
||||
# DO NOT ENABLE xtrace OPTION HERE
|
||||
# OR YOU COMPROMISE YOUR PRIVATE KEY
|
||||
# Put valid private key below
|
||||
cat << EOF > ~/.ssh/id_rsa
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
-----END RSA PRIVATE KEY-----
|
||||
EOF
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
|
||||
|
||||
cat << EOF > ~/.ssh/config
|
||||
Host *
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
User stack
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
EOF
|
||||
|
||||
export ZUUL_PROJECT='openstack/murano-dashboard'
|
||||
export ZUUL_URL='https://git.openstack.org'
|
||||
export ZUUL_REF='master'
|
||||
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
bash ./murano-ci/scripts/murano-integration-tests-devstack.sh
|
||||
|
||||
publishers:
|
||||
- scp:
|
||||
site: 'localhost'
|
||||
files:
|
||||
- target: 'logs/$LOG_PATH/artifacts'
|
||||
source: 'artifacts/**'
|
||||
copy-console: true
|
||||
copy-after-failure: true
|
||||
- archive:
|
||||
artifacts: 'artifacts/**'
|
||||
allow-empty: 'true'
|
||||
@@ -1,34 +0,0 @@
|
||||
- job:
|
||||
name: murano-dashboard-integration-tests-centos
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: "<b>This job is managed by Jenkins Job Builder, do not edit it through WebUI.</b>"
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: centos
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
wrappers:
|
||||
- timeout:
|
||||
timeout: 30
|
||||
fail: true
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
sudo ntpdate -u pool.ntp.org
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
bash -x murano-ci/scripts/murano-dashboard-integration-tests.sh
|
||||
|
||||
publishers:
|
||||
- console-log-with-artifacts
|
||||
- archive:
|
||||
artifacts: 'artifacts/*'
|
||||
allow-empty: 'true'
|
||||
logrotate:
|
||||
daysToKeep: 30
|
||||
numToKeep: -1
|
||||
artifactDaysToKeep: 30
|
||||
artifactNumToKeep: -1
|
||||
@@ -1,29 +0,0 @@
|
||||
- job:
|
||||
name: murano-dashboard-integration-tests-ubuntu
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: "<b>This job is managed by Jenkins Job Builder, do not edit it through WebUI.</b>"
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: precise
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
sudo ntpdate -u pool.ntp.org
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
bash -x murano-ci/scripts/murano-dashboard-integration-tests.sh
|
||||
|
||||
publishers:
|
||||
- console-log-with-artifacts
|
||||
- archive:
|
||||
artifacts: 'artifacts/*'
|
||||
allow-empty: 'true'
|
||||
logrotate:
|
||||
daysToKeep: 30
|
||||
numToKeep: -1
|
||||
artifactDaysToKeep: 30
|
||||
artifactNumToKeep: -1
|
||||
@@ -1,57 +0,0 @@
|
||||
- job:
|
||||
name: murano-dashboard-on-commit-cz
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: |
|
||||
On commit job for murano dashboard
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: precise-devstack-cz
|
||||
|
||||
parameters:
|
||||
- bool:
|
||||
name: KEEP_VM_ALIVE
|
||||
- string:
|
||||
name: ZUUL_REF_OPT
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
|
||||
# DO NOT ENABLE xtrace OPTION HERE, OR YOU COMPROMISE YOUR PRIVATE KEY
|
||||
cat << EOF > ~/.ssh/id_rsa
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
-----END RSA PRIVATE KEY-----
|
||||
EOF
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
|
||||
|
||||
cat << EOF > ~/.ssh/config
|
||||
Host *
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
User stack
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
EOF
|
||||
|
||||
export ZUUL_REF=${ZUUL_REF:-$ZUUL_REF_OPT}
|
||||
export ZUUL_PROJECT=${ZUUL_PROJECT:-'openstack/murano-dashboard'}
|
||||
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
|
||||
bash ./murano-ci/scripts/murano-integration-tests-devstack.sh
|
||||
|
||||
publishers:
|
||||
- scp:
|
||||
site: 'localhost'
|
||||
files:
|
||||
- target: 'logs/$LOG_PATH/artifacts'
|
||||
source: 'artifacts/**'
|
||||
copy-console: true
|
||||
copy-after-failure: true
|
||||
- archive:
|
||||
artifacts: 'artifacts/**'
|
||||
allow-empty: 'true'
|
||||
@@ -1,37 +0,0 @@
|
||||
- job:
|
||||
name: murano-engine-app-deployment-tests-centos
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: "<b>This job is managed by Jenkins Job Builder, do not edit it through WebUI.</b>"
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: centos
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
wrappers:
|
||||
- timeout:
|
||||
timeout: 30
|
||||
fail: true
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
sudo ntpdate -u pool.ntp.org
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
bash -x murano-ci/scripts/murano-engine-with-deployment-tests.sh
|
||||
|
||||
publishers:
|
||||
- console-log-with-artifacts
|
||||
- archive:
|
||||
artifacts: 'artifacts/*'
|
||||
allow-empty: 'true'
|
||||
- junit:
|
||||
results: 'test_report$BUILD_NUMBER.xml'
|
||||
keep-long-stdio: false
|
||||
logrotate:
|
||||
daysToKeep: 30
|
||||
numToKeep: -1
|
||||
artifactDaysToKeep: 30
|
||||
artifactNumToKeep: -1
|
||||
@@ -1,32 +0,0 @@
|
||||
- job:
|
||||
name: murano-engine-app-deployment-tests-ubuntu
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: "<b>This job is managed by Jenkins Job Builder, do not edit it through WebUI.</b>"
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: precise
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
sudo ntpdate -u pool.ntp.org
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
bash -x murano-ci/scripts/murano-engine-with-deployment-tests.sh
|
||||
|
||||
publishers:
|
||||
- console-log-with-artifacts
|
||||
- archive:
|
||||
artifacts: 'artifacts/*'
|
||||
allow-empty: 'true'
|
||||
- junit:
|
||||
results: 'test_report$BUILD_NUMBER.xml'
|
||||
keep-long-stdio: false
|
||||
logrotate:
|
||||
daysToKeep: 30
|
||||
numToKeep: -1
|
||||
artifactDaysToKeep: 30
|
||||
artifactNumToKeep: -1
|
||||
@@ -1,61 +0,0 @@
|
||||
- job:
|
||||
name: murano-engine-heartbeat-cz
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: |
|
||||
Heartbeat job to ensure that code from master branch works.
|
||||
Job runs every 3 hrs.
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: precise-devstack-cz
|
||||
|
||||
parameters:
|
||||
- bool:
|
||||
name: KEEP_VM_ALIVE
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
triggers:
|
||||
- timed: "H */3 * * *"
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
|
||||
# DO NOT ENABLE xtrace OPTION HERE
|
||||
# OR YOU COMPROMISE YOUR PRIVATE KEY
|
||||
# Put valid private key below
|
||||
cat << EOF > ~/.ssh/id_rsa
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
-----END RSA PRIVATE KEY-----
|
||||
EOF
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
|
||||
|
||||
cat << EOF > ~/.ssh/config
|
||||
Host *
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
User stack
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
EOF
|
||||
|
||||
export ZUUL_PROJECT='openstack/murano'
|
||||
export ZUUL_URL='https://git.openstack.org'
|
||||
export ZUUL_REF='master'
|
||||
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
bash ./murano-ci/scripts/murano-integration-tests-devstack.sh
|
||||
|
||||
publishers:
|
||||
- scp:
|
||||
site: 'localhost'
|
||||
files:
|
||||
- target: 'logs/$LOG_PATH/artifacts'
|
||||
source: 'artifacts/**'
|
||||
copy-console: true
|
||||
copy-after-failure: true
|
||||
- archive:
|
||||
artifacts: 'artifacts/**'
|
||||
allow-empty: 'true'
|
||||
@@ -1,56 +0,0 @@
|
||||
- job:
|
||||
name: murano-engine-on-commit-cz
|
||||
project-type: freestyle
|
||||
defaults: global
|
||||
description: |
|
||||
On commit job for murano engine
|
||||
disabled: false
|
||||
concurrent: true
|
||||
node: precise-devstack-cz
|
||||
|
||||
parameters:
|
||||
- bool:
|
||||
name: KEEP_VM_ALIVE
|
||||
- string:
|
||||
name: ZUUL_REF_OPT
|
||||
|
||||
properties:
|
||||
- zeromq-event
|
||||
|
||||
builders:
|
||||
- shell: |
|
||||
#!/bin/bash
|
||||
|
||||
# DO NOT ENABLE xtrace OPTION HERE, OR YOU COMPROMISE YOUR PRIVATE KEY
|
||||
cat << EOF > ~/.ssh/id_rsa
|
||||
-----BEGIN RSA PRIVATE KEY-----
|
||||
-----END RSA PRIVATE KEY-----
|
||||
EOF
|
||||
chmod 600 ~/.ssh/id_rsa
|
||||
ssh-keygen -y -f ~/.ssh/id_rsa > ~/.ssh/id_rsa.pub
|
||||
|
||||
cat << EOF > ~/.ssh/config
|
||||
Host *
|
||||
IdentityFile ~/.ssh/id_rsa
|
||||
User stack
|
||||
StrictHostKeyChecking no
|
||||
UserKnownHostsFile=/dev/null
|
||||
EOF
|
||||
|
||||
export ZUUL_REF=${ZUUL_REF:-$ZUUL_REF_OPT}
|
||||
|
||||
git clone https://git.openstack.org/openstack/murano-deployment .
|
||||
|
||||
bash ./murano-ci/scripts/murano-integration-tests-devstack.sh
|
||||
|
||||
publishers:
|
||||
- scp:
|
||||
site: 'localhost'
|
||||
files:
|
||||
- target: 'logs/$LOG_PATH/artifacts'
|
||||
source: 'artifacts/**'
|
||||
copy-console: true
|
||||
copy-after-failure: true
|
||||
- archive:
|
||||
artifacts: 'artifacts/**'
|
||||
allow-empty: 'true'
|
||||
@@ -1,68 +0,0 @@
|
||||
#!/bin/sh -x
|
||||
# Copyright (c) 2013 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
#create temp directory where we going to work
|
||||
TEMP=$PWD/temp-$(date +%s)
|
||||
mkdir "${TEMP}"
|
||||
|
||||
#clone and clean github pages
|
||||
cd "${TEMP}"
|
||||
git clone git@github.com:murano-docs/murano-docs.github.io.git murano-docs
|
||||
cd murano-docs
|
||||
ls -A1 | grep -v -e '\.git' -e '\.nojekyll' | xargs git rm -rf
|
||||
|
||||
for version in "0.1" "release-0.2" "0.2" "0.2.11" "release-0.3" "0.3" "release-0.4" "0.4" "0.4.1" "latest"
|
||||
do
|
||||
cd "${TEMP}"
|
||||
|
||||
guides="developers-guide administrators-guide user-guide getting-started"
|
||||
if [ ${version} = "0.2" ]; then
|
||||
guides="developers-guide administrators-guide user-guide"
|
||||
elif [ ${version} = "0.1" ]; then
|
||||
guides="murano-manual murano-deployment-guide"
|
||||
fi
|
||||
|
||||
git clone git@github.com:openstack/murano-docs.git docs-${version}
|
||||
|
||||
cd docs-${version}
|
||||
|
||||
if [ ${version} != "latest" ]; then
|
||||
git checkout ${version}
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
for guide in ${guides}
|
||||
do
|
||||
cd "${TEMP}/docs-${version}/src/${guide}"
|
||||
mvn clean generate-sources
|
||||
|
||||
built_manual=${TEMP}/murano-docs/${version}/${guide}
|
||||
mkdir -p "${built_manual}"
|
||||
cp -r "target/docbkx/webhelp/${guide}"/* "${built_manual}"
|
||||
cp "target/docbkx/pdf/${guide}.pdf" "${built_manual}"
|
||||
done
|
||||
done
|
||||
|
||||
#commit generated data
|
||||
cd "${TEMP}/murano-docs"
|
||||
git config user.email "murano-eng@mirantis.com"
|
||||
git config user.name "murano-docs"
|
||||
git add .
|
||||
git commit -am "generated `date`."
|
||||
git push origin master
|
||||
|
||||
#clean-up
|
||||
rm -rf "${TEMP}"
|
||||
@@ -1,253 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2014 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
CI_ROOT_DIR=$(cd $(dirname "$0") && cd .. && pwd)
|
||||
#Include of the common functions library file:
|
||||
INC_FILE="${CI_ROOT_DIR}/scripts/common.inc"
|
||||
if [ -f "$INC_FILE" ]; then
|
||||
source "$INC_FILE"
|
||||
else
|
||||
echo "\"$INC_FILE\" - file not found, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
#Basic parameters:
|
||||
PYTHON_CMD=$(which python)
|
||||
NOSETESTS_CMD=$(which nosetests)
|
||||
GIT_CMD=$(which git)
|
||||
NTPDATE_CMD=$(which ntpdate)
|
||||
PIP_CMD=$(which pip)
|
||||
SCREEN_CMD=$(which screen)
|
||||
FW_CMD=$(which iptables)
|
||||
DISPLAY_NUM=22
|
||||
STORE_AS_ARTIFACTS="${WORKSPACE}/murano-dashboard/muranodashboard/tests/functional/screenshots /tmp/murano*.log /var/log/murano-dashboard/ /var/log/murano/"
|
||||
get_os || exit $?
|
||||
|
||||
### Error trapping
|
||||
set -o errexit
|
||||
|
||||
function trap_handler()
|
||||
{
|
||||
echo "Got error in '$1' on line '$2', error code '$3'"
|
||||
}
|
||||
trap 'trap_handler ${0} ${LINENO} ${?}' ERR
|
||||
|
||||
### Install RabbitMQ on the local host to avoid many problems
|
||||
if [ $distro_based_on == "redhat" ]; then
|
||||
sudo yum update -y || exit $?
|
||||
sudo yum install -y rabbitmq-server || exit $?
|
||||
sudo /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management || exit $?
|
||||
sudo /etc/init.d/rabbitmq-server restart || exit $?
|
||||
STORE_AS_ARTIFACTS+=" /var/log/httpd/error_log"
|
||||
else
|
||||
sudo apt-get update || exit $?
|
||||
sudo apt-get install -y rabbitmq-server || exit $?
|
||||
sudo /usr/lib/rabbitmq/bin/rabbitmq-plugins enable rabbitmq_management || exit $?
|
||||
sudo service rabbitmq-server restart
|
||||
STORE_AS_ARTIFACTS+=" /var/log/apache2/error.log"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
#This file is generated by Nodepool while building snapshots
|
||||
#It contains credentials to access RabbitMQ and an OpenStack lab
|
||||
source ~/credentials
|
||||
|
||||
|
||||
#Functions:
|
||||
function handle_rabbitmq()
|
||||
{
|
||||
local retval=0
|
||||
local action=$1
|
||||
case $action in
|
||||
add)
|
||||
$PYTHON_CMD ${CI_ROOT_DIR}/infra/RabbitMQ.py -username murano$BUILD_NUMBER -vhostname murano$BUILD_NUMBER -rabbitmq_host localhost -action create
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "\"${FUNCNAME[0]} $action\" return error!"
|
||||
retval=1
|
||||
fi
|
||||
;;
|
||||
del)
|
||||
$PYTHON_CMD ${CI_ROOT_DIR}/infra/RabbitMQ.py -username murano$BUILD_NUMBER -vhostname murano$BUILD_NUMBER -rabbitmq_host localhost -action delete
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "\"${FUNCNAME[0]} $action\" return error!"
|
||||
retval=1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "\"${FUNCNAME[0]} called without parameters!"
|
||||
retval=1
|
||||
;;
|
||||
esac
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function get_ip_from_iface()
|
||||
{
|
||||
local retval=0
|
||||
local iface_name=$1
|
||||
found_ip_address=$(ifconfig $iface_name | awk -F ' *|:' '/inet addr/{print $4}')
|
||||
if [ $? -ne 0 ] || [ -z "$found_ip_address" ]; then
|
||||
echo "Can't obtain ip address from interface $iface_name!"
|
||||
retval=1
|
||||
else
|
||||
readonly found_ip_address
|
||||
fi
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function run_component_deploy()
|
||||
{
|
||||
local retval=0
|
||||
if [ -z "$1" ]; then
|
||||
echo "\"${FUNCNAME[0]} called without parameters!"
|
||||
retval=1
|
||||
else
|
||||
local component=$1
|
||||
local isnoop=$2
|
||||
if [ $# -eq 2 ] && [ "$isnoop" == "noop" ]; then
|
||||
echo "Running: sudo bash -x ${CI_ROOT_DIR}/infra/deploy_component_new.sh noop $component $KEYSTONE_URL noop"
|
||||
sudo WORKSPACE=$WORKSPACE bash -x ${CI_ROOT_DIR}/infra/deploy_component_new.sh noop $component $KEYSTONE_URL noop
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "\"${FUNCNAME[0]}\" return error!"
|
||||
retval=1
|
||||
fi
|
||||
else
|
||||
echo "Running: sudo bash -x ${CI_ROOT_DIR}/infra/deploy_component_new.sh $ZUUL_REF $component $KEYSTONE_URL $ZUUL_URL"
|
||||
sudo WORKSPACE=$WORKSPACE bash -x ${CI_ROOT_DIR}/infra/deploy_component_new.sh $ZUUL_REF $component $KEYSTONE_URL $ZUUL_URL
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "\"${FUNCNAME[0]}\" return error!"
|
||||
retval=1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function run_component_configure()
|
||||
{
|
||||
local retval=0
|
||||
local run_db_sync=true
|
||||
sudo RUN_DB_SYNC=${run_db_sync} bash -x ${CI_ROOT_DIR}/infra/configure_api.sh localhost 5672 False murano$BUILD_NUMBER murano$BUILD_NUMBER $KEYSTONE_URL
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "\"${FUNCNAME[0]}\" return error!"
|
||||
retval=1
|
||||
fi
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function add_mock()
|
||||
{
|
||||
local retval=0
|
||||
local dirname=$1
|
||||
if [[ -z "$dirname" ]]; then
|
||||
echo "No directory name provided."
|
||||
retval=1
|
||||
fi
|
||||
if [[ ! -d "${dirname}" ]]; then
|
||||
echo "Folder '${dirname}' doesn't exist."
|
||||
retval=1
|
||||
fi
|
||||
dirname=${dirname%/*}
|
||||
pushd ${dirname}
|
||||
zip -r "../${dirname}.zip" *
|
||||
popd
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function prepare_tests()
|
||||
{
|
||||
local retval=0
|
||||
local tests_dir=$TESTS_DIR
|
||||
if [ ! -d "$tests_dir" ]; then
|
||||
echo "Directory with tests isn't exist"
|
||||
retval=1
|
||||
else
|
||||
sudo chown -R $USER $tests_dir
|
||||
cd $tests_dir
|
||||
local tests_config=${tests_dir}/muranodashboard/tests/functional/config/config_file.conf
|
||||
local horizon_suffix="horizon"
|
||||
if [ "$distro_based_on" == "redhat" ]; then
|
||||
horizon_suffix="dashboard"
|
||||
fi
|
||||
iniset 'common' 'keystone_url' "$(shield_slashes http://${KEYSTONE_URL}:5000/v2.0/)" "$tests_config"
|
||||
iniset 'common' 'horizon_url' "$(shield_slashes http://${found_ip_address}/${horizon_suffix})" "$tests_config"
|
||||
iniset 'common' 'murano_url' "$(shield_slashes http://${found_ip_address}:8082)" "$tests_config"
|
||||
iniset 'common' 'user' "$ADMIN_USERNAME" "$tests_config"
|
||||
iniset 'common' 'password' "$ADMIN_PASSWORD" "$tests_config"
|
||||
iniset 'common' 'tenant' "$ADMIN_TENANT" "$tests_config"
|
||||
cd $tests_dir/muranodashboard/tests/functional
|
||||
add_mock MockApp || retval=$?
|
||||
fi
|
||||
cd $WORKSPACE
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function run_tests()
|
||||
{
|
||||
local retval=0
|
||||
local tests_dir=$TESTS_DIR
|
||||
if [ -f /tmp/parser_table.py ]; then
|
||||
sudo rm -f /tmp/parser_table.py
|
||||
fi
|
||||
cd ${tests_dir}/muranodashboard/tests/functional
|
||||
$NOSETESTS_CMD sanity_check --nologcapture
|
||||
if [ $? -ne 0 ]; then
|
||||
collect_artifacts $STORE_AS_ARTIFACTS
|
||||
handle_rabbitmq del
|
||||
retval=1
|
||||
else
|
||||
collect_artifacts $STORE_AS_ARTIFACTS
|
||||
fi
|
||||
cd $WORKSPACE
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function collect_artifacts()
|
||||
{
|
||||
local sources=$@
|
||||
local destination=${WORKSPACE}/artifacts
|
||||
sudo mkdir -p $destination
|
||||
for src_element in $sources; do
|
||||
if [ -d "${src_element}" ]; then
|
||||
sudo cp -R ${src_element}/* ${destination}/
|
||||
else
|
||||
sudo cp -R ${src_element} ${destination}/
|
||||
fi
|
||||
done
|
||||
sudo chown -R jenkins:jenkins $WORKSPACE/artifacts/*
|
||||
}
|
||||
#
|
||||
#Starting up:
|
||||
WORKSPACE=$(cd $WORKSPACE && pwd)
|
||||
TESTS_DIR="${WORKSPACE}/murano-dashboard"
|
||||
cd $WORKSPACE
|
||||
export DISPLAY=:${DISPLAY_NUM}
|
||||
|
||||
fonts_path="/usr/share/fonts/X11/misc/"
|
||||
if [ $distro_based_on == "redhat" ]; then
|
||||
fonts_path="/usr/share/X11/fonts/misc/"
|
||||
fi
|
||||
$SCREEN_CMD -dmS display sudo Xvfb -fp ${fonts_path} :${DISPLAY_NUM} -screen 0 1600x900x16 || exit $?
|
||||
sudo $NTPDATE_CMD -u ru.pool.ntp.org || exit $?
|
||||
sudo $FW_CMD -F
|
||||
get_ip_from_iface eth0 || exit $?
|
||||
handle_rabbitmq add || exit $?
|
||||
run_component_deploy murano-dashboard || (e_code=$?; handle_rabbitmq del; exit $e_code) || exit $?
|
||||
run_component_deploy murano noop || (e_code=$?; handle_rabbitmq del; exit $e_code) || exit $?
|
||||
run_component_configure || (e_code=$?; handle_rabbitmq del; exit $e_code) || exit $?
|
||||
prepare_tests || (e_code=$?; handle_rabbitmq del; exit $e_code) || exit $?
|
||||
run_tests || exit $?
|
||||
handle_rabbitmq del || exit $?
|
||||
exit 0
|
||||
@@ -1,334 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2014 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
# Error trapping first
|
||||
#---------------------
|
||||
set -o errexit
|
||||
|
||||
function trap_handler() {
|
||||
cat << EOF
|
||||
********************************************************************************
|
||||
*
|
||||
* Got error in "'$3'", line "'$2'", error code "'$1'"
|
||||
*
|
||||
********************************************************************************
|
||||
EOF
|
||||
}
|
||||
|
||||
function exit_handler() {
|
||||
mkdir -p $WORKSPACE/artifacts
|
||||
echo $BUILD_STATUS_ON_EXIT > $WORKSPACE/artifacts/build_status
|
||||
cat << EOF
|
||||
********************************************************************************
|
||||
*
|
||||
* Exiting script, exit code "'$1'"
|
||||
* Build status: $BUILD_STATUS_ON_EXIT
|
||||
*
|
||||
********************************************************************************
|
||||
EOF
|
||||
set +o xtrace
|
||||
while [ -f ~/keep-vm-alive ]; do
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
trap 'trap_handler ${?} ${LINENO} ${0}' ERR
|
||||
trap 'exit_handler ${?}' EXIT
|
||||
#---------------------
|
||||
|
||||
|
||||
# Enable debug output
|
||||
#--------------------
|
||||
PS4='+ [$(date --rfc-3339=seconds)] '
|
||||
set -o xtrace
|
||||
#--------------------
|
||||
|
||||
|
||||
CI_ROOT_DIR=$(cd $(dirname "$0") && cd .. && pwd)
|
||||
|
||||
|
||||
# This file is generated by Nodepool while building snapshots
|
||||
# It contains credentials to access RabbitMQ and an OpenStack lab
|
||||
# This file might be absent if script is not launched by Jenkins
|
||||
if [ -f ~/credentials ]; then
|
||||
source ~/credentials
|
||||
fi
|
||||
|
||||
|
||||
# Defaults
|
||||
#---------
|
||||
WORKSPACE=${WORKSPACE:-.}
|
||||
OPENSTACK_HOST=${OPENSTACK_HOST:-$KEYSTONE_URL}
|
||||
HYPERVIZOR_HOST=${HYPERVIZOR_HOST:-$OPENSTACK_HOST}
|
||||
ADMIN_USERNAME=${ADMIN_USERNAME:-admin}
|
||||
ADMIN_TENANT=${ADMIN_TENANT:-admin}
|
||||
ADMIN_PASSWORD=${ADMIN_PASSWORD:-}
|
||||
#---------
|
||||
|
||||
|
||||
# Basic parameters
|
||||
#-----------------
|
||||
STACK_HOME='/opt/stack'
|
||||
|
||||
GIT_BASE=${GIT_BASE:-https://git.openstack.org}
|
||||
|
||||
MURANO_REPO=${MURANO_REPO:-${GIT_BASE}/openstack/murano}
|
||||
MURANO_BRANCH=${MURANO_BRANCH:-master}
|
||||
|
||||
MURANO_DASHBOARD_REPO=${MURANO_DASHBOARD_REPO:-${GIT_BASE}/openstack/murano-dashboard}
|
||||
MURANO_DASHBOARD_BRANCH=${MURANO_DASHBOARD_BRANCH:-master}
|
||||
|
||||
MURANO_PYTHONCLIENT_REPO=${MURANO_PYTHONCLIENT_REPO:-${GIT_BASE}/openstack/python-muranoclient}
|
||||
MURANO_PYTHONCLIENT_BRANCH=${MURANO_PYTHONCLIENT_BRANCH:-master}
|
||||
|
||||
MURANO_APP_INCUBATOR_REPO=${MURANO_APP_INCUBATOR_REPO:-https://github.com/murano-project/murano-app-incubator}
|
||||
MURANO_APP_INCUBATOR_BRANCH=${MURANO_APP_INCUBATOR_BRANCH:-master}
|
||||
|
||||
WORKSPACE=$(cd ${WORKSPACE} && pwd)
|
||||
|
||||
TZ_STRING='Europe/Moscow'
|
||||
#-----------------
|
||||
|
||||
|
||||
# Virtual framebuffer settings
|
||||
#-----------------------------
|
||||
VFB_DISPLAY_SIZE='1280x1024'
|
||||
VFB_COLOR_DEPTH=16
|
||||
VFB_DISPLAY_NUM=22
|
||||
#-----------------------------
|
||||
|
||||
|
||||
|
||||
# Functions
|
||||
#-------------------------------------------------------------------------------
|
||||
function get_ip_from_iface() {
|
||||
local iface_name=$1
|
||||
|
||||
found_ip_address=$(ifconfig ${iface_name} | awk -F ' *|:' '/inet addr/{print $4}')
|
||||
|
||||
if [ $? -ne 0 ] || [ -z "${found_ip_address}" ]; then
|
||||
echo "Can't obtain ip address from interface ${iface_name}!"
|
||||
return 1
|
||||
else
|
||||
readonly found_ip_address
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function get_floating_ip() {
|
||||
if [ -z "${HYPERVIZOR_HOST}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
sudo apt-get install --yes python-novaclient
|
||||
|
||||
set +o xtrace
|
||||
export OS_USERNAME=${ADMIN_USERNAME}
|
||||
export OS_PASSWORD=${ADMIN_PASSWORD}
|
||||
export OS_TENANT_NAME=${ADMIN_TENANT}
|
||||
export OS_AUTH_URL="http://${HYPERVIZOR_HOST}:5000/v2.0"
|
||||
set -o xtrace
|
||||
|
||||
floating_ip_address=$(nova floating-ip-list | grep " ${found_ip_address} " | cut -d ' ' -f 4)
|
||||
|
||||
if [ -z ""${floating_ip_address} ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly floating_ip_address
|
||||
}
|
||||
|
||||
|
||||
function import_murano_apps() {
|
||||
pushd "${WORKSPACE}"
|
||||
|
||||
git clone ${MURANO_APP_INCUBATOR_REPO} "${WORKSPACE}/murano-app-incubator"
|
||||
cd "./murano-app-incubator"
|
||||
git fetch ${MURANO_APP_INCUBATOR_REPO} ${MURANO_APP_INCUBATOR_BRANCH} && git checkout FETCH_HEAD
|
||||
|
||||
set +o xtrace
|
||||
export OS_USERNAME=${ADMIN_USERNAME}
|
||||
export OS_PASSWORD=${ADMIN_PASSWORD}
|
||||
export OS_TENANT_NAME=${ADMIN_TENANT}
|
||||
export OS_AUTH_URL="http://${OPENSTACK_HOST}:5000/v2.0"
|
||||
set -o xtrace
|
||||
|
||||
sudo rm -f /tmp/parser_table.py
|
||||
|
||||
local app
|
||||
for app in io.murano.*; do
|
||||
if [ -f "${app}/manifest.yaml" ]; then
|
||||
murano-manage --config-file /etc/murano/murano.conf import-package ${app}
|
||||
fi
|
||||
done
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
function make_murano_package() {
|
||||
local path=$1
|
||||
|
||||
if [[ -z "${path}" ]]; then
|
||||
echo "No directory name provided."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "${path}" ]]; then
|
||||
echo "Folder '${path}' doesn't exist."
|
||||
return 1
|
||||
fi
|
||||
|
||||
path=${path%/*}
|
||||
|
||||
pushd ${path}
|
||||
|
||||
zip -r "../${path}.zip" *
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
function git_clone_devstack() {
|
||||
# Assuming the script is run from 'jenkins' user
|
||||
|
||||
sudo mkdir -p "${STACK_HOME}"
|
||||
sudo chown -R jenkins:jenkins "${STACK_HOME}"
|
||||
git clone https://github.com/openstack-dev/devstack ${STACK_HOME}/devstack
|
||||
|
||||
#source ${STACK_HOME}/devstack/functions-common
|
||||
}
|
||||
|
||||
|
||||
function deploy_devstack() {
|
||||
# Assuming the script is run from 'jenkins' user
|
||||
local git_dir=/opt/git
|
||||
|
||||
cd "${STACK_HOME}"
|
||||
git clone ${MURANO_REPO}
|
||||
|
||||
cd "${STACK_HOME}/murano"
|
||||
git fetch ${MURANO_REPO} ${MURANO_BRANCH} && git checkout FETCH_HEAD
|
||||
# NOTE: Source path MUST ends with a slash!
|
||||
rsync --recursive --exclude README.* "./contrib/devstack/" "${STACK_HOME}/devstack/"
|
||||
git checkout master
|
||||
|
||||
cd "${STACK_HOME}/devstack"
|
||||
|
||||
cat << EOF > local.conf
|
||||
[[local|localrc]]
|
||||
HOST_IP=${OPENSTACK_HOST} # IP address of OpenStack lab
|
||||
ADMIN_PASSWORD=${ADMIN_PASSWORD} # This value doesn't matter
|
||||
MYSQL_PASSWORD=swordfish # Random password for MySQL installation
|
||||
SERVICE_PASSWORD=${ADMIN_PASSWORD} # Password of service user
|
||||
SERVICE_TOKEN=. # This value doesn't matter
|
||||
SERVICE_TENANT_NAME=${ADMIN_TENANT}
|
||||
MURANO_ADMIN_USER=${ADMIN_USERNAME}
|
||||
RABBIT_HOST=${floating_ip_address}
|
||||
RABBIT_PASSWORD=guest
|
||||
MURANO_RABBIT_VHOST=/
|
||||
MURANO_REPO=${MURANO_REPO}
|
||||
MURANO_BRANCH=${MURANO_BRANCH}
|
||||
MURANO_DASHBOARD_REPO=${MURANO_DASHBOARD_REPO}
|
||||
MURANO_DASHBOARD_BRANCH=${MURANO_DASHBOARD_BRANCH}
|
||||
MURANO_PYTHONCLIENT_REPO=${MURANO_PYTHONCLIENT_REPO}
|
||||
MURANO_PYTHONCLIENT_BRANCH=${MURANO_PYTHONCLIENT_BRANCH}
|
||||
RECLONE=True
|
||||
SCREEN_LOGDIR=/opt/stack/log/
|
||||
LOGFILE=\$SCREEN_LOGDIR/stack.sh.log
|
||||
ENABLED_SERVICES=
|
||||
enable_service mysql
|
||||
enable_service rabbit
|
||||
enable_service horizon
|
||||
enable_service murano
|
||||
enable_service murano-api
|
||||
enable_service murano-engine
|
||||
enable_service murano-dashboard
|
||||
EOF
|
||||
|
||||
sudo ./tools/create-stack-user.sh
|
||||
echo 'stack:swordfish' | sudo chpasswd
|
||||
|
||||
sudo chown -R stack:stack "${STACK_HOME}"
|
||||
|
||||
sudo sed -i 's/^PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
||||
sudo service ssh restart
|
||||
|
||||
sudo su -c "cd ${STACK_HOME}/devstack && ./stack.sh" stack
|
||||
|
||||
# Fix iptables to allow outbound access
|
||||
sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
|
||||
}
|
||||
|
||||
|
||||
function adjust_time_settings(){
|
||||
sudo sh -c "echo \"${TZ_STRING}\" > /etc/timezone"
|
||||
sudo dpkg-reconfigure -f noninteractive tzdata
|
||||
|
||||
sudo ntpdate -u ru.pool.ntp.org
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
BUILD_STATUS_ON_EXIT='PREPARATION_FAILED'
|
||||
|
||||
# Create flags (files to check VM state)
|
||||
if [ -f ~/build-started ]; then
|
||||
echo 'This VM is from previous tests run, terminating build'
|
||||
exit 1
|
||||
else
|
||||
touch ~/build-started
|
||||
fi
|
||||
|
||||
if [ "${KEEP_VM_ALIVE}" == 'true' ]; then
|
||||
touch ~/keep-vm-alive
|
||||
fi
|
||||
|
||||
|
||||
sudo sh -c "echo '127.0.0.1 $(hostname)' >> /etc/hosts"
|
||||
sudo iptables -F
|
||||
|
||||
adjust_time_settings
|
||||
|
||||
# Clone devstack first as we will use
|
||||
# some of its files (functions-common, for example)
|
||||
git_clone_devstack
|
||||
|
||||
get_ip_from_iface eth0
|
||||
|
||||
get_floating_ip
|
||||
|
||||
cat << EOF
|
||||
********************************************************************************
|
||||
*
|
||||
* Fixed IP: ${found_ip_address}
|
||||
* Floating IP: ${floating_ip_address}
|
||||
* Horizon URL: http://${floating_ip_address}
|
||||
* SSH connection string: ssh stack@${floating_ip_address} -oPubkeyAuthentication=no
|
||||
*
|
||||
********************************************************************************
|
||||
EOF
|
||||
|
||||
BUILD_STATUS_ON_EXIT='DEVSTACK_FAILED'
|
||||
|
||||
deploy_devstack
|
||||
|
||||
BUILD_STATUS_ON_EXIT='MURANO_APPS_FAILED'
|
||||
|
||||
import_murano_apps
|
||||
|
||||
BUILD_STATUS_ON_EXIT='SUCCESS'
|
||||
|
||||
exit 0
|
||||
@@ -1,201 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2014 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
CI_ROOT_DIR=$(cd $(dirname "$0") && cd .. && pwd)
|
||||
#Include of the common functions library file:
|
||||
INC_FILE="${CI_ROOT_DIR}/scripts/common.inc"
|
||||
if [ -f "$INC_FILE" ]; then
|
||||
source "$INC_FILE"
|
||||
else
|
||||
echo "\"$INC_FILE\" - file not found, exiting!"
|
||||
exit 1
|
||||
fi
|
||||
#Basic parameters:
|
||||
PYTHON_CMD=$(which python)
|
||||
NOSETESTS_CMD=$(which nosetests)
|
||||
GIT_CMD=$(which git)
|
||||
NTPDATE_CMD=$(which ntpdate)
|
||||
PIP_CMD=$(which pip)
|
||||
#
|
||||
#This file is generated by Nodepool while building snapshots
|
||||
#It contains credentials to access RabbitMQ and an OpenStack lab
|
||||
source ~/credentials
|
||||
#sudo su -c 'echo "ServerName localhost" >> /etc/apache2/apache2.conf'
|
||||
STORE_AS_ARTIFACTS="/tmp/murano*.log /var/log/murano/"
|
||||
#Functions:
|
||||
function handle_rabbitmq()
|
||||
{
|
||||
local retval=0
|
||||
local action=$1
|
||||
case $action in
|
||||
add)
|
||||
$PYTHON_CMD ${CI_ROOT_DIR}/infra/RabbitMQ.py -username murano$BUILD_NUMBER -vhostname murano$BUILD_NUMBER -rabbitmq_host $RABBITMQ_URL -action create
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "\"${FUNCNAME[0]} $action\" return error!"
|
||||
retval=1
|
||||
fi
|
||||
;;
|
||||
del)
|
||||
$PYTHON_CMD ${CI_ROOT_DIR}/infra/RabbitMQ.py -username murano$BUILD_NUMBER -vhostname murano$BUILD_NUMBER -rabbitmq_host $RABBITMQ_URL -action delete
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "\"${FUNCNAME[0]} $action\" return error!"
|
||||
retval=1
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "\"${FUNCNAME[0]} called without parameters!"
|
||||
retval=1
|
||||
;;
|
||||
esac
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function run_component_deploy()
|
||||
{
|
||||
local retval=0
|
||||
if [ -z "$1" ]; then
|
||||
echo "\"${FUNCNAME[0]} called without parameters!"
|
||||
retval=1
|
||||
else
|
||||
local component=$1
|
||||
echo "Running: sudo bash -x ${CI_ROOT_DIR}/infra/deploy_component_new.sh $ZUUL_REF $component noop $ZUUL_URL"
|
||||
sudo bash -x ${CI_ROOT_DIR}/infra/deploy_component_new.sh $ZUUL_REF $component noop $ZUUL_URL
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "\"${FUNCNAME[0]}\" return error!"
|
||||
retval=1
|
||||
fi
|
||||
local murano_config=/etc/murano/murano.conf
|
||||
sudo service murano-api stop
|
||||
sudo service murano-engine stop
|
||||
sudo chown -R jenkins:jenkins /etc/murano
|
||||
iniset 'murano' 'url' "http://127.0.0.1:8082" "$murano_config"
|
||||
iniset 'keystone_authtoken' 'auth_host' "$KEYSTONE_URL" "$murano_config"
|
||||
iniset 'keystone_authtoken' 'auth_port' "35357" "$murano_config"
|
||||
iniset 'keystone_authtoken' 'auth_protocol' "http" "$murano_config"
|
||||
iniset 'keystone_authtoken' 'admin_tenant_name' "$ADMIN_TENANT" "$murano_config"
|
||||
iniset 'keystone_authtoken' 'admin_user' "$ADMIN_USERNAME" "$murano_config"
|
||||
iniset 'keystone_authtoken' 'admin_password' "$ADMIN_PASSWORD" "$murano_config"
|
||||
sudo chown -R root:root /etc/murano
|
||||
sudo service murano-api start
|
||||
sudo service murano-engine start
|
||||
fi
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function run_component_configure()
|
||||
{
|
||||
local retval=0
|
||||
local run_db_sync=true
|
||||
sudo RUN_DB_SYNC=${run_db_sync} bash -x ${CI_ROOT_DIR}/infra/configure_api.sh $RABBITMQ_HOST $RABBITMQ_PORT False murano$BUILD_NUMBER murano$BUILD_NUMBER $KEYSTONE_URL
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "\"${FUNCNAME[0]}\" return error!"
|
||||
retval=1
|
||||
fi
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function prepare_incubator_at()
|
||||
{
|
||||
local retval=0
|
||||
local git_url="https://github.com/murano-project/murano-app-incubator"
|
||||
local start_dir=$1
|
||||
local clone_dir="${start_dir}/murano-app-incubator"
|
||||
$GIT_CMD clone $git_url $clone_dir
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "Error occured during git clone $git_url $clone_dir!"
|
||||
retval=1
|
||||
else
|
||||
cd $clone_dir
|
||||
local pkg_counter=0
|
||||
for package_dir in io.murano.*
|
||||
do
|
||||
if [ -d "$package_dir" ]; then
|
||||
if [ -f "${package_dir}/manifest.yaml" ]; then
|
||||
sudo bash make-package.sh $package_dir
|
||||
pkg_counter=$((pkg_counter + 1))
|
||||
fi
|
||||
fi
|
||||
done
|
||||
cd ${start_dir}
|
||||
if [ $pkg_counter -eq 0 ]; then
|
||||
echo "Warning: $pkg_counter packages was built at $clone_dir!"
|
||||
retval=1
|
||||
fi
|
||||
fi
|
||||
return $retval
|
||||
}
|
||||
#
|
||||
function prepare_tests()
|
||||
{
|
||||
sudo pip install -r $SOURCE_DIR/test-requirements.txt
|
||||
|
||||
local murano_url="http://127.0.0.1:8082/v1/"
|
||||
local tests_config=$SOURCE_DIR/murano/tests/functional/engine/config.conf
|
||||
sudo chown -R jenkins:jenkins $SOURCE_DIR/murano/tests/functional
|
||||
iniset 'murano' 'auth_url' "$(shield_slashes http://${KEYSTONE_URL}:5000/v2.0/)" "$tests_config"
|
||||
iniset 'murano' 'user' "$ADMIN_USERNAME" "$tests_config"
|
||||
iniset 'murano' 'password' "$ADMIN_PASSWORD" "$tests_config"
|
||||
iniset 'murano' 'tenant' "$ADMIN_TENANT" "$tests_config"
|
||||
iniset 'murano' 'murano_url' "$(shield_slashes $murano_url)" "$tests_config"
|
||||
iniset 'murano' 'linux_image' "$LINUX_IMAGE" "$tests_config"
|
||||
|
||||
cd $SOURCE_DIR/murano/tests/functional
|
||||
prepare_incubator_at $(pwd) || retval=$?
|
||||
|
||||
return 0
|
||||
}
|
||||
#
|
||||
function run_tests()
|
||||
{
|
||||
cd $SOURCE_DIR
|
||||
$NOSETESTS_CMD -s -v --with-xunit --xunit-file=$WORKSPACE/test_report$BUILD_NUMBER.xml $SOURCE_DIR/murano/tests/functional/engine/base.py
|
||||
if [ $? -ne 0 ]; then
|
||||
collect_artifacts $STORE_AS_ARTIFACTS
|
||||
handle_rabbitmq del
|
||||
retval=1
|
||||
else
|
||||
collect_artifacts $STORE_AS_ARTIFACTS
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
#
|
||||
function collect_artifacts()
|
||||
{
|
||||
local sources=$@
|
||||
local destination=${WORKSPACE}/artifacts
|
||||
sudo mkdir -p $destination
|
||||
for src_element in $sources; do
|
||||
if [ -d "${src_element}" ]; then
|
||||
sudo cp -R ${src_element}/* ${destination}/
|
||||
else
|
||||
sudo cp -R ${src_element} ${destination}/
|
||||
fi
|
||||
done
|
||||
sudo chown -R jenkins:jenkins $WORKSPACE/artifacts/*
|
||||
}
|
||||
#
|
||||
#Starting up:
|
||||
WORKSPACE=$(cd $WORKSPACE && pwd)
|
||||
SOURCE_DIR=/opt/git/murano
|
||||
TEMPEST_DIR="${WORKSPACE}/tempest"
|
||||
cd $WORKSPACE
|
||||
sudo $NTPDATE_CMD -u ru.pool.ntp.org || exit $?
|
||||
handle_rabbitmq add || exit $?
|
||||
run_component_deploy murano || (e_code=$?; handle_rabbitmq del; exit $e_code) || exit $?
|
||||
run_component_configure || (e_code=$?; handle_rabbitmq del; exit $e_code) || exit $?
|
||||
prepare_tests || (e_code=$?; handle_rabbitmq del; exit $e_code) || exit $?
|
||||
run_tests || exit $?
|
||||
handle_rabbitmq del || exit $?
|
||||
exit 0
|
||||
@@ -1,799 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2014 Mirantis, Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
#
|
||||
|
||||
# Error trapping first
|
||||
#---------------------
|
||||
set -o errexit
|
||||
|
||||
function trap_handler() {
|
||||
cat << EOF
|
||||
********************************************************************************
|
||||
*
|
||||
* Got error in "'$3'", line "'$2'", error code "'$1'"
|
||||
*
|
||||
********************************************************************************
|
||||
EOF
|
||||
}
|
||||
|
||||
function exit_handler() {
|
||||
mkdir -p $WORKSPACE/artifacts
|
||||
echo $BUILD_STATUS_ON_EXIT > $WORKSPACE/artifacts/build_status
|
||||
echo $BUILD_STATUS_ON_EXIT > $WORKSPACE/artifacts/overall-status.txt
|
||||
cat << EOF
|
||||
********************************************************************************
|
||||
*
|
||||
* Exiting script, exit code "'$1'"
|
||||
* Build status: $BUILD_STATUS_ON_EXIT
|
||||
*
|
||||
********************************************************************************
|
||||
EOF
|
||||
set +o xtrace
|
||||
while [ -f ~/keep-vm-alive ]; do
|
||||
sleep 5
|
||||
done
|
||||
}
|
||||
|
||||
trap 'trap_handler ${?} ${LINENO} ${0}' ERR
|
||||
trap 'exit_handler ${?}' EXIT
|
||||
#---------------------
|
||||
|
||||
|
||||
# Enable debug output
|
||||
#--------------------
|
||||
PS4='+ [$(date --rfc-3339=seconds)] '
|
||||
set -o xtrace
|
||||
#--------------------
|
||||
|
||||
|
||||
CI_ROOT_DIR=$(cd $(dirname "$0") && cd .. && pwd)
|
||||
|
||||
|
||||
# Include of the common functions library file
|
||||
source "${CI_ROOT_DIR}/scripts/common.inc"
|
||||
|
||||
# This file is generated by Nodepool while building snapshots
|
||||
# It contains credentials to access RabbitMQ and an OpenStack lab
|
||||
source ~/credentials
|
||||
|
||||
|
||||
# Basic parameters
|
||||
#-----------------
|
||||
STACK_HOME='/opt/stack'
|
||||
|
||||
ZUUL_URL=${ZUUL_URL:-'https://git.openstack.org'}
|
||||
ZUUL_REF=${ZUUL_REF:-'master'}
|
||||
ZUUL_PROJECT=${ZUUL_PROJECT:-'openstack/murano'}
|
||||
|
||||
APP_INCUBATOR_REPO=${APP_INCUBATOR_REPO:-https://github.com/murano-project/murano-app-incubator}
|
||||
APP_INCUBATOR_BRANCH=${APP_INCUBATOR_BRANCH:-'master'}
|
||||
|
||||
DIB_MURANO_AGENT_REPO=${DIB_MURANO_AGENT_REPO:-git://git.openstack.org/openstack/murano-agent.git}
|
||||
DIB_MURANO_AGENT_BRANCH=${DIB_MURANO_AGENT_BRANCH:-master}
|
||||
DIB_MURANO_AGENT_REF=${DIB_MURANO_AGENT_REF:-''}
|
||||
|
||||
MURANO_REPO=${MURANO_REPO:-git://git.openstack.org/openstack/murano.git}
|
||||
MURANO_BRANCH=${ZUUL_BRANCH}
|
||||
|
||||
MURANO_DASHBOARD_REPO=${MURANO_DASHBOARD_REPO:-git://git.openstack.org/openstack/murano-dashboard.git}
|
||||
MURANO_DASHBOARD_BRANCH=${ZUUL_BRANCH}
|
||||
|
||||
MURANO_PYTHONCLIENT_REPO=${MURANO_PYTHONCLIENT_REPO:-git://git.openstack.org/openstack/python-muranoclient.git}
|
||||
MURANO_PYTHONCLIENT_BRANCH=${ZUUL_BRANCH}
|
||||
|
||||
|
||||
PROJECT_NAME=${ZUUL_PROJECT##*/}
|
||||
|
||||
APT_PROXY_HOST=${APT_PROXY_HOST:-''}
|
||||
|
||||
OPENSTACK_HOST=${OPENSTACK_HOST:-$KEYSTONE_URL}
|
||||
|
||||
DO_NOT_COLLECT_ARTIFACTS=${DO_NOT_COLLECT_ARTIFACTS:-false}
|
||||
|
||||
WORKSPACE=$(cd $WORKSPACE && pwd)
|
||||
|
||||
TZ_STRING='Europe/Moscow'
|
||||
|
||||
DISTR_NAME=${DISTR_NAME:-'ubuntu'}
|
||||
|
||||
LIBS_FROM_GIT=""
|
||||
|
||||
case "${PROJECT_NAME}" in
|
||||
'murano')
|
||||
PROJECT_DIR="${STACK_HOME}/murano"
|
||||
PROJECT_TESTS_DIR="${PROJECT_DIR}/murano/tests/functional"
|
||||
;;
|
||||
'murano-dashboard')
|
||||
PROJECT_DIR="${STACK_HOME}/murano-dashboard"
|
||||
PROJECT_TESTS_DIR="${PROJECT_DIR}/muranodashboard/tests/functional"
|
||||
;;
|
||||
'python-muranoclient')
|
||||
PROJECT_DIR="${STACK_HOME}/python-muranoclient"
|
||||
PROJECT_TESTS_DIR="${STACK_HOME}/murano-dashboard/muranodashboard/tests/functional"
|
||||
;;
|
||||
'murano-agent')
|
||||
PROJECT_TESTS_DIR="${STACK_HOME}/murano/murano/tests/functional"
|
||||
export DIB_MURANO_AGENT_REPO="${ZUUL_URL}/${ZUUL_PROJECT}"
|
||||
export DIB_MURANO_AGENT_BRANCH=${ZUUL_BRANCH}
|
||||
export DIB_MURANO_AGENT_REF=${ZUUL_REF}
|
||||
# tests for engine launch on iso with murano-agent
|
||||
;;
|
||||
*)
|
||||
echo "Project name '$ZUUL_PROJECT' isn't supported yet."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
#-----------------
|
||||
|
||||
|
||||
# Commands used in script
|
||||
#------------------------
|
||||
NOSETESTS_CMD=$(which nosetests)
|
||||
#------------------------
|
||||
|
||||
|
||||
# Virtual framebuffer settings
|
||||
#-----------------------------
|
||||
VFB_DISPLAY_SIZE='1280x1024'
|
||||
VFB_COLOR_DEPTH=16
|
||||
VFB_DISPLAY_NUM=22
|
||||
#-----------------------------
|
||||
|
||||
|
||||
|
||||
# Functions
|
||||
#-------------------------------------------------------------------------------
|
||||
function get_ip_from_iface() {
|
||||
local iface_name=$1
|
||||
|
||||
found_ip_address=$(ifconfig $iface_name | awk -F ' *|:' '/inet addr/{print $4}')
|
||||
|
||||
if [ $? -ne 0 ] || [ -z "$found_ip_address" ]; then
|
||||
echo "Can't obtain ip address from interface $iface_name!"
|
||||
return 1
|
||||
else
|
||||
readonly found_ip_address
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function get_floating_ip() {
|
||||
|
||||
sudo apt-get -y install python-virtualenv
|
||||
local tmp_venv=$(mktemp -d)
|
||||
virtualenv ${tmp_venv}
|
||||
${tmp_venv}/bin/pip install "python-novaclient>=2.22.0"
|
||||
|
||||
export OS_USERNAME=${ADMIN_USERNAME}
|
||||
export OS_PASSWORD=${ADMIN_PASSWORD}
|
||||
export OS_TENANT_NAME=${ADMIN_TENANT}
|
||||
export OS_AUTH_URL="http://${OPENSTACK_HOST}:5000/v2.0"
|
||||
|
||||
floating_ip_address=$(${tmp_venv}/bin/nova floating-ip-list | grep " ${found_ip_address} " | cut -d ' ' -f 4)
|
||||
|
||||
if [ -z ""${floating_ip_address} ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf ${tmp_venv}
|
||||
|
||||
readonly floating_ip_address
|
||||
}
|
||||
|
||||
function clone_project() {
|
||||
local project_root=$1
|
||||
git clone ${ZUUL_URL}/${ZUUL_PROJECT} ${project_root}
|
||||
pushd ${project_root}
|
||||
git fetch ${ZUUL_URL}/${ZUUL_PROJECT} ${ZUUL_REF} && git checkout FETCH_HEAD
|
||||
popd
|
||||
}
|
||||
|
||||
function get_commit_message() {
|
||||
local project_root=$1
|
||||
pushd ${project_root}
|
||||
git log --format=%B -n 1
|
||||
popd
|
||||
}
|
||||
|
||||
function get_dependencies() {
|
||||
local commit_message=$1
|
||||
|
||||
local IFS=$'\n'
|
||||
for dependency in $(echo -e "${commit_message}" | grep -o "^Depends-On: .*$"); do
|
||||
dependency=$(echo "${dependency}" | awk '{ print $2 }')
|
||||
echo ${dependency}
|
||||
done
|
||||
}
|
||||
|
||||
function get_dependency_info() {
|
||||
local dependency=$1
|
||||
|
||||
local metadata=$(curl https://review.openstack.org/changes/${dependency}/detail?o=CURRENT_REVISION 2> /dev/null)
|
||||
local ref=$(echo -e "${metadata}" | grep -o '"ref": ".*"$' | awk -F'"' '{ print $4 }')
|
||||
local project=$(echo -e "${metadata}" | grep -o '"project": ".*",' | awk -F'"' '{ print $4 }')
|
||||
|
||||
echo "${project}:${ref}"
|
||||
}
|
||||
|
||||
function override_reference() {
|
||||
local tmp_dir=$(mktemp -d)
|
||||
|
||||
clone_project ${tmp_dir}
|
||||
local msg=$(get_commit_message ${tmp_dir})
|
||||
|
||||
local IFS=$'\n'
|
||||
for dependency in $(get_dependencies "${msg}"); do
|
||||
local dep_info=$(get_dependency_info ${dependency})
|
||||
local dep_project=$(echo ${dep_info} | awk -F':' '{ print $1 }')
|
||||
local dep_ref=$(echo ${dep_info} | awk -F':' '{ print $2 }')
|
||||
|
||||
case ${dep_project} in
|
||||
"openstack/murano")
|
||||
MURANO_BRANCH=${dep_ref}
|
||||
;;
|
||||
"openstack/murano-dashboard")
|
||||
MURANO_DASHBOARD_BRANCH=${dep_ref}
|
||||
;;
|
||||
"openstack/murano-agent")
|
||||
DIB_MURANO_AGENT_REF=${dep_ref}
|
||||
;;
|
||||
"openstack/python-muranoclient")
|
||||
MURANO_PYTHONCLIENT_BRANCH=${dep_ref}
|
||||
LIBS_FROM_GIT='python-muranoclient'
|
||||
;;
|
||||
*)
|
||||
echo "Unsupported dependent project: ${dep_project}"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
rm -rf ${tmp_dir}
|
||||
}
|
||||
|
||||
function prepare_murano_apps() {
|
||||
local start_dir=$1
|
||||
local clone_dir="${start_dir}/murano-app-incubator"
|
||||
|
||||
cd ${start_dir}
|
||||
|
||||
if [[ "${PROJECT_NAME}" == 'murano' || "${PROJECT_NAME}" == 'murano-agent' ]]; then
|
||||
git clone --branch ${APP_INCUBATOR_BRANCH} -- ${APP_INCUBATOR_REPO} ${clone_dir}
|
||||
|
||||
local app
|
||||
cd ${clone_dir}
|
||||
for app in io.murano.*; do
|
||||
if [ -f "${app}/manifest.yaml" ]; then
|
||||
make_package ${app}
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
function make_package() {
|
||||
local path=$1
|
||||
|
||||
if [[ -z "${path}" ]]; then
|
||||
echo "No directory name provided."
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [[ ! -d "${path}" ]]; then
|
||||
echo "Folder '${path}' doesn't exist."
|
||||
return 1
|
||||
fi
|
||||
|
||||
path=${path%/*}
|
||||
|
||||
pushd ${path}
|
||||
|
||||
zip -r "../${path}.zip" *
|
||||
|
||||
popd
|
||||
}
|
||||
|
||||
|
||||
function make_img_with_murano_agent() {
|
||||
local agent_dir='/opt/git/agent'
|
||||
|
||||
sudo apt-get --yes update && sudo apt-get --yes upgrade
|
||||
sudo apt-get --yes install kpartx git qemu-utils python-pip
|
||||
sudo pip install dib-utils
|
||||
|
||||
sudo mkdir -p ${agent_dir}
|
||||
sudo chmod 777 ${agent_dir}
|
||||
|
||||
git clone https://git.openstack.org/openstack/diskimage-builder.git \
|
||||
${agent_dir}/diskimage-builder
|
||||
git clone ${ZUUL_URL}/${ZUUL_PROJECT} ${agent_dir}/murano-agent
|
||||
|
||||
pushd ${agent_dir}/murano-agent
|
||||
git fetch ${ZUUL_URL}/${ZUUL_PROJECT} ${ZUUL_REF} && git checkout FETCH_HEAD
|
||||
popd
|
||||
|
||||
export DIB_CLOUD_INIT_DATASOURCES="Ec2, ConfigDrive, OpenStack"
|
||||
export ELEMENTS_PATH=${agent_dir}/murano-agent/contrib/elements
|
||||
pushd ${agent_dir}
|
||||
${agent_dir}/diskimage-builder/bin/disk-image-create vm ${DISTR_NAME} \
|
||||
cloud-init-datasources murano-agent -o ${DISTR_NAME}${BUILD_NUMBER}-murano-agent.qcow2
|
||||
popd
|
||||
|
||||
pushd "${STACK_HOME}/devstack"
|
||||
source openrc ${ADMIN_USERNAME} ${ADMIN_TENANT}
|
||||
popd
|
||||
|
||||
glance image-create --name ${DISTR_NAME}${BUILD_NUMBER} \
|
||||
--disk-format qcow2 --container-format bare \
|
||||
--file ${agent_dir}/${DISTR_NAME}${BUILD_NUMBER}-murano-agent.qcow2 --is-public True \
|
||||
--property 'murano_image_info'="{\"type\":\"linux\",\"title\":\"${DISTR_NAME}${BUILD_NUMBER}\"}"
|
||||
|
||||
LINUX_IMAGE=${DISTR_NAME}${BUILD_NUMBER}
|
||||
|
||||
source "${CI_ROOT_DIR}/scripts/common.inc"
|
||||
}
|
||||
|
||||
|
||||
function remove_image_with_murano_agent() {
|
||||
|
||||
pushd "${STACK_HOME}/devstack"
|
||||
source openrc ${ADMIN_USERNAME} ${ADMIN_TENANT}
|
||||
popd
|
||||
|
||||
for i in $(glance image-list | get_field 2); do
|
||||
if [ "${DISTR_NAME}${BUILD_NUMBER}" == "$i" ]; then
|
||||
glance image-delete $i
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function prepare_tests() {
|
||||
sudo chown -R $USER "${PROJECT_TESTS_DIR}"
|
||||
|
||||
case "${PROJECT_NAME}" in
|
||||
'murano')
|
||||
local config_file="${PROJECT_TESTS_DIR}/engine/config.conf"
|
||||
local section_name='murano'
|
||||
;;
|
||||
'murano-dashboard')
|
||||
local config_file="${PROJECT_TESTS_DIR}/config/config.conf"
|
||||
local section_name='murano'
|
||||
;;
|
||||
'python-muranoclient')
|
||||
local config_file="${PROJECT_TESTS_DIR}/config/config.conf"
|
||||
local section_name='murano'
|
||||
;;
|
||||
'murano-agent')
|
||||
local config_file="${PROJECT_TESTS_DIR}/engine/config.conf"
|
||||
local section_name='murano'
|
||||
make_img_with_murano_agent
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ ! -f "${config_file}" ]; then
|
||||
touch "${config_file}"
|
||||
fi
|
||||
|
||||
iniset "${section_name}" 'keystone_url' "$(shield_slashes http://${OPENSTACK_HOST}:5000/v2.0/)" "${config_file}"
|
||||
iniset "${section_name}" 'horizon_url' "$(shield_slashes http://${found_ip_address}/dashboard/)" "${config_file}"
|
||||
iniset "${section_name}" 'murano_url' "$(shield_slashes http://${found_ip_address}:8082/)" "${config_file}"
|
||||
iniset "${section_name}" 'user' "${ADMIN_USERNAME}" "${config_file}"
|
||||
iniset "${section_name}" 'password' "${ADMIN_PASSWORD}" "${config_file}"
|
||||
iniset "${section_name}" 'tenant' "${ADMIN_TENANT}" "${config_file}"
|
||||
iniset "${section_name}" 'linux_image' "${LINUX_IMAGE}" "${config_file}"
|
||||
iniset "${section_name}" 'auth_url' "$(shield_slashes http://${OPENSTACK_HOST}:5000/v2.0/)" "${config_file}"
|
||||
|
||||
prepare_murano_apps "${PROJECT_TESTS_DIR}"
|
||||
}
|
||||
|
||||
|
||||
function run_tests() {
|
||||
local retval=0
|
||||
|
||||
# TODO(dteselkin): Remove this workaround as soon as
|
||||
# https://bugs.launchpad.net/murano/+bug/1349934 is fixed.
|
||||
sudo rm -f /tmp/parser_table.py
|
||||
|
||||
pushd "${PROJECT_TESTS_DIR}"
|
||||
|
||||
TESTS_STARTED_AT=($(date +'%Y-%m-%d %H:%M:%S'))
|
||||
case "${PROJECT_NAME}" in
|
||||
'murano')
|
||||
$NOSETESTS_CMD -s -v \
|
||||
--with-xunit \
|
||||
--xunit-file=${WORKSPACE}/test_report${BUILD_NUMBER}.xml \
|
||||
${PROJECT_TESTS_DIR}/engine/base.py || retval=$?
|
||||
;;
|
||||
'murano-dashboard')
|
||||
$NOSETESTS_CMD -s -v sanity_check || retval=$?
|
||||
;;
|
||||
'python-muranoclient')
|
||||
# Use tests from murano-dashboard until tests for
|
||||
# python-muranoclient are ready.
|
||||
$NOSETESTS_CMD -s -v sanity_check || retval=$?
|
||||
;;
|
||||
'murano-agent')
|
||||
$NOSETESTS_CMD -s -v \
|
||||
--with-xunit \
|
||||
--xunit-file=${WORKSPACE}/test_report${BUILD_NUMBER}.xml \
|
||||
${PROJECT_TESTS_DIR}/engine/base.py:MuranoBase.test_deploy_telnet \
|
||||
${PROJECT_TESTS_DIR}/engine/base.py:MuranoBase.test_deploy_apache || retval=$?
|
||||
remove_image_with_murano_agent
|
||||
;;
|
||||
esac
|
||||
TESTS_FINISHED_AT=($(date +'%Y-%m-%d %H:%M:%S'))
|
||||
|
||||
if [ $retval -ne 0 ]; then
|
||||
cat << EOF
|
||||
List of murano processes:
|
||||
********************************************************************************
|
||||
$(ps aux | grep murano)
|
||||
********************************************************************************
|
||||
EOF
|
||||
fi
|
||||
|
||||
collect_artifacts
|
||||
collect_openstack_logs
|
||||
|
||||
popd
|
||||
|
||||
ensure_no_heat_stacks_left || retval=$?
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
|
||||
function collect_artifacts() {
|
||||
if [ "${DO_NOT_COLLECT_ARTIFACTS}" == 'true' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
local dst="${WORKSPACE}/artifacts"
|
||||
local rsync_cmd="rsync --recursive --verbose --no-links"
|
||||
|
||||
sudo mkdir -p ${dst}
|
||||
|
||||
### Add correct Apache log path
|
||||
if [ $distro_based_on == "redhat" ]; then
|
||||
apache_log_dir="/var/log/httpd"
|
||||
else
|
||||
apache_log_dir="/var/log/apache2"
|
||||
fi
|
||||
|
||||
# rsync might fail if there is no file or folder,
|
||||
# so I disable error catching
|
||||
set +o errexit
|
||||
|
||||
# Copy devstack logs:
|
||||
# * sleep for 1 minute to give devstack's log collector a chance to write all logs into files
|
||||
sleep 60
|
||||
ls -hal ${STACK_HOME}/log
|
||||
cd ${STACK_HOME}/log && find ./ -type l | \
|
||||
sudo rsync --verbose --files-from=- --copy-links --no-dirs ${STACK_HOME}/log ${dst}/devstack
|
||||
|
||||
# Copy murano logs from /tmp
|
||||
sudo ${rsync_cmd} --include='murano*.log' --exclude='*' /tmp/ ${dst}/tmp
|
||||
|
||||
# Copy murano logs from /var/log/murano
|
||||
sudo ${rsync_cmd} --include='*/' --include='*.log' --exclude='*' /var/log/murano/ ${dst}/murano
|
||||
|
||||
# Copy murano config files
|
||||
sudo mkdir -p ${dst}/etc/murano
|
||||
sudo ${rsync_cmd} /etc/murano/ ${dst}/etc/murano
|
||||
|
||||
# Copy Apache logs
|
||||
sudo ${rsync_cmd} --include='*.log' --exclude='*' ${apache_log_dir}/ ${dst}/apache
|
||||
|
||||
if [ $PROJECT_NAME == 'murano-dashboard' ]; then
|
||||
# Copy screenshots for failed tests
|
||||
sudo ${rsync_cmd} ${PROJECT_TESTS_DIR}/screenshots/ ${dst}/screenshots
|
||||
fi
|
||||
|
||||
# return error catching back
|
||||
set -o errexit
|
||||
|
||||
sudo chown -R jenkins:jenkins ${dst}
|
||||
}
|
||||
|
||||
|
||||
function collect_openstack_logs() {
|
||||
if [ "${DO_NOT_COLLECT_ARTIFACTS}" == 'true' ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
set +o errexit
|
||||
mkdir -p ${WORKSPACE}/artifacts/openstack
|
||||
ssh ${OPENSTACK_HOST} BUILD_TAG=${BUILD_TAG} \~/split-logs.sh ${TESTS_STARTED_AT[0]} ${TESTS_STARTED_AT[1]} ${TESTS_FINISHED_AT[0]} ${TESTS_FINISHED_AT[1]} heat neutron
|
||||
scp -r ${OPENSTACK_HOST}:~/log-parts/${BUILD_TAG}/* ${WORKSPACE}/artifacts/openstack
|
||||
ssh ${OPENSTACK_HOST} rm -rf \~/log-parts/${BUILD_TAG}
|
||||
set -o errexit
|
||||
}
|
||||
|
||||
|
||||
function ensure_no_heat_stacks_left() {
|
||||
local log_file="${STACK_HOME}/log/screen-murano-engine.log"
|
||||
local retval=0
|
||||
|
||||
pushd "${STACK_HOME}/devstack"
|
||||
|
||||
set +o xtrace
|
||||
echo "Importing openrc ..."
|
||||
source openrc ${ADMIN_USERNAME} ${ADMIN_TENANT}
|
||||
env > ~/envvars
|
||||
set -o xtrace
|
||||
|
||||
for id in $(sed -n 's/.*\"OS\:\:stack_id\"\: \"\(.\{36\}\)\".*/\1/p' "${log_file}" | sort | uniq); do
|
||||
stack_info=$(heat stack-list | grep "${id}")
|
||||
if [ -n "${stack_info}" ]; then
|
||||
retval=1
|
||||
echo "Stack '${id}' found!"
|
||||
echo "${stack_info}"
|
||||
echo "Deleting stack '${id}'"
|
||||
heat stack-delete "${id}" > /dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
popd
|
||||
|
||||
return $retval
|
||||
}
|
||||
|
||||
|
||||
function compress_log_files() {
|
||||
for f in $(find ${WORKSPACE}/artifacts -name '*.log'); do
|
||||
gzip < "${f}" > "${f}.gz" && rm -f "${f}"
|
||||
done
|
||||
}
|
||||
|
||||
|
||||
function git_clone_devstack() {
|
||||
# Assuming the script is run from 'jenkins' user
|
||||
|
||||
sudo mkdir -p "${STACK_HOME}"
|
||||
sudo chown -R jenkins:jenkins "${STACK_HOME}"
|
||||
git clone https://github.com/openstack-dev/devstack ${STACK_HOME}/devstack
|
||||
|
||||
pushd ${STACK_HOME}/devstack
|
||||
git checkout ${ZUUL_BRANCH} |:
|
||||
popd
|
||||
|
||||
#source ${STACK_HOME}/devstack/functions-common
|
||||
}
|
||||
|
||||
|
||||
function deploy_devstack() {
|
||||
# Assuming the script is run from 'jenkins' user
|
||||
local git_dir=/opt/git
|
||||
|
||||
sudo mkdir -p "${git_dir}/openstack"
|
||||
sudo chown -R jenkins:jenkins "${git_dir}/openstack"
|
||||
cd "${git_dir}/openstack"
|
||||
git clone https://github.com/openstack/murano
|
||||
|
||||
if [ "${PROJECT_NAME}" == 'murano' ]; then
|
||||
pushd "${git_dir}/openstack/murano"
|
||||
git fetch ${ZUUL_URL}/${ZUUL_PROJECT} ${ZUUL_REF} && git checkout FETCH_HEAD
|
||||
popd
|
||||
fi
|
||||
|
||||
# NOTE: Source path MUST ends with a slash!
|
||||
rsync --recursive --keep-dirlinks --exclude README.* \
|
||||
"${git_dir}/openstack/murano/contrib/devstack/" "${STACK_HOME}/devstack/"
|
||||
|
||||
cd "${STACK_HOME}/devstack"
|
||||
|
||||
# this is set only for murano-dashboard tests
|
||||
MURANO_REPOSITORY_URL="http://storage.apps.openstack.org/"
|
||||
case "${PROJECT_NAME}" in
|
||||
'murano')
|
||||
MURANO_REPO=${ZUUL_URL}/${ZUUL_PROJECT}
|
||||
MURANO_BRANCH=${ZUUL_REF}
|
||||
;;
|
||||
'murano-dashboard')
|
||||
MURANO_DASHBOARD_REPO=${ZUUL_URL}/${ZUUL_PROJECT}
|
||||
MURANO_DASHBOARD_BRANCH=${ZUUL_REF}
|
||||
MURANO_REPOSITORY_URL="http://${floating_ip_address}:8099"
|
||||
;;
|
||||
'python-muranoclient')
|
||||
MURANO_PYTHONCLIENT_REPO=${ZUUL_URL}/${ZUUL_PROJECT}
|
||||
MURANO_PYTHONCLIENT_BRANCH=${ZUUL_REF}
|
||||
MURANO_REPOSITORY_URL="http://${floating_ip_address}:8099"
|
||||
LIBS_FROM_GIT=${PROJECT_NAME}
|
||||
;;
|
||||
esac
|
||||
echo "MURANO_REPOSITORY_URL=${MURANO_REPOSITORY_URL}"
|
||||
echo "MURANO_REPO=${MURANO_REPO}"
|
||||
echo "MURANO_BRANCH=${MURANO_BRANCH}"
|
||||
echo "MURANO_DASHBOARD_REPO=${MURANO_DASHBOARD_REPO}"
|
||||
echo "MURANO_DASHBOARD_BRANCH=${MURANO_DASHBOARD_BRANCH}"
|
||||
echo "MURANO_PYTHONCLIENT_REPO=${MURANO_PYTHONCLIENT_REPO}"
|
||||
echo "MURANO_PYTHONCLIENT_BRANCH=${MURANO_PYTHONCLIENT_BRANCH}"
|
||||
|
||||
cat << EOF > local.conf
|
||||
[[local|localrc]]
|
||||
HOST_IP=${OPENSTACK_HOST} # IP address of OpenStack lab
|
||||
ADMIN_PASSWORD=${ADMIN_PASSWORD} # This value doesn't matter
|
||||
MYSQL_PASSWORD=swordfish # Random password for MySQL installation
|
||||
SERVICE_PASSWORD=${ADMIN_PASSWORD} # Password of service user
|
||||
SERVICE_TOKEN=. # This value doesn't matter
|
||||
SERVICE_TENANT_NAME=${ADMIN_TENANT}
|
||||
MURANO_ADMIN_USER=${ADMIN_USERNAME}
|
||||
RABBIT_HOST=${floating_ip_address}
|
||||
MURANO_REPO=${MURANO_REPO}
|
||||
MURANO_BRANCH=${MURANO_BRANCH}
|
||||
MURANO_DASHBOARD_REPO=${MURANO_DASHBOARD_REPO}
|
||||
MURANO_DASHBOARD_BRANCH=${MURANO_DASHBOARD_BRANCH}
|
||||
MURANO_PYTHONCLIENT_REPO=${MURANO_PYTHONCLIENT_REPO}
|
||||
MURANO_PYTHONCLIENT_BRANCH=${MURANO_PYTHONCLIENT_BRANCH}
|
||||
MURANO_REPOSITORY_URL=${MURANO_REPOSITORY_URL}
|
||||
LIBS_FROM_GIT=${LIBS_FROM_GIT}
|
||||
RABBIT_PASSWORD=guest
|
||||
MURANO_RABBIT_VHOST=/
|
||||
RECLONE=True
|
||||
SCREEN_LOGDIR=/opt/stack/log/
|
||||
LOGFILE=\$SCREEN_LOGDIR/stack.sh.log
|
||||
ENABLED_SERVICES=
|
||||
enable_service mysql
|
||||
enable_service rabbit
|
||||
enable_service horizon
|
||||
enable_service murano
|
||||
enable_service murano-api
|
||||
enable_service murano-engine
|
||||
enable_service murano-dashboard
|
||||
EOF
|
||||
|
||||
sudo ./tools/create-stack-user.sh
|
||||
echo 'stack:swordfish' | sudo chpasswd
|
||||
|
||||
sudo chown -R stack:stack "${STACK_HOME}"
|
||||
|
||||
sudo sed -i 's/^PasswordAuthentication.*/PasswordAuthentication yes/' /etc/ssh/sshd_config
|
||||
sudo service ssh restart
|
||||
|
||||
sudo su -c "cd ${STACK_HOME}/devstack && ./stack.sh" stack
|
||||
|
||||
# Fix iptables to allow outbound access
|
||||
sudo iptables -I INPUT 1 -p tcp --dport 8099 -j ACCEPT
|
||||
sudo iptables -I INPUT 1 -p tcp --dport 80 -j ACCEPT
|
||||
}
|
||||
|
||||
|
||||
function configure_apt_cacher() {
|
||||
local mode=$1
|
||||
local apt_proxy_host=${2:-$APT_PROXY_HOST}
|
||||
local apt_proxy_file=/etc/apt/apt.conf.d/01proxy
|
||||
|
||||
if [ -z "${APT_PROXY_HOST}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
case $mode in
|
||||
enable)
|
||||
sudo sh -c "echo 'Acquire::http { Proxy \"http://${apt_proxy_host}:3142\"; };' > ${apt_proxy_file}"
|
||||
sudo apt-get update
|
||||
;;
|
||||
disable)
|
||||
sudo rm -f $apt_proxy_file
|
||||
sudo apt-get update
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
|
||||
function start_xvfb_session() {
|
||||
if [ "${PROJECT_NAME}" == 'murano' ]; then
|
||||
echo "Skipping 'start_xvfb_session' ..."
|
||||
return
|
||||
fi
|
||||
|
||||
export DISPLAY=:${VFB_DISPLAY_NUM}
|
||||
|
||||
fonts_path="/usr/share/fonts/X11/misc/"
|
||||
if [ $distro_based_on == "redhat" ]; then
|
||||
fonts_path="/usr/share/X11/fonts/misc/"
|
||||
fi
|
||||
|
||||
# Start XVFB session
|
||||
sudo Xvfb -fp ${fonts_path} ${DISPLAY} -screen 0 ${VFB_DISPLAY_SIZE}x${VFB_COLOR_DEPTH} &
|
||||
|
||||
# Start VNC server
|
||||
sudo apt-get install --yes x11vnc
|
||||
x11vnc -bg -forever -nopw -display ${DISPLAY} -ncache 10
|
||||
sudo iptables -I INPUT 1 -p tcp --dport 5900 -j ACCEPT
|
||||
|
||||
# Launch window manager
|
||||
sudo apt-get install --yes openbox
|
||||
exec openbox &
|
||||
}
|
||||
|
||||
function adjust_time_settings(){
|
||||
sudo sh -c "echo \"${TZ_STRING}\" > /etc/timezone"
|
||||
sudo dpkg-reconfigure -f noninteractive tzdata
|
||||
|
||||
sudo ntpdate -u ru.pool.ntp.org
|
||||
}
|
||||
#-------------------------------------------------------------------------------
|
||||
|
||||
BUILD_STATUS_ON_EXIT='VM_REUSED'
|
||||
|
||||
# Create flags (files to check VM state)
|
||||
if [ -f ~/build-started ]; then
|
||||
echo 'This VM is from previous tests run, terminating build'
|
||||
exit 1
|
||||
else
|
||||
touch ~/build-started
|
||||
fi
|
||||
|
||||
BUILD_STATUS_ON_EXIT='PREPARATION_FAILED'
|
||||
|
||||
if [ "${KEEP_VM_ALIVE}" == 'true' ]; then
|
||||
touch ~/keep-vm-alive
|
||||
fi
|
||||
|
||||
|
||||
sudo sh -c "echo '127.0.0.1 $(hostname)' >> /etc/hosts"
|
||||
sudo iptables -F
|
||||
|
||||
adjust_time_settings
|
||||
|
||||
# Clone devstack first as we will use
|
||||
# some of its files (functions-common, for example)
|
||||
git_clone_devstack
|
||||
|
||||
get_os
|
||||
|
||||
get_ip_from_iface eth0
|
||||
|
||||
get_floating_ip
|
||||
|
||||
override_reference
|
||||
|
||||
cat << EOF
|
||||
********************************************************************************
|
||||
*
|
||||
* Fixed IP: ${found_ip_address}
|
||||
* Floating IP: ${floating_ip_address}
|
||||
* Horizon URL: http://${floating_ip_address}
|
||||
* SSH connection string: ssh stack@${floating_ip_address} -oPubkeyAuthentication=no
|
||||
*
|
||||
********************************************************************************
|
||||
EOF
|
||||
|
||||
#configure_apt_cacher enable
|
||||
|
||||
BUILD_STATUS_ON_EXIT='DEVSTACK_FAILED'
|
||||
|
||||
deploy_devstack
|
||||
|
||||
BUILD_STATUS_ON_EXIT='PREPARATION_FAILED'
|
||||
|
||||
start_xvfb_session
|
||||
|
||||
BUILD_STATUS_ON_EXIT='TESTS_FAILED'
|
||||
|
||||
prepare_tests
|
||||
|
||||
cat << EOF
|
||||
Installed pypi packages:
|
||||
********************************************************************************
|
||||
$(pip freeze)
|
||||
********************************************************************************
|
||||
EOF
|
||||
|
||||
run_tests
|
||||
|
||||
BUILD_STATUS_ON_EXIT='SUCCESS'
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user