===================================
Add a new Repository with Backstage
===================================

This document describes the steps to be done to register a new Helpcenter Repository.

1. Register the Service in infra/metadata
-----------------------------------------

Modify the following sample files for your need and open a Pull Request in the respective Gitea Repository.

Service registration under: `otc_metadata/data/services <https://gitea.eco.tsi-dev.otc-service.com/infra/otc-metadata/src/branch/main/otc_metadata/data/services>`_

.. code::

    ---
    environment: public
    repositories:
    - environment: internal
      repo: docs/cloud-container-engine
      type: gitea
    - environment: public
      repo: opentelekomcloud-docs/cloud-container-engine
      type: github
    service_category: container
    service_title: Cloud Container Engine
    service_type: cce
    service_uri: cloud-container-engine
    teams:
    - name: docs-container-rw
    permission: write

Documents registration under: `otc_metadata/data/documents <https://gitea.eco.tsi-dev.otc-service.com/infra/otc-metadata/src/branch/main/otc_metadata/data/documents>`_

.. code::

    ---
    hc_location: usermanual2/cce
    html_location: docs/cce/umn
    link: /cloud-container-engine/umn/
    rst_location: umn/source
    service_type: cce
    title: User Guide
    type: umn

2. Use Backstage to create a Git internal / public Repository
-------------------------------------------------------------

- Open Backstage under: https://backstage.eco.tsi-dev.otc-service.com/
- Navigate to :code:`Create...` in the left sidebar
- Choose :code:`Helpcenter Service` from the list in the main section
- Fill in the necessary information to create a Helpcenter repository in Gitea (internal)

.. figure:: images/hc_service.png

- Fill in the necessary information to create a Helpcenter repository in GitHub (public)

.. image:: images/hc_service2.png

3. Use Backstage to register the repositories to Zuul and set proper gitstyring permissions
-------------------------------------------------------------------------------------------

- Open Backstage under: https://backstage.eco.tsi-dev.otc-service.com/
- Navigate to :code:`Create...` in the left sidebar
- Choose :code:`Action: Register repository in Zuul` from the list in the main section
- Fill in the necessary information as shown in the screenshots below

.. image:: images/hc_service3.png

.. image:: images/hc_service4.png

4. Approve Changes for gitstyring and Zuul
------------------------------------------

- Navigate to gitstyring repository in Gitea: https://gitea.eco.tsi-dev.otc-service.com/infra/gitstyring/pulls/
- Review and approve changes in the related Pull Request
- Wait until Gate-process has been finished
- Navigate to Zuul repository in Github: https://github.com/opentelekomcloud-infra/zuul-config/pulls
- Review and approve changes in the related Pull Request
