Commit 818c5346 authored by Pierre Smeyers's avatar Pierre Smeyers
Browse files

Merge branch 'feat/gitlab-cp' into 'master'

docs: switch from gitlab-sync.sh to gitlab-cp tool

See merge request to-be-continuous/doc!75
parents f650c6cd f672e261
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@ If one or both of these requirements can't be met (because you're not allowed to
not allowed to create projects with public visibility), then you'll have a couple of extra things to do to have _to be continuous_
working in your self-managed server:

1. Use the right GitLab Synchronization option(s) when [running the GitLab sync script](./basic.md#run-the-gitlab-synchronization-script) for first time:
1. Use the right GitLab Synchronization option(s) when [running the GitLab Copy CLI](./basic.md#run-the-gitlab-copy-cli) for first the time:
    * `--dest-sync-path` to override the GitLab destination root group path,
    * `--max-visibility` to override the maximum visibility of projects in the destination group.
    For more info about GitLab Synchronization Script options, please [refer to the doc](https://gitlab.com/to-be-continuous/tools/gitlab-sync#usage-script).
    For more info about GitLab Copy CLI options, please [refer to the doc](https://gitlab.com/to-be-continuous/tools/gitlab-cp#usage).
2. Set the right variable(s) in your local copy of the [tools/gitlab-sync](https://gitlab.com/to-be-continuous/tools/gitlab-sync) project 
   when [configuring the TBC synchronization](./basic.md#sync-your-local-copy-of-tbc) for first time:
    * `$DEST_SYNC_PATH` to override the GitLab destination root group path,
+19 −8
Original line number Diff line number Diff line
@@ -20,18 +20,29 @@ The GitLab Synchronization Script has the following requirements:
* [curl tool](https://curl.se/) installed and accessible as `curl` command from the Bash interpreter
* [jq tool](https://stedolan.github.io/jq/download/) installed and accessible as `jq` command from the Bash interpreter

### Run the GitLab Synchronization Script
### Run the GitLab Copy CLI

1. Create an empty `to-be-continuous` root group with `public` visibility.
2. In the `to-be-continuous` root group, generate a [group access token](https://docs.gitlab.com/ee/user/group/settings/group_access_tokens.html) with scopes `api,read_registry,write_registry,read_repository,write_repository` and with `Owner` role.
3. Store the token in `GITLAB_TOKEN` environment variable (`export GITLAB_TOKEN="<the token>"`).
4. Execute the following command to **recursively copy the tbc group**:
2. In the `to-be-continuous` root group, generate a [group access token](https://docs.gitlab.com/ee/user/group/settings/group_access_tokens.html) with scopes 
   `api,read_registry,write_registry,read_repository,write_repository` and with `Owner` role.
3. Store the token in the `GITLAB_TOKEN` environment variable (`export GITLAB_TOKEN="<the token>"`).
4. Install our [GitLab Copy CLI](https://gitlab.com/to-be-continuous/tools/gitlab-cp#usage) (requires Python 3.11 or higher):
    ```bash
    curl -s https://gitlab.com/to-be-continuous/tools/gitlab-sync/-/raw/master/gitlab-sync.sh | bash /dev/stdin --dest-api https://your.gitlab.host/api/v4 --dest-token $GITLAB_TOKEN --exclude samples,custom
    pip install gitlab-cp --index-url https://gitlab.com/api/v4/projects/56596421/packages/pypi/simple
    ```
5. Run the following command to **recursively copy the tbc group** to your own server:
    ```bash
    gitlab-cp \
        --src-api https://gitlab.com/api/v4 \
        --src-sync-path to-be-continuous \
        --dest-api https://your.gitlab.host/api/v4 \
        --dest-sync-path to-be-continuous \
        --exclude samples \
        --exclude custom \
        --dest-token "$GITLAB_TOKEN"
    ```

That should take a while, but hopefully at the end you'll have cloned the complete _to be continuous_
group and projects :tada:.
That should take a while, but hopefully at the end you'll have cloned the complete _to be continuous_ group and projects :tada:.

!!! WARNING "Installing _to be continuous_ in a custom root group"
    By default and preferably, _to be continuous_ shall be installed:
@@ -64,7 +75,7 @@ For this, you only have to create a [scheduled pipeline](https://docs.gitlab.com
1. declare the CI/CD project variable `GITLAB_TOKEN` with the previously created token (mark it as [masked](https://docs.gitlab.com/ee/ci/variables/#mask-a-cicd-variable)),
2. create a scheduled pipeline (for instance every day at 2:00 am).

All other required variables shall be retrieved from [GitLab CI predefined variables](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html).
All other required variables will be automatically retrieved from [GitLab CI predefined variables](https://docs.gitlab.com/ee/ci/variables/predefined_variables.html).

!!! WARNING
    From this point, you might not make any commit in any local copy of _to be continuous_ projects