fixing tool generate doc confpy to read additional metadata
All checks were successful
gl/check check status: success (6303a57fb8e111d0c37d152734be0abecf0397c7)
gl/gate gate status: success (6303a57fb8e111d0c37d152734be0abecf0397c7)

This commit is contained in:
vladimirhasko 2023-08-16 19:47:36 +00:00
parent d8ed8a0ba4
commit 6303a57fb8

View File

@ -150,6 +150,23 @@ 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
if doc['link']:
context["doc_link"] = doc['link']
else:
context["doc_link"] = (
'/'
+ service['service_uri']
+ '/'
+ doc['type']
+ '/'
)
context["doc_title"] = doc['title']
context["doc_type"] = doc['type']
context["service_category"] = service['service_category']
context["service_title"] = service['service_title']
context["service_type"] = service['service_type']
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...")
@ -167,6 +184,8 @@ def process_repositories(args, service):
title=f"{service['service_title']} - Service Based View", title=f"{service['service_title']} - Service Based View",
service_type=service["service_type"] service_type=service["service_type"]
) )
context["service_category"] = service['service_category']
context["service_title"] = service['service_title']
if not copy_path.exists(): if not copy_path.exists():
logging.info("Path for sbv does not exist") logging.info("Path for sbv does not exist")
copy_path.mkdir(parents=True, exist_ok=True) copy_path.mkdir(parents=True, exist_ok=True)
@ -248,7 +267,7 @@ def process_repositories(args, service):
args.commit_description args.commit_description
) )
push_args = ["--set-upstream", "origin", branch_name] push_args = ["--set-upstream", "origin", branch_name]
if args.branch_force: if args.force_push:
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:
@ -328,6 +347,11 @@ def main():
help=("Whether to overwrite index.rst for service-based-view." help=("Whether to overwrite index.rst for service-based-view."
+ "\nCan only be used if --update-sbv is also specified") + "\nCan only be used if --update-sbv is also specified")
) )
parser.add_argument(
"--force-push",
action="store_true",
help="Whether to force push the commit"
)
parser.add_argument( parser.add_argument(
"--commit-description", "--commit-description",
default=( default=(