Skip to content

Commit 7e1aa5e

Browse files
Zuulopenstack-gerrit
authored andcommitted
Merge "docs: Parameterize kolla-ansible version and branch" into stable/victoria
2 parents f8cf81b + 1c03191 commit 7e1aa5e

File tree

2 files changed

+41
-4
lines changed

2 files changed

+41
-4
lines changed

doc/source/conf.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,3 +104,36 @@
104104
'swift',
105105
'watcher',
106106
]
107+
108+
# Global variables
109+
# For replacement, use in docs as |VAR_NAME| (note there's no space around variable name)
110+
# When adding new variables, make sure you add them to GLOBAL_VARIABLE_MAP dictionary as well
111+
112+
KOLLA_ANSIBLE_MAJOR_VERSION = '9'
113+
114+
# use 'master' or release name, e.g. 'victoria', 'xena' etc.
115+
KOLLA_OPENSTACK_RELEASE = 'master'
116+
117+
if KOLLA_OPENSTACK_RELEASE == 'master':
118+
KOLLA_BRANCH_NAME = KOLLA_OPENSTACK_RELEASE
119+
else:
120+
KOLLA_BRANCH_NAME = 'stable/{}'.format(KOLLA_OPENSTACK_RELEASE)
121+
122+
GLOBAL_VARIABLE_MAP = {
123+
"|KOLLA_ANSIBLE_MAJOR_VERSION|": KOLLA_ANSIBLE_MAJOR_VERSION,
124+
"|KOLLA_OPENSTACK_RELEASE|": KOLLA_OPENSTACK_RELEASE,
125+
"|KOLLA_BRANCH_NAME|": KOLLA_BRANCH_NAME,
126+
}
127+
128+
def replace_global_vars(app, docname, source):
129+
# unlike rst_epilog, replaces variables (strings) in code blocks as well
130+
# thanks to https://github.com/sphinx-doc/sphinx/issues/4054#issuecomment-329097229
131+
result = source[0]
132+
for key in app.config.GLOBAL_VARIABLE_MAP:
133+
result = result.replace(key, app.config.GLOBAL_VARIABLE_MAP[key])
134+
source[0] = result
135+
136+
137+
def setup(app):
138+
app.add_config_value('GLOBAL_VARIABLE_MAP', {}, True)
139+
app.connect('source-read', replace_global_vars)

doc/source/user/quickstart.rst

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,19 +149,23 @@ Install Kolla-ansible
149149
Install Kolla-ansible for deployment or evaluation
150150
--------------------------------------------------
151151

152+
For a list of ``kolla-ansible`` versions compatible with each OpenStack release
153+
see `Kolla Ansible release notes
154+
<https://docs.openstack.org/releasenotes/kolla-ansible/>`__.
155+
152156
#. Install kolla-ansible and its dependencies using ``pip``.
153157

154158
If using a virtual environment:
155159

156160
.. code-block:: console
157161
158-
pip install kolla-ansible
162+
pip install 'kolla-ansible == |KOLLA_ANSIBLE_MAJOR_VERSION|.*'
159163
160164
If not using a virtual environment:
161165

162166
.. code-block:: console
163167
164-
sudo pip3 install kolla-ansible
168+
sudo pip3 install 'kolla-ansible == |KOLLA_ANSIBLE_MAJOR_VERSION|.*'
165169
166170
#. Create the ``/etc/kolla`` directory.
167171

@@ -206,8 +210,8 @@ Install Kolla for development
206210

207211
.. code-block:: console
208212
209-
git clone https://github.com/openstack/kolla
210-
git clone https://github.com/openstack/kolla-ansible
213+
git clone --branch |KOLLA_BRANCH_NAME| https://opendev.org/openstack/kolla
214+
git clone --branch |KOLLA_BRANCH_NAME| https://opendev.org/openstack/kolla-ansible
211215
212216
#. Install requirements of ``kolla`` and ``kolla-ansible``:
213217

0 commit comments

Comments
 (0)