diff --git a/tools/generate_doc_confpy.py b/tools/generate_doc_confpy.py index 7c3a5c9..637d7bc 100644 --- a/tools/generate_doc_confpy.py +++ b/tools/generate_doc_confpy.py @@ -150,6 +150,23 @@ def process_repositories(args, service): site_name="Internal Documentation Portal", 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) with open(conf_py_path, "w", encoding="utf-8", newline="") as out: 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", service_type=service["service_type"] ) + context["service_category"] = service['service_category'] + context["service_title"] = service['service_title'] if not copy_path.exists(): logging.info("Path for sbv does not exist") copy_path.mkdir(parents=True, exist_ok=True) @@ -248,7 +267,7 @@ def process_repositories(args, service): args.commit_description ) push_args = ["--set-upstream", "origin", branch_name] - if args.branch_force: + if args.force_push: push_args.append("--force") repo_to.git.push(*push_args) if "github" in url_to: @@ -328,6 +347,11 @@ def main(): help=("Whether to overwrite index.rst for service-based-view." + "\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( "--commit-description", default=(