Compare commits
11 Commits
ed-service
...
1.0.0
Author | SHA1 | Date | |
---|---|---|---|
8c9ca536e8 | |||
62d7563010 | |||
1ed083a057 | |||
ca9c822495 | |||
8500bdb658 | |||
8c2aa088e9 | |||
bd563ca9eb | |||
86e991e787 | |||
6c51ab3654 | |||
0a3520fefc | |||
ed2f5222a7 |
@ -57,6 +57,6 @@ jobs:
|
||||
if git diff --cached --quiet; then
|
||||
echo "No changes to commit"
|
||||
else
|
||||
git commit -m "chore: update analytics data [skip ci]"
|
||||
git commit -m "chore: update analytics data"
|
||||
git push origin analytics-update --force
|
||||
fi
|
||||
|
@ -2,11 +2,11 @@
|
||||
"evs",
|
||||
"ims",
|
||||
"ecs",
|
||||
"cce",
|
||||
"obs",
|
||||
"cce",
|
||||
"elb",
|
||||
"rds",
|
||||
"sfs",
|
||||
"iam",
|
||||
"elb",
|
||||
"cbr"
|
||||
"vpc"
|
||||
]
|
@ -2,11 +2,11 @@
|
||||
"evs",
|
||||
"ims",
|
||||
"ecs",
|
||||
"cce",
|
||||
"obs",
|
||||
"cce",
|
||||
"elb",
|
||||
"rds",
|
||||
"iam",
|
||||
"elb",
|
||||
"cbr",
|
||||
"vpc"
|
||||
"vpc",
|
||||
"vpn"
|
||||
]
|
@ -2,10 +2,10 @@
|
||||
hc_location: devg/dli
|
||||
html_location: docs/dli/dev
|
||||
link: /data-lake-insight/dev-guide/
|
||||
rst_location: dev_guide/source
|
||||
rst_location: doc/dev-guide/source
|
||||
service_type: dli
|
||||
title: Developer Guide
|
||||
type: dev
|
||||
type: dev-guide
|
||||
cloud_environments:
|
||||
- name: eu_de
|
||||
visibility: public
|
||||
|
@ -6,6 +6,6 @@ title: Alerting
|
||||
type: alerting
|
||||
cloud_environments:
|
||||
- name: eu_de
|
||||
visibility: public
|
||||
pdf_visibility: public
|
||||
visibility: hidden
|
||||
pdf_visibility: hidden
|
||||
pdf_enabled: true
|
||||
|
@ -0,0 +1,13 @@
|
||||
---
|
||||
hc_location: sdk/nodejs-devg-obs
|
||||
html_location: docs/obs_3rd_party/nodejs_sdk
|
||||
link: /object-storage-service-3rd-party/nodejs-sdk/
|
||||
rst_location: doc/nodejs-sdk/source
|
||||
service_type: obs_3rd_party
|
||||
title: Node.js SDK
|
||||
type: nodejs-sdk
|
||||
cloud_environments:
|
||||
- name: eu_de
|
||||
visibility: public
|
||||
pdf_visibility: public
|
||||
pdf_enabled: false
|
@ -197,7 +197,7 @@ class Services(object):
|
||||
if cloud_environment_doc["name"] == cloud_environment:
|
||||
cloud_environment_doc_check = True
|
||||
if environment:
|
||||
if cloud_environment_service["visibility"] == environment:
|
||||
if cloud_environment_doc["visibility"] == environment:
|
||||
cloud_doc_visibility_check = True
|
||||
else:
|
||||
cloud_doc_visibility_check = True
|
||||
|
62
otc_metadata/templates/build-html-docs.yaml.j2
Normal file
62
otc_metadata/templates/build-html-docs.yaml.j2
Normal file
@ -0,0 +1,62 @@
|
||||
name: Build HTML Docs
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize, edited]
|
||||
jobs:
|
||||
tox-docs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
{%- if environment == 'internal' %}
|
||||
- uses: https://github.com/opentelekomcloud-infra/github-actions/.github/actions/tox-run-env@v1
|
||||
with:
|
||||
tox-env: docs
|
||||
|
||||
- name: Upload documentation preview
|
||||
{% raw -%}
|
||||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||
{%- endraw %}
|
||||
uses: https://github.com/opentelekomcloud-infra/github-actions/.github/actions/tox-upload-swift@v1
|
||||
{%- elif environment == 'public' %}
|
||||
- uses: opentelekomcloud-infra/github-actions/.github/actions/tox-run-env@v1
|
||||
with:
|
||||
tox-env: docs
|
||||
|
||||
- name: Upload documentation preview
|
||||
{% raw -%}
|
||||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||
{%- endraw %}
|
||||
uses: opentelekomcloud-infra/github-actions/.github/actions/tox-upload-swift@v1
|
||||
{%- endif %}
|
||||
with:
|
||||
docs_path: "doc/build/html"
|
||||
docs_service: {{ service_uri }}
|
||||
{%- if environment == 'internal' %}
|
||||
{% raw -%}
|
||||
swift_container: "gitea_action_logs"
|
||||
otc_swift_username: ${{ secrets.OTC_SWIFT_USERNAME }}
|
||||
otc_swift_password: ${{ secrets.OTC_SWIFT_PASSWORD }}
|
||||
otc_swift_project_name: ${{ secrets.OTC_SWIFT_PROJECT_NAME }}
|
||||
otc_swift_domain: ${{ secrets.OTC_SWIFT_DOMAIN }}
|
||||
otc_swift_endpoint: ${{ secrets.OTC_SWIFT_ENDPOINT }}
|
||||
gitea_token: ${{ secrets.GITEA_TOKEN }}
|
||||
gitea_server_url: ${{ gitea.server_url }}
|
||||
repo: ${{ gitea.repository }}
|
||||
pr_number: ${{ gitea.event.pull_request.number }}
|
||||
run_id: ${{ gitea.run_id }}
|
||||
ci_platform: gitea
|
||||
{%- endraw %}
|
||||
{%- elif environment == 'public' %}
|
||||
{% raw -%}
|
||||
swift_container: "gh_action_logs"
|
||||
otc_swift_username: ${{ secrets.OTC_SWIFT_USERNAME }}
|
||||
otc_swift_password: ${{ secrets.OTC_SWIFT_PASSWORD }}
|
||||
otc_swift_project_name: ${{ secrets.OTC_SWIFT_PROJECT_NAME }}
|
||||
otc_swift_domain: ${{ secrets.OTC_SWIFT_DOMAIN }}
|
||||
otc_swift_endpoint: ${{ secrets.OTC_SWIFT_ENDPOINT }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repo: ${{ github.repository }}
|
||||
pr_number: ${{ github.event.pull_request.number }}
|
||||
run_id: ${{ github.run_id }}
|
||||
ci_platform: github
|
||||
{%- endraw %}
|
||||
{%- endif %}
|
62
otc_metadata/templates/build-pdf-docs.yaml.j2
Normal file
62
otc_metadata/templates/build-pdf-docs.yaml.j2
Normal file
@ -0,0 +1,62 @@
|
||||
name: Build PDF Docs
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, reopened, synchronize, edited]
|
||||
jobs:
|
||||
tox-pdf-docs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
{%- if environment == 'internal' %}
|
||||
- uses: https://github.com/opentelekomcloud-infra/github-actions/.github/actions/tox-run-env@v1
|
||||
with:
|
||||
tox-env: pdf-docs
|
||||
|
||||
- name: Upload documentation preview
|
||||
{% raw -%}
|
||||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||
{%- endraw %}
|
||||
uses: https://github.com/opentelekomcloud-infra/github-actions/.github/actions/tox-upload-swift@v1
|
||||
{%- elif environment == 'public' %}
|
||||
- uses: opentelekomcloud-infra/github-actions/.github/actions/tox-run-env@v1
|
||||
with:
|
||||
tox-env: pdf-docs
|
||||
|
||||
- name: Upload documentation preview
|
||||
{% raw -%}
|
||||
if: ${{ github.event.pull_request.head.repo.full_name == github.repository }}
|
||||
{%- endraw %}
|
||||
uses: opentelekomcloud-infra/github-actions/.github/actions/tox-upload-swift@v1
|
||||
{%- endif %}
|
||||
with:
|
||||
docs_path: "doc/build/pdf"
|
||||
docs_service: {{ service_uri }}
|
||||
{%- if environment == 'internal' %}
|
||||
{% raw -%}
|
||||
swift_container: "gitea_action_logs"
|
||||
otc_swift_username: ${{ secrets.OTC_SWIFT_USERNAME }}
|
||||
otc_swift_password: ${{ secrets.OTC_SWIFT_PASSWORD }}
|
||||
otc_swift_project_name: ${{ secrets.OTC_SWIFT_PROJECT_NAME }}
|
||||
otc_swift_domain: ${{ secrets.OTC_SWIFT_DOMAIN }}
|
||||
otc_swift_endpoint: ${{ secrets.OTC_SWIFT_ENDPOINT }}
|
||||
gitea_token: ${{ secrets.GITEA_TOKEN }}
|
||||
gitea_server_url: ${{ gitea.server_url }}
|
||||
repo: ${{ gitea.repository }}
|
||||
pr_number: ${{ gitea.event.pull_request.number }}
|
||||
run_id: ${{ gitea.run_id }}
|
||||
ci_platform: gitea
|
||||
{%- endraw %}
|
||||
{%- elif environment == 'public' %}
|
||||
{% raw -%}
|
||||
swift_container: "gh_action_logs"
|
||||
otc_swift_username: ${{ secrets.OTC_SWIFT_USERNAME }}
|
||||
otc_swift_password: ${{ secrets.OTC_SWIFT_PASSWORD }}
|
||||
otc_swift_project_name: ${{ secrets.OTC_SWIFT_PROJECT_NAME }}
|
||||
otc_swift_domain: ${{ secrets.OTC_SWIFT_DOMAIN }}
|
||||
otc_swift_endpoint: ${{ secrets.OTC_SWIFT_ENDPOINT }}
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
repo: ${{ github.repository }}
|
||||
pr_number: ${{ github.event.pull_request.number }}
|
||||
run_id: ${{ github.run_id }}
|
||||
ci_platform: github
|
||||
{%- endraw %}
|
||||
{%- endif %}
|
@ -41,7 +41,11 @@ commands =
|
||||
sphinx-minify --input-directory doc/build/html_temp/ --output-directory doc/build/html
|
||||
{%- for doc in docs %}
|
||||
{[testenv:{{ doc.type }}]commands}
|
||||
{#- To avoid hidden documents to be searchable -#}
|
||||
{%- if (target_environment == 'internal' and doc.visibility != 'hidden')
|
||||
or (target_environment == 'public' and doc.visibility == 'public') %}
|
||||
{[testenv:json-{{ doc.type }}]commands}
|
||||
{%- endif %}
|
||||
{%- endfor %}
|
||||
|
||||
{% if docs|length > 0 %}
|
||||
@ -90,6 +94,10 @@ commands =
|
||||
cp -av doc/build/html/{{ doc.type }} {{ doc.type }}/build/html
|
||||
{%- endif %}
|
||||
|
||||
{#- To avoid hidden documents to be searchable -#}
|
||||
{%- if (target_environment == 'internal' and doc.visibility != 'hidden')
|
||||
or (target_environment == 'public' and doc.visibility == 'public') %}
|
||||
|
||||
# Json version (for search)
|
||||
[testenv:json-{{ doc.type }}]
|
||||
deps = {[testenv:docs]deps}
|
||||
@ -109,6 +117,7 @@ commands =
|
||||
mkdir -p {{ doc.type }}/build/json
|
||||
cp -av doc/build/json/{{ doc.type }} {{ doc.type }}/build/json
|
||||
{%- endif %}
|
||||
{%- endif %}
|
||||
|
||||
# PDF version
|
||||
[testenv:{{ doc.type }}-pdf-docs]
|
||||
@ -143,7 +152,7 @@ commands =
|
||||
rm -rf {toxinidir}/packages.txt
|
||||
wget -O {toxinidir}/bindep.txt https://raw.githubusercontent.com/opentelekomcloud/otcdocstheme/main/bindep.txt
|
||||
bash -c "bindep test -b -f {toxinidir}/bindep.txt > {toxinidir}/packages.txt || true"
|
||||
bash -c 'if [ -s {toxinidir}/packages.txt ]; then if command -v apt &>/dev/null; then apt update && xargs apt install --no-install-recommends -y < {toxinidir}/packages.txt; fi; fi'
|
||||
bash -c 'if [ -s {toxinidir}/packages.txt ]; then if command -v apt &>/dev/null; then sudo apt update && xargs sudo apt install --no-install-recommends -y < {toxinidir}/packages.txt; fi; fi'
|
||||
bash -c 'if [ -s {toxinidir}/packages.txt ]; then if command -v dnf &>/dev/null; then dnf install -y $(cat {toxinidir}/packages.txt); fi; fi'
|
||||
|
||||
[doc8]
|
||||
|
@ -54,6 +54,8 @@ def process_repositories(args, service):
|
||||
zuul_yaml_template = env.get_template("zuul.yaml.j2")
|
||||
index_sbv_template = env.get_template("index_sbv.rst.j2")
|
||||
doc_requirements_template = env.get_template("doc_requirements.txt.j2")
|
||||
actions_yaml_template_html = env.get_template("build-html-docs.yaml.j2")
|
||||
actions_yaml_template_pdf = env.get_template("build-pdf-docs.yaml.j2")
|
||||
|
||||
for repo in service["repositories"]:
|
||||
if repo["cloud_environments"][0] == args.cloud_environment:
|
||||
@ -316,6 +318,7 @@ def process_repositories(args, service):
|
||||
if doc["type"] == "dev":
|
||||
doc["type"] = "dev-guide"
|
||||
doc["pdf_enabled"] = cloud_environment["pdf_enabled"]
|
||||
doc["visibility"] = cloud_environment["visibility"]
|
||||
context["docs"].append(doc)
|
||||
|
||||
context["target_environment"] = args.target_environment
|
||||
@ -353,8 +356,10 @@ def process_repositories(args, service):
|
||||
context["docs"].append(doc)
|
||||
if args.cloud_environment == "swiss":
|
||||
context["template"] = "helpcenter-swiss-base-jobs"
|
||||
elif args.cloud_environment == "eu_de":
|
||||
elif args.cloud_environment == "eu_de" and args.target_environment == "internal":
|
||||
context["template"] = "helpcenter-base-jobs"
|
||||
elif args.cloud_environment == "eu_de" and args.target_environment == "public":
|
||||
context["template"] = "helpcenter-base-jobs-no-check"
|
||||
context["service_type"] = service['service_type']
|
||||
|
||||
zuul_yaml_content = zuul_yaml_template.render(**context)
|
||||
@ -364,6 +369,38 @@ def process_repositories(args, service):
|
||||
out.write(zuul_yaml_content)
|
||||
repo_to.index.add(["zuul.yaml"])
|
||||
|
||||
if args.update_actions:
|
||||
"""Update actions"""
|
||||
context = dict(docs=[])
|
||||
context["service_uri"] = service['service_uri']
|
||||
context["environment"] = args.target_environment
|
||||
|
||||
actions_yaml_content_html = actions_yaml_template_html.render(**context)
|
||||
actions_yaml_content_pdf = actions_yaml_template_pdf.render(**context)
|
||||
if args.target_environment == "internal":
|
||||
actions_yaml_content_html_path = pathlib.Path(copy_to, ".gitea", "workflows", "build-html-docs.yaml")
|
||||
actions_yaml_content_html_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
actions_yaml_content_pdf_path = pathlib.Path(copy_to, ".gitea", "workflows", "build-pdf-docs.yaml")
|
||||
actions_yaml_content_pdf_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
elif args.target_environment == "public":
|
||||
actions_yaml_content_html_path = pathlib.Path(copy_to, ".github", "workflows", "build-html-docs.yaml")
|
||||
actions_yaml_content_html_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
actions_yaml_content_pdf_path = pathlib.Path(copy_to, ".github", "workflows", "build-pdf-docs.yaml")
|
||||
actions_yaml_content_pdf_path.parent.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
with open(actions_yaml_content_html_path, "w", encoding="utf-8", newline="") as out:
|
||||
logging.debug(f"Generating {actions_yaml_content_html_path} from template...")
|
||||
out.write(actions_yaml_content_html)
|
||||
with open(actions_yaml_content_pdf_path, "w", encoding="utf-8", newline="") as out:
|
||||
logging.debug(f"Generating {actions_yaml_content_pdf_path} from template...")
|
||||
out.write(actions_yaml_content_pdf)
|
||||
if args.target_environment == "internal":
|
||||
repo_to.index.add([".gitea/workflows/build-html-docs.yaml"])
|
||||
repo_to.index.add([".gitea/workflows/build-pdf-docs.yaml"])
|
||||
elif args.target_environment == "public":
|
||||
repo_to.index.add([".github/workflows/build-html-docs.yaml"])
|
||||
repo_to.index.add([".github/workflows/build-pdf-docs.yaml"])
|
||||
|
||||
if len(repo_to.index.diff("HEAD")) == 0:
|
||||
# Nothing to commit
|
||||
logging.debug(
|
||||
@ -463,6 +500,11 @@ def main():
|
||||
action="store_true",
|
||||
help="Whether to update zuul.yaml"
|
||||
)
|
||||
parser.add_argument(
|
||||
"--update-actions",
|
||||
action="store_true",
|
||||
help="Whether to update the action yaml files for rendering docs."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--overwrite-index-sbv",
|
||||
action="store_true",
|
||||
|
Reference in New Issue
Block a user