Added search index params on confpy
All checks were successful
gl/check check status: success (22594ecced0a120cf22542ea5dcdcc32b1bd37cc)

This commit is contained in:
SebastianGode 2023-05-24 11:17:43 +02:00
parent c6f3bc7e0c
commit 22594ecced
2 changed files with 23 additions and 1 deletions

View File

@ -37,6 +37,15 @@ otcdocs_git_fqdn = '{{ git_fqdn }}'
otcdocs_git_type = '{{ git_type }}' otcdocs_git_type = '{{ git_type }}'
{%- endif %} {%- endif %}
# Those variables are needed for indexing into OpenSearch
otcdocs_doc_environment = '{{ doc_environment }}'
otcdocs_doc_link = '{{ doc_link }}'
otcdocs_doc_title = '{{ doc_title }}'
otcdocs_doc_type = '{{ doc_type }}'
otcdocs_service_title = '{{ service_title }}'
otcdocs_service_type = '{{ service_type }}'
otcdocs_service_category = '{{ service_category }}'
# If extensions (or modules to document with autodoc) are in another directory, # If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the # add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here. # documentation root, use os.path.abspath to make it absolute, like shown here.

View File

@ -150,6 +150,14 @@ def process_repositories(args, service):
site_name="Internal Documentation Portal", site_name="Internal Documentation Portal",
logo_url="https://docs-int.otc-service.com", logo_url="https://docs-int.otc-service.com",
) )
context["doc_environment"] = args.target_environment
context["doc_link"] = doc['link']
context["doc_title"] = doc['title']
context["doc_type"] = doc['type']
context["service_title"] = service['service_title']
context["service_type"] = service['service_type']
context["service_category"] = service['service_category']
conf_py_content = conf_py_template.render(**context) conf_py_content = conf_py_template.render(**context)
with open(conf_py_path, "w", encoding="utf-8", newline="") as out: with open(conf_py_path, "w", encoding="utf-8", newline="") as out:
logging.debug(f"Generating {conf_py_path} from template...") logging.debug(f"Generating {conf_py_path} from template...")
@ -251,7 +259,7 @@ def process_repositories(args, service):
if args.branch_force: if args.branch_force:
push_args.append("--force") push_args.append("--force")
repo_to.git.push(*push_args) repo_to.git.push(*push_args)
if "github" in url_to: if "github" in url_to and args.open_gh_pr:
subprocess.run( subprocess.run(
args=["gh", "pr", "create", "-f"], cwd=copy_to, check=False args=["gh", "pr", "create", "-f"], cwd=copy_to, check=False
) )
@ -337,6 +345,11 @@ def main():
), ),
help="Commit description for the commit", help="Commit description for the commit",
) )
parser.add_argument(
"--open-gh-pr",
action="store_true",
help="Whether to open a PR on GitHub"
)
args = parser.parse_args() args = parser.parse_args()
logging.basicConfig(level=logging.DEBUG) logging.basicConfig(level=logging.DEBUG)