Added testservice

This commit is contained in:
Gode, Sebastian 2025-04-15 09:37:52 +00:00
parent 83ecc3ec19
commit 9c9d7ed695
5 changed files with 147 additions and 126 deletions

View File

@ -0,0 +1,13 @@
---
hc_location: usermanual/testservice
html_location: docs/testservice/api-ref
link: /testservice/api-ref/
rst_location: api-ref/source
service_type: testservice
title: User Guide
type: api-ref
cloud_environments:
- name: swiss
visibility: public
pdf_visibility: public
pdf_enabled: true

View File

@ -350,11 +350,9 @@ class Services(object):
res = dict()
res = {}
services = self.all_services
print(services)
for service in services:
if service["service_type"] == service_type:
res = service
print(res)
for repositories in self.all_repositories:
if repositories["service_type"] == service["service_type"]:
res["repositories"] = repositories["repositories"]

View File

@ -64,11 +64,9 @@ commands =
wget -O {toxinidir}/_templates/longtable.tex.jinja https://gitea.eco.tsi-dev.otc-service.com/infra/docs-templates/raw/branch/main/templates/longtable.tex.jinja
wget -O {toxinidir}/_templates/tabular.tex.jinja https://gitea.eco.tsi-dev.otc-service.com/infra/docs-templates/raw/branch/main/templates/tabular.tex.jinja
wget -O {toxinidir}/_templates/tabulary.tex.jinja https://gitea.eco.tsi-dev.otc-service.com/infra/docs-templates/raw/branch/main/templates/tabulary.tex.jinja
{%- for doc in docs %}
{%- if doc.pdf_enabled %}
{[testenv:{{ doc.type }}-pdf-docs]commands}
{%- endif %}
{%- endfor %}
{% endif %}
{% for doc in docs -%}

View File

@ -103,6 +103,7 @@ def create_repo(repo, repo_dir, service):
git_repo = Repo(repo_dir)
git_repo.create_remote("origin", repo_url)
git_repo.remotes.origin.fetch()
git_repo.git.branch("-m", "main")
git_repo.git.push("--set-upstream", "origin", "main")
@ -155,9 +156,7 @@ def main():
else:
services = data.services_with_repos()
print(services)
for service in services:
print(service)
process_repositories(args, service)

View File

@ -56,6 +56,7 @@ def process_repositories(args, service):
doc_requirements_template = env.get_template("doc_requirements.txt.j2")
for repo in service["repositories"]:
if repo["cloud_environments"][0] == args.cloud_environment:
logging.debug(f"Processing repository {repo}")
repo_dir = pathlib.Path(workdir, repo["type"], repo["repo"])
@ -118,7 +119,7 @@ def process_repositories(args, service):
if not target_repo:
logging.info(
f"No repository service {service['service_title']}"
f"for environment {args.target_environment}"
f"for environment {args.target_environment} in cloud_environment {args.cloud_environment}"
)
return
@ -149,6 +150,8 @@ def process_repositories(args, service):
service_docs = list(data.docs_by_service_type(service["service_type"]))
for doc in service_docs:
for cloud_environment in doc["cloud_environments"]:
if cloud_environment["name"] == args.cloud_environment:
logging.debug(f"Analyzing document {doc}")
conf_py_path = pathlib.Path(copy_to, doc["rst_location"], "conf.py")
@ -158,7 +161,6 @@ def process_repositories(args, service):
context = dict(
repo_name=target_repo["repo"],
project=service["service_title"],
# pdf_name=doc["pdf_name"],
title=f"{service['service_title']} - {doc['title']}",
)
if "pdf_name" in doc:
@ -168,7 +170,7 @@ def process_repositories(args, service):
if target_repo.get("type") != "github":
context["git_type"] = target_repo["type"]
if (args.target_environment == "public"
and target_repo["repo"].split("/")[0] == "opentelekomcloud-docs-swiss"):
and args.cloud_environment == "swiss"):
context["html_options"] = dict(
logo_url="https://docs.sc.otc.t-systems.com",
)
@ -177,7 +179,7 @@ def process_repositories(args, service):
logo_url="https://docs.otc.t-systems.com",
)
elif (args.target_environment == "internal"
and target_repo["repo"].split("/")[0] == "docs-swiss"):
and args.cloud_environment == "swiss"):
context["html_options"] = dict(
disable_search=True,
site_name="Internal Documentation Portal",
@ -234,7 +236,7 @@ def process_repositories(args, service):
if target_repo.get("type") != "github":
context["git_type"] = target_repo["type"]
if (args.target_environment == "public"
and target_repo["repo"].split("/")[0] == "opentelekomcloud-docs-swiss"):
and args.cloud_environment == "swiss"):
context["html_options"] = dict(
logo_url="https://docs.sc.otc.t-systems.com",
)
@ -243,7 +245,7 @@ def process_repositories(args, service):
logo_url="https://docs.otc.t-systems.com",
)
elif (args.target_environment == "internal"
and target_repo["repo"].split("/")[0] == "docs-swiss"):
and args.cloud_environment == "swiss"):
context["html_options"] = dict(
disable_search=True,
site_name="Internal Documentation Portal",
@ -289,9 +291,12 @@ def process_repositories(args, service):
"""Update tox.ini"""
context = dict(docs=[])
for doc in service_docs:
for cloud_environment in doc["cloud_environments"]:
if cloud_environment["name"] == args.cloud_environment:
if doc["type"] == "dev":
doc["type"] = "dev-guide"
context["docs"].append(doc)
context["pdf_enabled"] = cloud_environment["pdf_enabled"]
context["target_environment"] = args.target_environment
context["service_type"] = service['service_type']
@ -320,6 +325,8 @@ def process_repositories(args, service):
"""Update zuul.yaml"""
context = dict(docs=[])
for doc in service_docs:
for cloud_environment in doc["cloud_environments"]:
if cloud_environment["name"] == args.cloud_environment:
if doc["type"] == "dev":
doc["type"] = "dev-guide"
context["docs"].append(doc)
@ -451,6 +458,12 @@ def main():
),
help="Commit description for the commit",
)
parser.add_argument(
"--cloud-environment",
required=True,
default="eu_de",
help="Cloud Environment. Default: eu_de",
)
args = parser.parse_args()
logging.basicConfig(level=logging.DEBUG)