Added testservice
This commit is contained in:
parent
83ecc3ec19
commit
9c9d7ed695
13
otc_metadata/data/documents/testservice-api-ref.yaml
Normal file
13
otc_metadata/data/documents/testservice-api-ref.yaml
Normal 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
|
@ -350,11 +350,9 @@ class Services(object):
|
|||||||
res = dict()
|
res = dict()
|
||||||
res = {}
|
res = {}
|
||||||
services = self.all_services
|
services = self.all_services
|
||||||
print(services)
|
|
||||||
for service in services:
|
for service in services:
|
||||||
if service["service_type"] == service_type:
|
if service["service_type"] == service_type:
|
||||||
res = service
|
res = service
|
||||||
print(res)
|
|
||||||
for repositories in self.all_repositories:
|
for repositories in self.all_repositories:
|
||||||
if repositories["service_type"] == service["service_type"]:
|
if repositories["service_type"] == service["service_type"]:
|
||||||
res["repositories"] = repositories["repositories"]
|
res["repositories"] = repositories["repositories"]
|
||||||
|
@ -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/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/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
|
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 %}
|
{%- if doc.pdf_enabled %}
|
||||||
{[testenv:{{ doc.type }}-pdf-docs]commands}
|
{[testenv:{{ doc.type }}-pdf-docs]commands}
|
||||||
{%- endif %}
|
{%- endif %}
|
||||||
{%- endfor %}
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% for doc in docs -%}
|
{% for doc in docs -%}
|
||||||
|
@ -103,6 +103,7 @@ def create_repo(repo, repo_dir, service):
|
|||||||
git_repo = Repo(repo_dir)
|
git_repo = Repo(repo_dir)
|
||||||
git_repo.create_remote("origin", repo_url)
|
git_repo.create_remote("origin", repo_url)
|
||||||
git_repo.remotes.origin.fetch()
|
git_repo.remotes.origin.fetch()
|
||||||
|
git_repo.git.branch("-m", "main")
|
||||||
git_repo.git.push("--set-upstream", "origin", "main")
|
git_repo.git.push("--set-upstream", "origin", "main")
|
||||||
|
|
||||||
|
|
||||||
@ -155,9 +156,7 @@ def main():
|
|||||||
else:
|
else:
|
||||||
services = data.services_with_repos()
|
services = data.services_with_repos()
|
||||||
|
|
||||||
print(services)
|
|
||||||
for service in services:
|
for service in services:
|
||||||
print(service)
|
|
||||||
process_repositories(args, service)
|
process_repositories(args, service)
|
||||||
|
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ def process_repositories(args, service):
|
|||||||
doc_requirements_template = env.get_template("doc_requirements.txt.j2")
|
doc_requirements_template = env.get_template("doc_requirements.txt.j2")
|
||||||
|
|
||||||
for repo in service["repositories"]:
|
for repo in service["repositories"]:
|
||||||
|
if repo["cloud_environments"][0] == args.cloud_environment:
|
||||||
logging.debug(f"Processing repository {repo}")
|
logging.debug(f"Processing repository {repo}")
|
||||||
repo_dir = pathlib.Path(workdir, repo["type"], repo["repo"])
|
repo_dir = pathlib.Path(workdir, repo["type"], repo["repo"])
|
||||||
|
|
||||||
@ -118,7 +119,7 @@ def process_repositories(args, service):
|
|||||||
if not target_repo:
|
if not target_repo:
|
||||||
logging.info(
|
logging.info(
|
||||||
f"No repository service {service['service_title']}"
|
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
|
return
|
||||||
|
|
||||||
@ -149,6 +150,8 @@ def process_repositories(args, service):
|
|||||||
service_docs = list(data.docs_by_service_type(service["service_type"]))
|
service_docs = list(data.docs_by_service_type(service["service_type"]))
|
||||||
|
|
||||||
for doc in service_docs:
|
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}")
|
logging.debug(f"Analyzing document {doc}")
|
||||||
|
|
||||||
conf_py_path = pathlib.Path(copy_to, doc["rst_location"], "conf.py")
|
conf_py_path = pathlib.Path(copy_to, doc["rst_location"], "conf.py")
|
||||||
@ -158,7 +161,6 @@ def process_repositories(args, service):
|
|||||||
context = dict(
|
context = dict(
|
||||||
repo_name=target_repo["repo"],
|
repo_name=target_repo["repo"],
|
||||||
project=service["service_title"],
|
project=service["service_title"],
|
||||||
# pdf_name=doc["pdf_name"],
|
|
||||||
title=f"{service['service_title']} - {doc['title']}",
|
title=f"{service['service_title']} - {doc['title']}",
|
||||||
)
|
)
|
||||||
if "pdf_name" in doc:
|
if "pdf_name" in doc:
|
||||||
@ -168,7 +170,7 @@ def process_repositories(args, service):
|
|||||||
if target_repo.get("type") != "github":
|
if target_repo.get("type") != "github":
|
||||||
context["git_type"] = target_repo["type"]
|
context["git_type"] = target_repo["type"]
|
||||||
if (args.target_environment == "public"
|
if (args.target_environment == "public"
|
||||||
and target_repo["repo"].split("/")[0] == "opentelekomcloud-docs-swiss"):
|
and args.cloud_environment == "swiss"):
|
||||||
context["html_options"] = dict(
|
context["html_options"] = dict(
|
||||||
logo_url="https://docs.sc.otc.t-systems.com",
|
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",
|
logo_url="https://docs.otc.t-systems.com",
|
||||||
)
|
)
|
||||||
elif (args.target_environment == "internal"
|
elif (args.target_environment == "internal"
|
||||||
and target_repo["repo"].split("/")[0] == "docs-swiss"):
|
and args.cloud_environment == "swiss"):
|
||||||
context["html_options"] = dict(
|
context["html_options"] = dict(
|
||||||
disable_search=True,
|
disable_search=True,
|
||||||
site_name="Internal Documentation Portal",
|
site_name="Internal Documentation Portal",
|
||||||
@ -234,7 +236,7 @@ def process_repositories(args, service):
|
|||||||
if target_repo.get("type") != "github":
|
if target_repo.get("type") != "github":
|
||||||
context["git_type"] = target_repo["type"]
|
context["git_type"] = target_repo["type"]
|
||||||
if (args.target_environment == "public"
|
if (args.target_environment == "public"
|
||||||
and target_repo["repo"].split("/")[0] == "opentelekomcloud-docs-swiss"):
|
and args.cloud_environment == "swiss"):
|
||||||
context["html_options"] = dict(
|
context["html_options"] = dict(
|
||||||
logo_url="https://docs.sc.otc.t-systems.com",
|
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",
|
logo_url="https://docs.otc.t-systems.com",
|
||||||
)
|
)
|
||||||
elif (args.target_environment == "internal"
|
elif (args.target_environment == "internal"
|
||||||
and target_repo["repo"].split("/")[0] == "docs-swiss"):
|
and args.cloud_environment == "swiss"):
|
||||||
context["html_options"] = dict(
|
context["html_options"] = dict(
|
||||||
disable_search=True,
|
disable_search=True,
|
||||||
site_name="Internal Documentation Portal",
|
site_name="Internal Documentation Portal",
|
||||||
@ -289,9 +291,12 @@ def process_repositories(args, service):
|
|||||||
"""Update tox.ini"""
|
"""Update tox.ini"""
|
||||||
context = dict(docs=[])
|
context = dict(docs=[])
|
||||||
for doc in service_docs:
|
for doc in service_docs:
|
||||||
|
for cloud_environment in doc["cloud_environments"]:
|
||||||
|
if cloud_environment["name"] == args.cloud_environment:
|
||||||
if doc["type"] == "dev":
|
if doc["type"] == "dev":
|
||||||
doc["type"] = "dev-guide"
|
doc["type"] = "dev-guide"
|
||||||
context["docs"].append(doc)
|
context["docs"].append(doc)
|
||||||
|
context["pdf_enabled"] = cloud_environment["pdf_enabled"]
|
||||||
|
|
||||||
context["target_environment"] = args.target_environment
|
context["target_environment"] = args.target_environment
|
||||||
context["service_type"] = service['service_type']
|
context["service_type"] = service['service_type']
|
||||||
@ -320,6 +325,8 @@ def process_repositories(args, service):
|
|||||||
"""Update zuul.yaml"""
|
"""Update zuul.yaml"""
|
||||||
context = dict(docs=[])
|
context = dict(docs=[])
|
||||||
for doc in service_docs:
|
for doc in service_docs:
|
||||||
|
for cloud_environment in doc["cloud_environments"]:
|
||||||
|
if cloud_environment["name"] == args.cloud_environment:
|
||||||
if doc["type"] == "dev":
|
if doc["type"] == "dev":
|
||||||
doc["type"] = "dev-guide"
|
doc["type"] = "dev-guide"
|
||||||
context["docs"].append(doc)
|
context["docs"].append(doc)
|
||||||
@ -451,6 +458,12 @@ def main():
|
|||||||
),
|
),
|
||||||
help="Commit description for the commit",
|
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()
|
args = parser.parse_args()
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user