Merge "Remove old IR plugin and old related CI tools"

This commit is contained in:
Zuul 2020-05-12 12:33:33 +00:00 committed by Gerrit Code Review
commit 73ed19ced5
20 changed files with 0 additions and 778 deletions

View File

@ -1,11 +0,0 @@
# Tobiko
Tobiko InfraRed Plugin
Tobiko was created for testing OpenStack Upgrades.
You can find the official project right [here](https://github.com/openstack/tobiko)
## Usage
infrared tobiko --tests neutron

View File

@ -1,21 +0,0 @@
- name: Tobiko Tests Main
hosts: undercloud
gather_facts: yes
any_errors_fatal: yes
vars:
python_ver: python{{ansible_python.version.major}}
tasks:
- name: Install Tobiko
include_tasks: tasks/install.yml
- name: Set up environment configurations
include_tasks: tasks/configure.yml
- name: Run Tobiko
include_tasks: tasks/run.yml
when:
- test.tests is defined
- name: Collect Tobiko logs and reports
include_tasks: tasks/report.yml

View File

@ -1,51 +0,0 @@
---
config:
plugin_type: test
entry_point: main.yml
subparsers:
tobiko:
description: Executes Tobiko Framework
include_groups: ["Ansible options", "Inventory", "Common options", "Answers file"]
groups:
- title: Stages Control
options:
install:
type: Bool
help: |
Install Tobiko
- title: Install Options
options:
dir:
type: Value
default: "{{ ansible_env.HOME }}/tobiko"
help: |
The directory where Tobiko will be installed and used
overcloudrc:
type: Value
default: "{{ ansible_env.HOME }}/overcloudrc"
help: |
The path to the overcloudrc file
floating_network:
type: Value
default: "public"
help: |
Name of overcloud's floating_network
tests:
type: Value
help: |
The set of tests to execute
default: scenario
results_dir_suffix:
type: Value
help: |
Suffix string to add to tobiko_results dir
example : default will be tobiko_results_1st
default: "1st"
refsec:
type: Value
help: |
specific gerrit patch refsec to
checkout, example:
--refsec refs/changes/66/665966/7
default: ''

View File

@ -1,15 +0,0 @@
- name: Set up Overcloud resources create ssh keys
shell: |
test -f ~/.ssh/id_rsa||ssh-keygen -f ~/.ssh/id_rsa -P ''
- name: Create tobiko configuration file
template:
src: "templates/tobiko.conf.j2"
dest: "{{ test.dir }}/tobiko.conf"
mode: 0755
- name: Set permissive quotas for instances and cores
shell: |
source "{{ test.overcloudrc }}"
openstack quota set --instances -1 admin
openstack quota set --cores -1 admin

View File

@ -1,41 +0,0 @@
- name: Install pip using get-pip.py
become: yes
shell: |
curl https://bootstrap.pypa.io/get-pip.py | {{ python_ver }}
- name: Install required packages
become: yes
vars:
required_packages: ["{{ python_ver }}-virtualenv", 'git', 'gcc', "{{
python_ver }}-devel", 'wget']
yum:
name: "{{ required_packages }}"
state: present
- name: "Ensure {{ test.dir }} doesn't exist"
file:
path: "{{ test.dir }}"
state: absent
- name: Clone Tobiko project
git:
repo: 'https://review.opendev.org/x/tobiko'
dest: "{{ test.dir }}"
when: test.refsec == ''
- name: Checkout specific gerrit patch
git:
repo: 'https://review.opendev.org/x/tobiko'
dest: "{{ test.dir }}"
refspec: "{{ test.refsec }}"
version: 'FETCH_HEAD'
when: test.refsec != ''
- name: output gerrit patch log
shell: |
git log -n 1
register: git_log
args:
chdir: "{{ test.dir }}"
- debug: var=git_log.stdout_lines

View File

@ -1,19 +0,0 @@
---
- name: Create Tobiko report
shell:
chdir: "{{ test.dir }}"
cmd: |
source "{{ test.overcloudrc }}"
bash -x tools/ci/tox -e report
- fetch:
src: "{{ test.dir }}/{{ item }}"
dest: "{{ inventory_dir }}/tobiko_results_{{ test.results_dir_suffix }}/"
flat: yes
loop:
- tobiko.conf
- tobiko.log
- tobiko_results.html
- tobiko_results.xml

View File

@ -1,9 +0,0 @@
---
- name: Run Tobiko Tests
ignore_errors: True
shell:
chdir: "{{ test.dir }}"
cmd: |
source "{{ test.overcloudrc }}"
bash -x tools/ci/tox -e "{{ test.tests }}"

View File

@ -1,18 +0,0 @@
[DEFAULT]
#debug = true
log_file = "{{ test.dir }}/tobiko.log"
log_dir = .
[nova]
key_file = ~/.ssh/id_rsa
[neutron]
floating_network = "{{ test.floating_network }}"
[ssh]
key_file = ~/.ssh/id_rsa
undercloud_ssh_password = stack
undercloud_ssh_username = stack
[tripleo]
undercloud_ssh_hostname = undercloud-0

View File

@ -1,34 +0,0 @@
function get_ci_tools_dir {
local tools_dir=$(dirname "${BASH_SOURCE[0]}")
realpath "${tools_dir}"
}
function realpath {
${REALPATH} "$@"
}
function get_realpath {
(
export PATH=${CI_TOOLS_ORIGINAL_PATH:-${PATH}}
local tools_dir=$(dirname "${BASH_SOURCE[0]}")
local python=$(which python3 || which python2 || which python)
if [ -x "${python}" ] && "${python}" --version > /dev/null; then
local script="${tools_dir}/realpath.py"
local script=$("${python}" "${script}" "${script}")
echo "${python}" "${script}"
else
echo "Python command not found!" 1>&2
exit 1
fi
)
}
export REALPATH=${REALPATH:-$(get_realpath)}
export CI_TOOLS_DIR=${CI_TOOLS_DIR:-$(get_ci_tools_dir)}
export CI_TOOLS_ORIGINAL_PATH=${CI_TOOLS_ORIGINAL_PATH:-${PATH}}
export PATH=${CI_TOOLS_DIR}:${PATH}
export PYTHONWARNINGS=${PYTHONWARNINGS:-ignore}

View File

@ -1,18 +0,0 @@
#!/bin/bash
set -eu
source $(dirname "$0")/activate
source $(dirname "$0")/os
function fixture {
os_setup
tobiko-fixture "$@"
}
if [ $(basename "$0") == fixture ]; then
fixture "$@"
fi

View File

@ -1,93 +0,0 @@
#!/bin/bash
source $(dirname "$0")/activate
source $(dirname "$0")/tox
set -eu
if [ "${IR_DEBUG:-}" != "" ]; then
set -x
fi
IR_VIRTUAL_ENV=$(realpath "${IR_VIRTUAL_ENV:-.tox/infrared}")
IR_REPO="https://github.com/redhat-openstack/infrared.git"
IR_BRANCH=${IR_BRANCH:-master}
IR_SOURCE_DIR=$(realpath "${IR_SOURCE_DIR:-${IR_VIRTUAL_ENV}/infrared}")
IR_EXECUTABLE=${IR_VIRTUAL_ENV}/bin/infrared
export IR_HOME=$(realpath ${IR_HOME:-$(pwd)/.infrared/})
IR_TOBIKO_PLUGIN=$(realpath ${IR_TOBIKO_PLUGIN:-$(pwd)/roles/infrared})
IR_WORKSPACE_FILE=${IR_WORKSPACE_FILE:-$(realpath ./workspace.tgz)}
IR_WORKSPACE_URL=${IR_WORKSPACE_URL:-}
function ir {
ir_setup
"${IR_EXECUTABLE}" "$@"
}
function ir_setup {
if ! ir_activate; then
tox -e infrared --notest
ir_activate
fi
if ! [ -x "${IR_EXECUTABLE}" ]; then
git clone "${IR_REPO}" -b "${IR_BRANCH}" "${IR_SOURCE_DIR}"
local package_name
for package_name in pip setuptools "${IR_SOURCE_DIR}"; do
pip install --upgrade "${package_name}"
done
# Cleanup IR workspaces
rm -fR "${IR_HOME}"
(
# IR requires to work from its source folder
cd "${IR_SOURCE_DIR}"
# Install IR plugins
"${IR_EXECUTABLE}" plugin list --available --versions || true
"${IR_EXECUTABLE}" plugin add "${IR_TOBIKO_PLUGIN}"
# Import IR workspace
if [ "${IR_WORKSPACE_URL}" != "" ]; then
local temp_file=$(mktemp)
curl "${IR_WORKSPACE_URL}" -o "${temp_file}"
mkdir -p $(dirname "${IR_WORKSPACE_FILE}")
mv "${temp_file}" "${IR_WORKSPACE_FILE}"
fi
if [ -f "${IR_WORKSPACE_FILE}" ]; then
"${IR_EXECUTABLE}" workspace import "${IR_WORKSPACE_FILE}"
fi
)
fi
mkdir -p "${IR_HOME}"
}
function ir_activate {
local venv_script=${IR_VIRTUAL_ENV}/bin/activate
if ! [ -r "${venv_script}" ]; then
return 1
fi
if ! ir_is_active; then
# Activate only once
set +eu
source "${venv_script}"
set -eu
ir_is_active
fi
}
function ir_is_active {
[ "$(python_prefix)" == "${IR_VIRTUAL_ENV}" ]
}
if [ $(basename "$0") == ir ]; then
ir "$@"
fi

View File

@ -1,18 +0,0 @@
#!/bin/bash
set -eu
source $(dirname "$0")/activate
source $(dirname "$0")/os
function keystone_credentials {
os_setup
tobiko-keystone-credentials "$@"
}
if [ $(basename "$0") == keystone-credentials ]; then
keystone_credentials "$@"
fi

View File

@ -1,50 +0,0 @@
#!/bin/bash
# Produce test HTML report file into ${REPORT_DIR}
set -eu
# Imput paths
TOBIKO_TOX_DIR=${TOBIKO_TOX_DIR:-$(pwd)}
# Output dirs
TOBIKO_TEST_REPORT_DIR=${TOBIKO_TEST_REPORT_DIR:-${TOBIKO_TOX_DIR}}
# Output files
TOBIKO_TEST_REPORT_NAME=${TOBIKO_TEST_REPORT_NAME:-tobiko_results}
TOBIKO_TEST_REPORT_SUBUNIT=${TOBIKO_TEST_REPORT_SUBUNIT:-${TOBIKO_TEST_REPORT_DIR}/${TOBIKO_TEST_REPORT_NAME}.subunit}
TOBIKO_TEST_REPORT_HTML=${TOBIKO_TEST_REPORT_HTML:-${TOBIKO_TEST_REPORT_DIR}/${TOBIKO_TEST_REPORT_NAME}.html}
TOBIKO_TEST_REPORT_XML=${TOBIKO_TEST_REPORT_XML:-${TOBIKO_TEST_REPORT_DIR}/${TOBIKO_TEST_REPORT_NAME}.xml}
function make_report() {
if [[ -f .stestr/failing ]]; then
make_report_subunit
make_report_html
make_report_xml
fi
}
function make_report_subunit() {
mkdir -p $(dirname "${TOBIKO_TEST_REPORT_SUBUNIT}")
(
cd "${TOBIKO_TOX_DIR}"
stestr last --subunit --force-subunit-trace --all-attachments
) > "${TOBIKO_TEST_REPORT_SUBUNIT}"
}
function make_report_html() {
mkdir -p $(dirname "${TOBIKO_TEST_REPORT_HTML}")
subunit2html "${TOBIKO_TEST_REPORT_SUBUNIT}" "${TOBIKO_TEST_REPORT_HTML}" > /dev/null
}
function make_report_xml() {
mkdir -p $(dirname "${TOBIKO_TEST_REPORT_XML}")
subunit2junitxml "${TOBIKO_TEST_REPORT_SUBUNIT}" -o "${TOBIKO_TEST_REPORT_XML}" || true
}
make_report

View File

@ -1,51 +0,0 @@
#!/bin/bash
set -eu
source $(dirname "$0")/activate
OS_VIRTUAL_ENV=$(realpath "${OS_VIRTUAL_ENV:-.tox/scenario}")
function os {
os_setup
openstack "$@"
}
function os_setup {
if ! os_activate; then
# Cleanup and create virtualenv directory
tox -r -e venv --notest
os_activate
fi
}
function os_activate {
local venv_script=${OS_VIRTUAL_ENV}/bin/activate
if ! [ -r "${venv_script}" ]; then
return 1
fi
if ! os_is_active; then
# Activate only once
set +eu
source "${venv_script}"
set -eu
os_is_active
fi
}
function os_is_active {
[ "$(python_prefix)" == "${OS_VIRTUAL_ENV}" ]
}
if [ $(basename "$0") == os ]; then
os "$@"
fi

View File

@ -1,70 +0,0 @@
#!/bin/bash
source $(dirname "$0")/activate
PYTHON_VERSION=${PYTHON_VERSION:-}
function python() {
# call get_python_exe only the first time it is required
export PYTHON_EXECUTABLE=${PYTHON_EXECUTABLE:-$(python_executable)}
if [ -x "${PYTHON_EXECUTABLE}" ]; then
"${PYTHON_EXECUTABLE}" "$@"
else
exit 1
fi
}
function python_executable() {
local version=${PYTHON_VERSION:-}
local executables=( $( list_python_executables ) )
for executable in "${executables[@]}"; do
if "${executable}" -c "${SELECT_PYTHON_EXECUTABLE_SCRIPT}" "${version}"; then
echo "${executable}"
exit 0
fi
done
fail 1 "No such Python executable (PYTHON_VERSION=${PYTHON_VERSION})"
}
function list_python_executables() {
PATH=${CI_TOOLS_ORIGINAL_PATH} which $(list_python_names) 2> /dev/null
}
function list_python_names() {
local version=${PYTHON_VERSION}
if [ "${version}" != "" ]; then
echo "python${version}"
fi
echo python3.7
echo python3.6
echo python3
echo python
}
function fail() {
local error=$1
shift
echo "$@" 1>&2
exit "${error}"
}
read -r -d '' SELECT_PYTHON_EXECUTABLE_SCRIPT << END_OF_SCRIPT
import sys
version = ".".join(str(i) for i in sys.version_info[:3])
if version.startswith(sys.argv[1]):
exit(0)
else:
exit(1)
END_OF_SCRIPT
if [ $(basename "$0") == python ]; then
set -euo pipefail
python "$@"
fi

View File

@ -1,25 +0,0 @@
#!/usr/bin/env python
import argparse
import os
import sys
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--base",
action="store_true",
help="print Python base prefix")
args = parser.parse_args()
prefix = get_python_prefix(base=args.base)
sys.stdout.write(prefix + '\n')
def get_python_prefix(base=False):
prefix = base and getattr(sys, 'base_prefix', None) or sys.prefix
return os.path.realpath(prefix)
if __name__ == '__main__':
main()

View File

@ -1,35 +0,0 @@
#!/usr/bin/env python
import argparse
import os
import sys
def get_python_version():
return '.'.join(str(i) for i in sys.version_info[:3])
def main():
parser = argparse.ArgumentParser(description='Print Python version')
parser.add_argument('--check-prefix', action='store_const', const=True,
default=False,
help='check version matches $PYTHON_VERSION prefix')
args = parser.parse_args()
version = get_python_version()
if args.check_prefix:
expected_version = os.environ.get('PYTHON_VERSION')
if expected_version and not version.startswith(expected_version):
message = ("Version {version!r} must starts with"
" {expected_version!r}\n").format(
version=version,
expected_version=expected_version)
sys.stderr.write(message)
sys.exit(1)
sys.stdout.write(version + '\n')
if __name__ == '__main__':
main()

View File

@ -1,9 +0,0 @@
#!/usr/bin/env python
import os
import sys
args = sys.argv[1:] or ['.']
results = [os.path.realpath(a) for a in args]
output = '\n'.join(results) + '\n'
sys.stdout.write(output)

View File

@ -1,165 +0,0 @@
#!/bin/bash
set -eu
source $(dirname "$0")/activate
export PYTHON_VERSION=${PYTHON_VERSION:-}
export TOX_BASE_PYTHON=${TOX_BASE_PYTHON:-${CI_TOOLS_DIR}/python}
export TOX_VIRTUAL_ENV=$(realpath "${TOX_VIRTUAL_ENV:-.tox/tox}")
BINDEP=${BINDEP:-}
BINDEP_FILE=${BINDEP_FILE:-$(pwd)/bindep.txt}
function tox {
tox_setup 1>&2
"${TOX_VIRTUAL_ENV}/bin/tox" "$@"
}
function tox_python {
"${TOX_VIRTUAL_ENV}/bin/python" "$@"
}
function tox_pip {
"${TOX_VIRTUAL_ENV}/bin/pip" "$@"
}
function tox_setup {
if ! tox_activate; then
tox_install_deps
# Cleanup and create virtualenv directory
rm -fR "${TOX_VIRTUAL_ENV}"
mkdir -p $(dirname "${TOX_VIRTUAL_ENV}")
"${TOX_BASE_PYTHON}" -m virtualenv --seeder pip "${TOX_VIRTUAL_ENV}"
# Activate virtualenv
tox_activate
# Install binary packages
tox_install_bindeps
# Install/upgrade the last Python packages into the new virutalenv
curl https://bootstrap.pypa.io/get-pip.py | tox_python
tox_pip install --upgrade setuptools wheel virtualenv tox
fi
}
function tox_install_deps {
tox_install_pip
local options="--upgrade"
if [ "${VIRTUAL_ENV:-}" == "" ]; then
options="${options} --user"
fi
"${TOX_BASE_PYTHON}" -m pip install ${options} virtualenv
}
function tox_install_pip {
if ! "${TOX_BASE_PYTHON}" -m pip --version; then
if which apt-get && ! "${TOX_BASE_PYTHON}" -c 'import distutils.util'; then
# Workaround known get-pip issue #43:
# https://github.com/pypa/get-pip/issues/43
sudo apt-get update
sudo apt-get install -y python3-distutils
fi
curl https://bootstrap.pypa.io/get-pip.py | "${TOX_BASE_PYTHON}" - --user
fi
}
function tox_activate {
local venv_script=${TOX_VIRTUAL_ENV}/bin/activate
if ! [ -r "${venv_script}" ]; then
return 1
fi
if ! tox_is_active; then
# Activate only once
set +eu
source "${venv_script}"
set -eu
tox_is_active
fi
}
function tox_is_active {
[ "$(python_prefix)" == "${TOX_VIRTUAL_ENV}" ]
}
function tox_install_bindeps {
local bindep_file=${BINDEP_FILE:-$1}
if ! [ -r "${bindep_file}" ]; then
exit 0
fi
# process ${BINDEP_FILE}
local missing_packages=( $(bindep -b -f "${bindep_file}") )
if [ "${#missing_packages[@]}" != "0" ]; then
tox_install_packages "${missing_packages[@]}"
bindep -f "${bindep_file}" || true
fi
}
function bindep {
export BINDEP=${BINDEP:-$(get_bindep)}
"${BINDEP}" "$@"
}
function get_bindep {
if ! which bindep; then
tox_pip install bindep > /dev/null
which bindep
fi
}
function tox_install_packages {
local packages=( "$@" )
if which yum; then
if grep -e '^Red Hat Enterprise Linux' /etc/redhat-release; then
# Ensure *-server-opt repos are enabled
tox_enable_yum_repos '.*-server-opt\/'
fi
# install missing packages
sudo yum install -y "${packages[@]}"
elif which apt-get; then
sudo apt-get update
# install missing packages
sudo apt-get install -y "${packages[@]}"
else
echo -e "Don't know how to install packages this platform"
bindep --profiles 1>&2
fi
}
function tox_enable_yum_repos {
local yum_repos_regex=$1
local yum_repos=( $(yum repolist all |
awk '/'${yum_repos_regex}'/{print $1}' |
xargs -n1 dirname) )
if [ "${#yum_repos[@]}" != 0 ]; then
sudo yum-config-manager --enable "${yum_repos[@]}"
fi
}
if [ $(basename "$0") == tox ]; then
tox "$@"
fi

View File

@ -1,25 +0,0 @@
#!/usr/bin/env python
import json
import io
import sys
import yaml
def main(args=None):
args = args or sys.argv[1:]
if args:
input_stream = io.open(args[0], 'rb')
args = args[1:]
else:
input_stream = sys.stdin
with input_stream:
data = yaml.load(input_stream)
json.dump(data, sys.stdout, indent=4)
if __name__ == '__main__':
main()