diff --git a/_static/images/gh_auth_login.png b/_static/images/gh_auth_login.png new file mode 100644 index 0000000..204e5a8 Binary files /dev/null and b/_static/images/gh_auth_login.png differ diff --git a/_static/images/tea_login_add.png b/_static/images/tea_login_add.png new file mode 100644 index 0000000..e5a1efd Binary files /dev/null and b/_static/images/tea_login_add.png differ diff --git a/install-gh-tool.md b/install-gh-tool.md new file mode 100644 index 0000000..8f0fa27 --- /dev/null +++ b/install-gh-tool.md @@ -0,0 +1,37 @@ +# Installation of gh (GitHub) CLI tool + +This tools is used to interact with GitHub via CLI to e.g. create PullRequests. + +## Prerequisits + +* ssh public-key for GitHub +* [Personal Access Token](https://github.com/settings/token) (classic) + * Link: GitHub -> Developer Settings -> Personal Access Tokens -> Tokens (classic) + * Permissions: `admin:public_key, read:org, repo` + +## Installation of gh Tool on Debian / Ubuntu and co. + +Use the following bash snippet to get `gh` tool installed on your machine. + +```bash +type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y) +curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ +&& sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ +&& echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ +&& sudo apt update \ +&& sudo apt install gh -y +``` + +## Authentication with gh tool + +Run the following command to authenticate against Github + +``` +gh auth login +``` + +Fill in the following information and paste the Token. + +![Alt-Text](_static/images/gh_auth_login.png) + +The tool gives access to your GitHub account. diff --git a/install-tea-tool.md b/install-tea-tool.md new file mode 100644 index 0000000..586d678 --- /dev/null +++ b/install-tea-tool.md @@ -0,0 +1,30 @@ +# Installation of tea (Gitea) CLI tool + +This tool is used to interact with Gitea via CLI to e.g. create PullRequests. + +## Prerequisits + +* ssh public-key for Gitea +* An [Access Token](https://gitea.eco.tsi-dev.otc-service.com/user/settings/applications) + * Gitea -> Settings -> Applications -> Manage Access Tokens -> \ -> Generate Token + +## Installation + +Run the following command to get the `tea` tool and change permissions. +``` +sudo wget https://dl.gitea.com/tea/0.9.2/tea-0.9.2-linux-amd64 -O /usr/local/bin/tea + +sudo chmod +x /usr/local/bin/tea +``` + +## Authentication with tea + +Run the following command to authenticate against our Gitea. + +``` +tea login add +``` + +Add the following information and your personal `Access Token`. + +![Alt-Text](_static/images/tea_login_add.png) \ No newline at end of file diff --git a/synchronize-repository.md b/synchronize-repository.md new file mode 100644 index 0000000..27ad8be --- /dev/null +++ b/synchronize-repository.md @@ -0,0 +1,50 @@ +# Synchronize Repositories + +It is important to know to which git service the synchronization will happen. You need different CLI tools for either Gitea or GitHub. + +## Synchronize to GitHub + +Install the tools from prerequesits section and authenticate to GH to begin the synchronization. + +### Prerequisits + +* [Install `gh` tool](install-gh-tool.md) +* Directory as workspace e.g. `~/workspace` + +### Synchronize from Gitea to GitHub + +Change directory to tools directory + +```bash +cd ~/workspace/gitea/infra/otc-metadata/tools/ +``` + +Run the following command to clone the prefered documentation of one service by selecting service-type and document-type. In our example: We clone the whole user manual from service CCE from internal (Gitea) to external (GitHub) repository. The option `--open-pr-gh` opens a Pull Request on GitHub side. + +```bash +python sync_doc_repo.py --source-environment internal --target-environment public --service-type cce --document-type umn --branch-name main --work-dir ~/workspace/ --open-pr-gh +``` + +## Synchronize to Gitea + +Install the tools from prerequesits section and authenticate to Gitea to begin the synchronization. + +### Prerequisits + +* [Install `tea` tool](install-tea-tool.md) +* Directory as workspace e.g. `~/workspace` + + +### Synchronize from Gitea to GitHub + +Change directory to tools directory + +```bash +cd ~/workspace/gitea/infra/otc-metadata/tools/ +``` + +Run the following command to clone the prefered documentation of one service by selecting service-type and document-type. In our example: We clone the whole user manual from service Cloud Container Engine (cce) from external (GitHub) to internal (Gitea) repository. + +```bash +python sync_doc_repo.py --source-environment public --target-environment internal --service-type cce --document-type umn --branch-name main --work-dir ~/workspace/ +```