Skip to content

Commit

Permalink
docs: add gitlab - github repo sync documentation to readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bruzina committed Dec 4, 2021
1 parent c96f563 commit 1f99fac
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ Strategies and tactics to achieve objectives:
- [Installation and Configuration](#installation-and-configuration)
- [Local Environment](#local-environment)
- [GitLab Project](#gitlab-project)
- [GitLab - GitHub Synchronization](#gitlab---github-synchronization)
- [GitLab CI Settings](#gitlab-ci-settings)
- [GitLab CI Nightly Pipeline](#gitlab-ci-nightly-pipeline)
- [Usage](#usage)
- [Usage Examples](#usage-examples)
- [Contributing](#contributing)
Expand Down Expand Up @@ -162,8 +165,32 @@ tools/setup-repo
. tools/secrets.sh
```

Run `tools/update-repo` from time to time to update repository dependencies.

### GitLab Project

#### GitLab - GitHub Synchronization

To create working GitLab to GitHub repository synchronization:

- Prepare GitHub token, let's call it `GitLab GitHub Sync`, with scopes:
- `repo` (and `repo:status`, `repo_deployment`, `public_repo`, `repo:invite`, `security_events`)
- `workflow`
- `write:packages` (and `read:packages`)
- `delete:packages`
- Have or create GitHub repository
- Set up GitLab GitHub synchronization: Settings
- Repository
- Mirroring repositories, *Expand*
- *Add new mirror*:
- Git repository URL: **<https://user@github.com/org/repo.git>**, please replace _user_, _org_, and _repo_
- Mirror direction: **Push**
- Password: **`GitLab GitHub Sync` token**
- Keep divergent refs: **On** or **Off**
- Mirror only protected branches: **On** (all release and pre-release branches should be set as protected, otherwise GitHub release would fail on non-existent branch) or **Off**

#### GitLab CI Settings

Set up release and GitLab CI Linter tokens as the GitLab group or the GitLab project variable:

- **GL_TOKEN**: [GitLab Personal Access Token](https://gitlab.com/-/profile/personal_access_tokens) with scopes `api` and `write_repository`. Shouldn't be protected otherwise GitLab CI job `lint` fails with an error `Server said HTTP Error 401: Unauthorized: https://gitlab.com/api/v4/ci/lint`.
Expand All @@ -178,15 +205,15 @@ Set up release and GitLab CI Linter tokens as the GitLab group or the GitLab pro
- Flags:
- Protect variable: **On** (GitLab & GitHub Releases and GitLab CI Linter will work only on protected branches) or **Off** (insecure - accessible to anybody, who can create a commit in GitLab)

#### GitLab CI Nightly Pipeline

Set up the GitLab scheduled pipeline:

- CI/CD
- Schedules
- *New schedule*
- *Fill* and *Save pipeline schedule*

Run `tools/update-repo` from time to time to update repository dependencies.

## Usage

Simply fork the repository at [GitLab](https://gitlab.com/xebis/repository-template/-/forks/new) or [GitHub](https://github.com/xebis/repository-template/fork), **delete** all git tags, and **tag** the last commit to a desired starting version, e.g. `v0.0.0`. Clone the repository with `--recursive` option, run `tools/setup-repo`, and enjoy!
Expand Down

0 comments on commit 1f99fac

Please sign in to comment.