From 6cb27fbadb4e564a6986c7e67c2b91aabe67937a Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Thu, 2 Oct 2025 12:28:05 +0000 Subject: [PATCH 1/8] gh-actions --- .../templates/build-html-docs.yaml.j2 | 20 ++++++++++++++-- otc_metadata/templates/build-pdf-docs.yaml.j2 | 20 ++++++++++++++-- tools/generate_doc_confpy.py | 24 ++++++++++++++----- 3 files changed, 54 insertions(+), 10 deletions(-) diff --git a/otc_metadata/templates/build-html-docs.yaml.j2 b/otc_metadata/templates/build-html-docs.yaml.j2 index ebd6bbc..7caf80b 100644 --- a/otc_metadata/templates/build-html-docs.yaml.j2 +++ b/otc_metadata/templates/build-html-docs.yaml.j2 @@ -15,8 +15,9 @@ jobs: with: docs_path: "doc/build/html" docs_service: {{ service_uri }} - swift_container: "gitea_action_logs" + {%- 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 }} @@ -27,4 +28,19 @@ jobs: repo: ${{ gitea.repository }} pr_number: ${{ gitea.event.pull_request.number }} run_id: ${{ gitea.run_id }} - {%- endraw %} \ No newline at end of file + {%- endraw %} + {%- elif environment == 'public' %} + {% raw -%} + swift_container: "github_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.GITHUB_TOKEN }} + gitea_server_url: ${{ github.server_url }} + repo: ${{ github.repository }} + pr_number: ${{ github.event.pull_request.number }} + run_id: ${{ github.run_id }} + {%- endraw %} + {%- endif %} \ No newline at end of file diff --git a/otc_metadata/templates/build-pdf-docs.yaml.j2 b/otc_metadata/templates/build-pdf-docs.yaml.j2 index 472c8ef..be56752 100644 --- a/otc_metadata/templates/build-pdf-docs.yaml.j2 +++ b/otc_metadata/templates/build-pdf-docs.yaml.j2 @@ -15,8 +15,9 @@ jobs: with: docs_path: "doc/build/pdf" docs_service: {{ service_uri }} - swift_container: "gitea_action_logs" + {%- 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 }} @@ -27,4 +28,19 @@ jobs: repo: ${{ gitea.repository }} pr_number: ${{ gitea.event.pull_request.number }} run_id: ${{ gitea.run_id }} - {%- endraw %} \ No newline at end of file + {%- endraw %} + {%- elif environment == 'public' %} + {% raw -%} + swift_container: "github_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.GITHUB_TOKEN }} + gitea_server_url: ${{ github.server_url }} + repo: ${{ github.repository }} + pr_number: ${{ github.event.pull_request.number }} + run_id: ${{ github.run_id }} + {%- endraw %} + {%- endif %} \ No newline at end of file diff --git a/tools/generate_doc_confpy.py b/tools/generate_doc_confpy.py index 4691d9c..5f51c3b 100644 --- a/tools/generate_doc_confpy.py +++ b/tools/generate_doc_confpy.py @@ -371,21 +371,33 @@ def process_repositories(args, service): """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) - 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) + 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) - repo_to.index.add([".gitea/workflows/build-html-docs.yaml"]) 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) - repo_to.index.add([".gitea/workflows/build-pdf-docs.yaml"]) + 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 -- 2.34.1 From 64a18eedb56b5fafbba839141575829f9ffb9dcc Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Thu, 2 Oct 2025 12:32:16 +0000 Subject: [PATCH 2/8] gh-actions --- otc_metadata/templates/build-html-docs.yaml.j2 | 9 +++++++++ otc_metadata/templates/build-pdf-docs.yaml.j2 | 11 ++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/otc_metadata/templates/build-html-docs.yaml.j2 b/otc_metadata/templates/build-html-docs.yaml.j2 index 7caf80b..728c4e3 100644 --- a/otc_metadata/templates/build-html-docs.yaml.j2 +++ b/otc_metadata/templates/build-html-docs.yaml.j2 @@ -6,12 +6,21 @@ 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 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 + uses: opentelekomcloud-infra/github-actions/.github/actions/tox-upload-swift@v1 + {%- endif %} with: docs_path: "doc/build/html" docs_service: {{ service_uri }} diff --git a/otc_metadata/templates/build-pdf-docs.yaml.j2 b/otc_metadata/templates/build-pdf-docs.yaml.j2 index be56752..b683e56 100644 --- a/otc_metadata/templates/build-pdf-docs.yaml.j2 +++ b/otc_metadata/templates/build-pdf-docs.yaml.j2 @@ -6,12 +6,21 @@ 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 + tox-env: docs - name: Upload documentation preview 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 + uses: opentelekomcloud-infra/github-actions/.github/actions/tox-upload-swift@v1 + {%- endif %} with: docs_path: "doc/build/pdf" docs_service: {{ service_uri }} -- 2.34.1 From 770391518dd94ed42a85ca39bf6486a97bb6f168 Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Thu, 2 Oct 2025 13:07:34 +0000 Subject: [PATCH 3/8] CI Platform --- otc_metadata/templates/build-html-docs.yaml.j2 | 2 ++ otc_metadata/templates/build-pdf-docs.yaml.j2 | 2 ++ 2 files changed, 4 insertions(+) diff --git a/otc_metadata/templates/build-html-docs.yaml.j2 b/otc_metadata/templates/build-html-docs.yaml.j2 index 728c4e3..a1a468d 100644 --- a/otc_metadata/templates/build-html-docs.yaml.j2 +++ b/otc_metadata/templates/build-html-docs.yaml.j2 @@ -37,6 +37,7 @@ jobs: repo: ${{ gitea.repository }} pr_number: ${{ gitea.event.pull_request.number }} run_id: ${{ gitea.run_id }} + ci_platform: gitea {%- endraw %} {%- elif environment == 'public' %} {% raw -%} @@ -51,5 +52,6 @@ jobs: repo: ${{ github.repository }} pr_number: ${{ github.event.pull_request.number }} run_id: ${{ github.run_id }} + ci_platform: github {%- endraw %} {%- endif %} \ No newline at end of file diff --git a/otc_metadata/templates/build-pdf-docs.yaml.j2 b/otc_metadata/templates/build-pdf-docs.yaml.j2 index b683e56..7aa3f1a 100644 --- a/otc_metadata/templates/build-pdf-docs.yaml.j2 +++ b/otc_metadata/templates/build-pdf-docs.yaml.j2 @@ -37,6 +37,7 @@ jobs: repo: ${{ gitea.repository }} pr_number: ${{ gitea.event.pull_request.number }} run_id: ${{ gitea.run_id }} + ci_platform: gitea {%- endraw %} {%- elif environment == 'public' %} {% raw -%} @@ -51,5 +52,6 @@ jobs: repo: ${{ github.repository }} pr_number: ${{ github.event.pull_request.number }} run_id: ${{ github.run_id }} + ci_platform: github {%- endraw %} {%- endif %} \ No newline at end of file -- 2.34.1 From 1dbc4f012263fb3c5e6985849e2348decc770c5b Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Mon, 6 Oct 2025 08:19:55 +0000 Subject: [PATCH 4/8] Fix GitHub Token --- otc_metadata/templates/build-html-docs.yaml.j2 | 3 +-- otc_metadata/templates/build-pdf-docs.yaml.j2 | 7 +++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/otc_metadata/templates/build-html-docs.yaml.j2 b/otc_metadata/templates/build-html-docs.yaml.j2 index a1a468d..77afa5a 100644 --- a/otc_metadata/templates/build-html-docs.yaml.j2 +++ b/otc_metadata/templates/build-html-docs.yaml.j2 @@ -47,8 +47,7 @@ jobs: 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.GITHUB_TOKEN }} - gitea_server_url: ${{ github.server_url }} + github_token: ${{ secrets.GITHUB_TOKEN }} repo: ${{ github.repository }} pr_number: ${{ github.event.pull_request.number }} run_id: ${{ github.run_id }} diff --git a/otc_metadata/templates/build-pdf-docs.yaml.j2 b/otc_metadata/templates/build-pdf-docs.yaml.j2 index 7aa3f1a..80ae258 100644 --- a/otc_metadata/templates/build-pdf-docs.yaml.j2 +++ b/otc_metadata/templates/build-pdf-docs.yaml.j2 @@ -9,14 +9,14 @@ jobs: {%- if environment == 'internal' %} - uses: https://github.com/opentelekomcloud-infra/github-actions/.github/actions/tox-run-env@v1 with: - tox-env: docs + tox-env: pdf-docs - name: Upload documentation preview 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 + tox-env: pdf-docs - name: Upload documentation preview uses: opentelekomcloud-infra/github-actions/.github/actions/tox-upload-swift@v1 @@ -47,8 +47,7 @@ jobs: 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.GITHUB_TOKEN }} - gitea_server_url: ${{ github.server_url }} + github_token: ${{ secrets.GITHUB_TOKEN }} repo: ${{ github.repository }} pr_number: ${{ github.event.pull_request.number }} run_id: ${{ github.run_id }} -- 2.34.1 From f4159c539c53c1a727d0451c0d0042b2562130ee Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Mon, 6 Oct 2025 08:45:55 +0000 Subject: [PATCH 5/8] added sudo --- otc_metadata/templates/tox.ini.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/otc_metadata/templates/tox.ini.j2 b/otc_metadata/templates/tox.ini.j2 index 7328db9..1e33312 100644 --- a/otc_metadata/templates/tox.ini.j2 +++ b/otc_metadata/templates/tox.ini.j2 @@ -152,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] -- 2.34.1 From 2174272b35aab30afe89ae5b7509b1759077059d Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Mon, 6 Oct 2025 09:35:56 +0000 Subject: [PATCH 6/8] switch to gh --- otc_metadata/templates/build-html-docs.yaml.j2 | 2 +- otc_metadata/templates/build-pdf-docs.yaml.j2 | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/otc_metadata/templates/build-html-docs.yaml.j2 b/otc_metadata/templates/build-html-docs.yaml.j2 index 77afa5a..abbbef7 100644 --- a/otc_metadata/templates/build-html-docs.yaml.j2 +++ b/otc_metadata/templates/build-html-docs.yaml.j2 @@ -41,7 +41,7 @@ jobs: {%- endraw %} {%- elif environment == 'public' %} {% raw -%} - swift_container: "github_action_logs" + 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 }} diff --git a/otc_metadata/templates/build-pdf-docs.yaml.j2 b/otc_metadata/templates/build-pdf-docs.yaml.j2 index 80ae258..ee0e418 100644 --- a/otc_metadata/templates/build-pdf-docs.yaml.j2 +++ b/otc_metadata/templates/build-pdf-docs.yaml.j2 @@ -41,7 +41,7 @@ jobs: {%- endraw %} {%- elif environment == 'public' %} {% raw -%} - swift_container: "github_action_logs" + 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 }} -- 2.34.1 From b0f471ac02d0fba434781438ebd0eeb9ffad9a9e Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Tue, 7 Oct 2025 09:37:58 +0000 Subject: [PATCH 7/8] Environment --- otc_metadata/templates/zuul.yaml.j2 | 2 ++ tools/generate_doc_confpy.py | 1 + 2 files changed, 3 insertions(+) diff --git a/otc_metadata/templates/zuul.yaml.j2 b/otc_metadata/templates/zuul.yaml.j2 index 31a6886..6b7ad87 100644 --- a/otc_metadata/templates/zuul.yaml.j2 +++ b/otc_metadata/templates/zuul.yaml.j2 @@ -2,8 +2,10 @@ - project: merge-mode: squash-merge default-branch: main + {%- if environment != "public" %} templates: - {{ template }} + {%- endif %} vars: sphinx_pdf_files: {%- for doc in docs %} diff --git a/tools/generate_doc_confpy.py b/tools/generate_doc_confpy.py index 5f51c3b..67d5e46 100644 --- a/tools/generate_doc_confpy.py +++ b/tools/generate_doc_confpy.py @@ -359,6 +359,7 @@ def process_repositories(args, service): elif args.cloud_environment == "eu_de": context["template"] = "helpcenter-base-jobs" context["service_type"] = service['service_type'] + context["environment"] = args.target_environment zuul_yaml_content = zuul_yaml_template.render(**context) zuul_yaml_path = pathlib.Path(copy_to, "zuul.yaml") -- 2.34.1 From 8f04b4ca09f84fa86e5b0c322b8385b5fd499778 Mon Sep 17 00:00:00 2001 From: Sebastian Gode Date: Tue, 7 Oct 2025 10:02:09 +0000 Subject: [PATCH 8/8] No zuul check on public --- otc_metadata/templates/zuul.yaml.j2 | 2 -- tools/generate_doc_confpy.py | 5 +++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/otc_metadata/templates/zuul.yaml.j2 b/otc_metadata/templates/zuul.yaml.j2 index 6b7ad87..31a6886 100644 --- a/otc_metadata/templates/zuul.yaml.j2 +++ b/otc_metadata/templates/zuul.yaml.j2 @@ -2,10 +2,8 @@ - project: merge-mode: squash-merge default-branch: main - {%- if environment != "public" %} templates: - {{ template }} - {%- endif %} vars: sphinx_pdf_files: {%- for doc in docs %} diff --git a/tools/generate_doc_confpy.py b/tools/generate_doc_confpy.py index 67d5e46..98debea 100644 --- a/tools/generate_doc_confpy.py +++ b/tools/generate_doc_confpy.py @@ -356,10 +356,11 @@ 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'] - context["environment"] = args.target_environment zuul_yaml_content = zuul_yaml_template.render(**context) zuul_yaml_path = pathlib.Path(copy_to, "zuul.yaml") -- 2.34.1