From f2ade017d4c6412d66ff04c918504ee4a2bfa7e9 Mon Sep 17 00:00:00 2001 From: zhurong Date: Tue, 22 Jan 2019 13:51:42 +0800 Subject: [PATCH] Add grenade job Depends-On: https://review.openstack.org/632404 Change-Id: I54b191faf9c2ddedfd574121f59bf7cc45faa90f --- .zuul.yaml | 25 +++++++ devstack/upgrade/resources.sh | 50 +++++++++++++ devstack/upgrade/settings | 11 +++ devstack/upgrade/shutdown.sh | 23 ++++++ devstack/upgrade/upgrade.sh | 70 +++++++++++++++++++ .../legacy/grenade-devstack-murano/post.yaml | 15 ++++ .../legacy/grenade-devstack-murano/run.yaml | 67 ++++++++++++++++++ 7 files changed, 261 insertions(+) create mode 100755 devstack/upgrade/resources.sh create mode 100644 devstack/upgrade/settings create mode 100755 devstack/upgrade/shutdown.sh create mode 100755 devstack/upgrade/upgrade.sh create mode 100644 playbooks/legacy/grenade-devstack-murano/post.yaml create mode 100644 playbooks/legacy/grenade-devstack-murano/run.yaml diff --git a/.zuul.yaml b/.zuul.yaml index 14f25780c..90db59141 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -15,6 +15,7 @@ - murano-rally-task - murano-tempest-api - murano-tempest-cfapi + - murano-grenade gate: queue: murano jobs: @@ -109,3 +110,27 @@ devstack_services: murano-cfapi: true tempest_test_regex: service_broker + +- job: + name: murano-grenade + parent: legacy-dsvm-base + timeout: 10800 + voting: false + run: playbooks/legacy/grenade-devstack-murano/run.yaml + post-run: playbooks/legacy/grenade-devstack-murano/post.yaml + irrelevant-files: + - ^(test-|)requirements.txt$ + - ^setup.cfg$ + - ^doc/.*$ + - ^.*\.rst$ + - ^releasenotes/.*$ + - ^murano/tests/.*$ + required-projects: + - openstack-dev/grenade + - openstack-infra/devstack-gate + - openstack/heat + - openstack/murano + - openstack/murano-dashboard + - openstack/python-heatclient + - openstack/python-muranoclient + - openstack/murano-tempest-plugin diff --git a/devstack/upgrade/resources.sh b/devstack/upgrade/resources.sh new file mode 100755 index 000000000..56b217654 --- /dev/null +++ b/devstack/upgrade/resources.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +set -o errexit + +source $GRENADE_DIR/grenaderc +source $GRENADE_DIR/functions + +source $TOP_DIR/openrc admin demo + +set -o xtrace + +function create { + # add later + : +} + +function verify_noapi { + # currently no good way + : +} + +function verify { + # add later + : +} + +function destroy { + # add later + : +} + +# Dispatcher +case $1 in + "create") + create + ;; + "verify_noapi") + verify_noapi + ;; + "verify") + verify + ;; + "destroy") + destroy + ;; + "force_destroy") + set +o errexit + destroy + ;; +esac diff --git a/devstack/upgrade/settings b/devstack/upgrade/settings new file mode 100644 index 000000000..5bf9c5267 --- /dev/null +++ b/devstack/upgrade/settings @@ -0,0 +1,11 @@ +register_project_for_upgrade murano +register_db_to_save murano + +devstack_localrc base enable_plugin murano https://git.openstack.org/openstack/murano +devstack_localrc target enable_plugin murano https://git.openstack.org/openstack/murano + +devstack_localrc base enable_service murano-api murano-engine +devstack_localrc target enable_service murano-api murano-engine + +BASE_RUN_SMOKE=False +TARGET_RUN_SMOKE=False diff --git a/devstack/upgrade/shutdown.sh b/devstack/upgrade/shutdown.sh new file mode 100755 index 000000000..19edf0e7b --- /dev/null +++ b/devstack/upgrade/shutdown.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +set -o errexit + +source $GRENADE_DIR/grenaderc +source $GRENADE_DIR/functions + +# We need base DevStack functions for this +source $BASE_DEVSTACK_DIR/functions +source $BASE_DEVSTACK_DIR/stackrc # needed for status directory +source $BASE_DEVSTACK_DIR/lib/tls +source $BASE_DEVSTACK_DIR/lib/apache + +MURANO_DEVSTACK_DIR=$(dirname $(dirname $0)) +source $MURANO_DEVSTACK_DIR/settings +source $MURANO_DEVSTACK_DIR/plugin.sh + +set -o xtrace + +stop_murano + +# sanity check that service is actually down +ensure_services_stopped murano-api murano-engine diff --git a/devstack/upgrade/upgrade.sh b/devstack/upgrade/upgrade.sh new file mode 100755 index 000000000..94fc7ea01 --- /dev/null +++ b/devstack/upgrade/upgrade.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash + +# ``upgrade-murano`` + +echo "*********************************************************************" +echo "Begin $0" +echo "*********************************************************************" + +# Clean up any resources that may be in use +cleanup() { + set +o errexit + + echo "********************************************************************" + echo "ERROR: Abort $0" + echo "********************************************************************" + + # Kill ourselves to signal any calling process + trap 2; kill -2 $$ +} + +trap cleanup SIGHUP SIGINT SIGTERM + +# Keep track of the grenade directory +RUN_DIR=$(cd $(dirname "$0") && pwd) + +# Source params +source $GRENADE_DIR/grenaderc + +# Import common functions +source $GRENADE_DIR/functions + +# This script exits on an error so that errors don't compound and you see +# only the first error that occurred. +set -o errexit + +# Upgrade murano +# ============== + +# Get functions from current DevStack +source $TARGET_DEVSTACK_DIR/stackrc +source $TARGET_DEVSTACK_DIR/lib/apache +source $TARGET_DEVSTACK_DIR/lib/tls +source $(dirname $(dirname $BASH_SOURCE))/settings +source $(dirname $(dirname $BASH_SOURCE))/plugin.sh + +# Print the commands being run so that we can see the command that triggers +# an error. It is also useful for following allowing as the install occurs. +set -o xtrace + +# Save current config files for posterity +[[ -d $SAVE_DIR/etc.murano ]] || cp -pr $MURANO_CONF_DIR $SAVE_DIR/etc.murano + +# Install the target murano +install_murano + +# calls upgrade-murano for specific release +upgrade_project murano $RUN_DIR $BASE_DEVSTACK_BRANCH $TARGET_DEVSTACK_BRANCH + +# Migrate the database +murano-db-manage upgrade || die $LINO "DB migration error" + +start_murano + +# Don't succeed unless the services come up +ensure_services_started murano-api murano-engine + +set +o xtrace +echo "*********************************************************************" +echo "SUCCESS: End $0" +echo "*********************************************************************" diff --git a/playbooks/legacy/grenade-devstack-murano/post.yaml b/playbooks/legacy/grenade-devstack-murano/post.yaml new file mode 100644 index 000000000..e07f5510a --- /dev/null +++ b/playbooks/legacy/grenade-devstack-murano/post.yaml @@ -0,0 +1,15 @@ +- hosts: primary + tasks: + + - name: Copy files from {{ ansible_user_dir }}/workspace/ on node + synchronize: + src: '{{ ansible_user_dir }}/workspace/' + dest: '{{ zuul.executor.log_root }}' + mode: pull + copy_links: true + verify_host: true + rsync_opts: + - --include=/logs/** + - --include=*/ + - --exclude=* + - --prune-empty-dirs diff --git a/playbooks/legacy/grenade-devstack-murano/run.yaml b/playbooks/legacy/grenade-devstack-murano/run.yaml new file mode 100644 index 000000000..537a15143 --- /dev/null +++ b/playbooks/legacy/grenade-devstack-murano/run.yaml @@ -0,0 +1,67 @@ +- hosts: all + name: legacy-grenade-dsvm-watcher + tasks: + + - name: Ensure legacy workspace directory + file: + path: '{{ ansible_user_dir }}/workspace' + state: directory + + - shell: + cmd: | + set -e + set -x + cat > clonemap.yaml << EOF + clonemap: + - name: openstack-infra/devstack-gate + dest: devstack-gate + EOF + /usr/zuul-env/bin/zuul-cloner -m clonemap.yaml --cache-dir /opt/git \ + git://git.openstack.org \ + openstack-infra/devstack-gate + executable: /bin/bash + chdir: '{{ ansible_user_dir }}/workspace' + environment: '{{ zuul | zuul_legacy_vars }}' + + - shell: + cmd: | + set -e + set -x + cat << 'EOF' >>"/tmp/dg-local.conf" + [[local|localrc]] + TEMPEST_PLUGINS='/opt/stack/new/murano-tempest-plugin' + enable_plugin heat git://git.openstack.org/openstack/heat + EOF + executable: /bin/bash + chdir: '{{ ansible_user_dir }}/workspace' + environment: '{{ zuul | zuul_legacy_vars }}' + + - shell: + cmd: | + set -e + set -x + export PYTHONUNBUFFERED=true + export DEVSTACK_GATE_TEMPEST_NOTESTS=1 + export DEVSTACK_GATE_NEUTRON=1 + export PROJECTS="openstack-dev/grenade $PROJECTS" + export PROJECTS="openstack/heat $PROJECTS" + export PROJECTS="openstack/python-heatclient $PROJECTS" + export PROJECTS="openstack/murano $PROJECTS" + export PROJECTS="openstack/murano-dashboard $PROJECTS" + export PROJECTS="openstack/python-muranoclient $PROJECTS" + export PROJECTS="openstack/murano-tempest-plugin $PROJECTS" + export BRANCH_OVERRIDE=default + + export GRENADE_PLUGINRC="enable_grenade_plugin murano https://git.openstack.org/openstack/murano" + export DEVSTACK_GATE_GRENADE=pullup + + + if [ "$BRANCH_OVERRIDE" != "default" ] ; then + export OVERRIDE_ZUUL_BRANCH=$BRANCH_OVERRIDE + fi + + cp devstack-gate/devstack-vm-gate-wrap.sh ./safe-devstack-vm-gate-wrap.sh + ./safe-devstack-vm-gate-wrap.sh + executable: /bin/bash + chdir: '{{ ansible_user_dir }}/workspace' + environment: '{{ zuul | zuul_legacy_vars }}'