Add documentation for Repository Synchronization
- add install_gh_tool.md - add install_tea_tool.md - add synchronize-repositories.md
parent
701935c01d
commit
e26b24754b
BIN
_static/images/gh_auth_login.png
Normal file
BIN
_static/images/gh_auth_login.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 32 KiB |
BIN
_static/images/tea_login_add.png
Normal file
BIN
_static/images/tea_login_add.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 31 KiB |
37
install-gh-tool.md
Normal file
37
install-gh-tool.md
Normal file
@ -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.
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
The tool gives access to your GitHub account.
|
30
install-tea-tool.md
Normal file
30
install-tea-tool.md
Normal file
@ -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 -> \<Token-Name\> -> 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`.
|
||||||
|
|
||||||
|

|
50
synchronize-repository.md
Normal file
50
synchronize-repository.md
Normal file
@ -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/
|
||||||
|
```
|
Loading…
x
Reference in New Issue
Block a user