[gates]Restore the gate for "rally verify"

Found some issues about `rally verify` recently, restore
the gate to do some check.

Change-Id: Ib7f0b098628ce4a5debc4100284dc99558da74a3
This commit is contained in:
chenhb 2019-03-11 17:41:54 +08:00
parent bb9a58becd
commit a3a7c66ff3
6 changed files with 170 additions and 6 deletions

View File

@ -0,0 +1,16 @@
- job:
name: rally-verify-tempest
parent: devstack
required-projects:
- name: openstack-dev/devstack
- name: openstack-infra/devstack-gate
- name: openstack/rally-openstack
- name: openstack/rally
timeout: 7200
roles:
- zuul: openstack-dev/devstack
vars:
devstack_plugins:
rally-openstack: https://git.openstack.org/openstack/rally-openstack
run: tests/ci/playbooks/run-rally-verify.yaml
post-run: tests/ci/playbooks/post-rally-verify.yaml

View File

@ -70,6 +70,7 @@
# watcher-api did not start last time
voting: false
- rally-task-zaqar
- rally-verify-tempest
gate:
jobs:
- rally-tox-pep8
@ -90,3 +91,4 @@
- rally-task-neutron
- rally-task-telemetry
- rally-task-zaqar
- rally-verify-tempest

View File

@ -0,0 +1,93 @@
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Rally | Rally Verification Job Results</title>
<script type="text/javascript"></script>
<style>
body { margin:0; padding:0 0 50px; font-size:14px; font-family:Helvetica,Arial,sans-serif }
a, a:active, a:focus, a:visited { text-decoration:none; outline:none }
p { margin:0; padding:5px 0 }
p.thesis { padding:10px 0 }
h1 { color:#666; margin:0 0 20px; font-size:30px; font-weight:normal }
h2, .h2 { color:#666; margin:24px 0 6px; font-size:25px; font-weight:normal }
h3, .h3 { color:#777; margin:12px 0 4px; font-size:18px; font-weight:normal }
table { border-collapse:collapse; border-spacing:0; width:100%; font-size:12px; margin:0 0 10px }
table th { text-align:left; padding:8px; color:#000; border:2px solid #ddd; border-width:0 0 2px 0 }
table th.sortable { cursor:pointer }
table td { text-align:left; border-top:1px solid #ddd; padding:8px; color:#333 }
table.compact td { padding:4px 8px }
table.striped tr:nth-child(odd) td { background:#f9f9f9 }
table.linked tbody tr:hover { background:#f9f9f9; cursor:pointer }
.pointer { cursor:pointer }
.rich, .rich td { font-weight:bold }
.oblique { font-style:italic }
.code { padding:10px; font-size:13px; color:#333; background:#f6f6f6; border:1px solid #e5e5e5; border-radius:4px }
.header { text-align:left; background:#333; font-size:18px; padding:13px 0; margin-bottom:20px; color:#fff; background-image:linear-gradient(to bottom, #444 0px, #222 100%) }
.header a, .header a:visited, .header a:focus { color:#999 }
.notify-error { padding:5px 10px; background:#fee; color:red }
.status-skip, .status-skip td { color:grey }
.status-pass, .status-pass td { color:green }
.status-fail, .status-fail td { color:red }
.capitalize { text-transform:capitalize }
li { margin:2px 0 }
a, a:visited { color:#039 }
code { padding:0 15px; color:#888; display: block }
.columns li { position:relative }
.columns li > :first-child { display:block }
.columns li > :nth-child(2) { display:block; position:static; left:165px; top:0; white-space:nowrap }
.fail {color: #cc0000}
.error {color: #cc0000}
.success {color: green}
.skip {color: #A9A9A9}
.content-wrap { margin:0 auto; padding:0 5px; margin:0 auto; padding:0 5px }
@media only screen and (min-width: 320px) { .content-wrap { width:400px } }
@media only screen and (min-width: 520px) { .content-wrap { width:500px } }
@media only screen and (min-width: 620px) { .content-wrap { width:90% } .columns li > :nth-child(2) { position:absolute } }
@media only screen and (min-width: 720px) { .content-wrap { width:70% } }
</style>
</head>
<body>
<div class="header" id="page-header">
<div class="content-wrap">
<a href="https://github.com/openstack/rally">Rally</a>&nbsp;
<span>Verify Job Results</span>
</div>
</div>
<div class="content-wrap" id="page-content">
<h2>Logs and Results Files</h2>
<ul class="columns">
<li><a href="job-output.txt.gz">Job logs</a> <code>job-output.txt.gz</code>
<li><a href="zuul-info/">Zuul info</a> <code>zuul-info</code>
<li><a href="controller/logs/">Logs of controller node</a> <code>controller/logs/</code>
<li><a href="ara-report/">ARA | Ansible Run Analysis</a>
<li><a href="rally-verify/">Results files</a> <code>rally-verify/</code>
</ul>
<h2>Steps</h2>
{% for step in steps %}
{{ step|safe }}
{% endfor %}
<h2>About Rally</h2>
<p>Rally is benchmarking and verification system for OpenStack:</p>
<ul>
<li><a href="https://git.openstack.org/cgit/openstack/rally">Git
repository</a> (<a href="https://github.com/openstack/rally">GitHub mirror</a>)
<li><a href="https://rally.readthedocs.io/en/latest/">Documentation</a>
<li><a href="https://rally.readthedocs.io/en/latest/quick_start/index.html">Quick start</a>
<li><a href="https://rally.readthedocs.io/en/latest/quick_start/gates.html">How to add Rally job to your project</a>
</ul>
</div>
</body>
</html>

View File

@ -0,0 +1,27 @@
- hosts: controller
tasks:
- name: Copy the html report
synchronize:
src: '{{ zuul.project.src_dir }}/rally-verify'
dest: '{{ zuul.executor.log_root }}'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/**
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Put index.html in the right place
synchronize:
src: '{{ zuul.project.src_dir }}/rally-verify/extra/index.html'
dest: '{{ zuul.executor.log_root }}/index.html'
mode: pull
copy_links: true
verify_host: true
rsync_opts:
- --include=/**
- --include=*/
- --exclude=*
- --prune-empty-dirs

View File

@ -0,0 +1,16 @@
- hosts: all
roles:
- run-devstack
- hosts: controller
tasks:
- name: Run Rally verify
shell:
cmd: |
cd {{ zuul.project.src_dir }}
. /opt/stack/.rally/openrc admin admin
export OS_CACERT=/opt/stack/data/ca-bundle.pem
rally deployment create --fromenv --name tempest
rally deployment config
python tests/ci/rally_verify.py
executable: /bin/bash

22
tests/ci/rally_verify.py Executable file → Normal file
View File

@ -23,8 +23,9 @@ import subprocess
import sys
import uuid
import jinja2
from rally import api
from rally.ui import utils
LOG = logging.getLogger("verify-job")
LOG.setLevel(logging.DEBUG)
@ -55,7 +56,8 @@ class Step(object):
self.args = args
self.rapi = rapi
self.result = {"status": Status.PASS,
"doc": self.__doc__}
"doc": self.__doc__,
"cmd": "None command found"}
@property
def name(self):
@ -141,7 +143,7 @@ class Step(object):
class SetUpStep(Step):
"""Validate deployment, create required resources and directories."""
DEPLOYMENT_NAME = "devstack"
DEPLOYMENT_NAME = "tempest"
def run(self):
if not os.path.exists("%s/extra" % self.BASE_DIR):
@ -493,6 +495,16 @@ def run(args):
return results.values()
def create_report(results):
template_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),
"pages")
loader = jinja2.FileSystemLoader(template_dir)
env = jinja2.Environment(loader=loader)
template = env.get_template("verify-index.html")
with open(os.path.join(Step.BASE_DIR, "extra/index.html"), "w") as f:
f.write(template.render(steps=results))
def main():
parser = argparse.ArgumentParser(description="Launch rally-verify job.")
parser.add_argument("--mode", type=str, default="light",
@ -514,9 +526,7 @@ def main():
steps = run(args)
results = [step.to_html() for step in steps]
template = utils.get_template("ci/index_verify.html")
with open(os.path.join(Step.BASE_DIR, "extra/index.html"), "w") as f:
f.write(template.render(steps=results))
create_report(results)
if len([None for step in steps
if step.result["status"] == Status.PASS]) == len(steps):