2017-04-11 16:24:00 +09:00
|
|
|
#!/usr/bin/env bash
|
2016-03-10 20:24:34 -05:00
|
|
|
|
|
|
|
# Copyright 2016 Hewlett Packard Enterprise Development Company, L.P.
|
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
|
|
|
|
# This script is intended to be run as a periodic proposal bot job
|
|
|
|
# in OpenStack infrastructure, though you can run it as a one-off.
|
|
|
|
#
|
|
|
|
# In order to function correctly, the environment in which the
|
|
|
|
# script runs must have
|
|
|
|
# * a writable doc/source directory relative to the current
|
|
|
|
# working directory
|
|
|
|
# AND ( (
|
|
|
|
# * git
|
|
|
|
# * all git repos meant to be searched for plugins cloned and
|
|
|
|
# at the desired level of up-to-datedness
|
|
|
|
# * the environment variable git_dir pointing to the location
|
|
|
|
# * of said git repositories
|
|
|
|
# ) OR (
|
2019-04-23 19:40:06 +08:00
|
|
|
# * network access to the review.opendev.org Gerrit API
|
2016-03-10 20:24:34 -05:00
|
|
|
# working directory
|
2019-04-23 19:40:06 +08:00
|
|
|
# * network access to https://opendev.org/openstack
|
2016-03-10 20:24:34 -05:00
|
|
|
# ))
|
|
|
|
#
|
2017-09-06 18:31:57 +09:00
|
|
|
# If a file named doc/source/data/tempest-plugins-registry.header or
|
|
|
|
# doc/source/data/tempest-plugins-registry.footer is found relative to the
|
2016-03-10 20:24:34 -05:00
|
|
|
# current working directory, it will be prepended or appended to
|
|
|
|
# the generated reStructuredText plugins table respectively.
|
|
|
|
|
2017-04-11 16:24:00 +09:00
|
|
|
set -ex
|
|
|
|
|
2016-03-10 20:24:34 -05:00
|
|
|
(
|
2017-09-06 18:31:57 +09:00
|
|
|
if [[ -r doc/source/data/tempest-plugins-registry.header ]]; then
|
|
|
|
cat doc/source/data/tempest-plugins-registry.header
|
2016-03-10 20:24:34 -05:00
|
|
|
fi
|
|
|
|
|
|
|
|
sorted_plugins=$(python tools/generate-tempest-plugins-list.py)
|
|
|
|
|
2018-07-27 09:31:16 +00:00
|
|
|
name_col_len=$(echo "${sorted_plugins}" | wc -L)
|
2018-07-26 18:23:36 +05:30
|
|
|
name_col_len=$(( name_col_len + 20 ))
|
2018-07-27 09:31:16 +00:00
|
|
|
|
|
|
|
# Print the title underline for a RST table.
|
|
|
|
function title_underline {
|
|
|
|
printf "== "
|
|
|
|
local len=$1
|
|
|
|
while [[ $len -gt 0 ]]; do
|
|
|
|
printf "="
|
|
|
|
len=$(( len - 1))
|
|
|
|
done
|
|
|
|
printf " ===\n"
|
|
|
|
}
|
|
|
|
|
2019-07-30 18:02:07 +09:00
|
|
|
function print_plugin_table {
|
2019-05-23 11:39:02 +02:00
|
|
|
title_underline ${name_col_len}
|
|
|
|
printf "%-3s %-${name_col_len}s %s\n" "SR" "Plugin Name" "URL"
|
|
|
|
title_underline ${name_col_len}
|
|
|
|
|
|
|
|
i=0
|
|
|
|
for plugin in $1; do
|
|
|
|
i=$((i+1))
|
2019-08-15 08:44:30 +08:00
|
|
|
giturl="https://opendev.org/${plugin}"
|
2019-05-23 11:39:02 +02:00
|
|
|
printf "%-3s %-${name_col_len}s %s\n" "$i" "${plugin}" "${giturl}"
|
|
|
|
done
|
|
|
|
|
|
|
|
title_underline ${name_col_len}
|
|
|
|
}
|
|
|
|
|
|
|
|
printf "\n\n"
|
|
|
|
print_plugin_table "${sorted_plugins}"
|
|
|
|
|
|
|
|
printf "\n\n"
|
|
|
|
|
2020-12-24 15:57:53 +00:00
|
|
|
# Print NON_ACTIVE_LIST
|
|
|
|
if [[ -r doc/source/data/tempest-non-active-plugins-registry.header ]]; then
|
|
|
|
cat doc/source/data/tempest-non-active-plugins-registry.header
|
2019-05-23 11:39:02 +02:00
|
|
|
fi
|
|
|
|
|
2020-12-24 15:57:53 +00:00
|
|
|
nonactivelist=$(python tools/generate-tempest-plugins-list.py nonactivelist)
|
|
|
|
name_col_len=$(echo "${nonactivelist}" | wc -L)
|
2019-05-23 11:39:02 +02:00
|
|
|
name_col_len=$(( name_col_len + 20 ))
|
|
|
|
|
2018-07-27 09:31:16 +00:00
|
|
|
printf "\n\n"
|
2020-12-24 15:57:53 +00:00
|
|
|
print_plugin_table "${nonactivelist}"
|
2018-07-27 09:31:16 +00:00
|
|
|
|
|
|
|
printf "\n\n"
|
|
|
|
|
2017-09-06 18:31:57 +09:00
|
|
|
if [[ -r doc/source/data/tempest-plugins-registry.footer ]]; then
|
|
|
|
cat doc/source/data/tempest-plugins-registry.footer
|
2016-03-10 20:24:34 -05:00
|
|
|
fi
|
2020-05-04 20:52:01 -05:00
|
|
|
) > doc/source/plugins/plugin-registry.rst
|
2016-03-10 20:24:34 -05:00
|
|
|
|
|
|
|
if [[ -n ${1} ]]; then
|
2020-05-04 20:52:01 -05:00
|
|
|
cp doc/source/plugins/plugin-registry.rst ${1}/doc/source/plugins/plugin-registry.rst
|
2016-03-10 20:24:34 -05:00
|
|
|
fi
|