From c9e2d3f7cf618b432edbc0e9035a5008093428f2 Mon Sep 17 00:00:00 2001 From: Wojtek Porczyk Date: Fri, 29 Nov 2024 10:07:18 +0100 Subject: [PATCH] [Docs] Fix `--branch` magic to not collide variable with sphinx tags A mistake was made in commit c9dca72ffe888e7e0a936bc15b2b2e448db075eb ("[Docs] quickstart: Add specific checkout to stable versions") that the variable name (`tags`) was chosen to collide with Sphinx' special configuration variable: https://www.sphinx-doc.org/en/master/usage/configuration.html#project-tags This went unnoticed, because at the time we were not using project tags. Later, in commit 6ebc605de8c07a9227afab12e227219781404c16 ("[Docs] Update sphinx to 5.3"), we started using this feature. The mistake was still unnoticed, because the stable checkout was under condition that is true only rarely. Fixes: c9dca72ffe88 ("[Docs] quickstart: Add specific checkout to stable versions") Fixes: 6ebc605de8c0 ("[Docs] Update sphinx to 5.3") Signed-off-by: Wojtek Porczyk --- .ci/docs.jenkinsfile | 9 ++++++++- Documentation/conf.py | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/.ci/docs.jenkinsfile b/.ci/docs.jenkinsfile index f6984debe5..197343e055 100644 --- a/.ci/docs.jenkinsfile +++ b/.ci/docs.jenkinsfile @@ -5,7 +5,14 @@ pipeline { stages { stage('build') { steps { - sh 'make -C Documentation html SPHINXOPTS="-W"' + sh ''' + cd Documentation + git tag vTEST-FOR-DOCS-PIPELINE + READTHEDOCS=1 READTHEDOCS_VERSION=stable make html SPHINXOPTS="-W"' + make clean + git tag -d vTEST-FOR-DOCS-PIPELINE + make html SPHINXOPTS="-W"' + ''' } } } diff --git a/Documentation/conf.py b/Documentation/conf.py index 8356a00e47..cc00ed1eaf 100644 --- a/Documentation/conf.py +++ b/Documentation/conf.py @@ -89,10 +89,10 @@ elif rtd_current_version == 'stable': # we don't have a version, we may be able to check from git try: - tags = [tag for tag in subprocess.check_output( + git_tags = [tag for tag in subprocess.check_output( ['git', 'tag', '--points-at']).decode().strip().split() if tag.startswith('v')] - rst_stable_checkout = f'--branch {tags.pop()}' + rst_stable_checkout = f'--branch {git_tags.pop()}' except (subprocess.CalledProcessError, IndexError): pass