diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-13 15:09:32 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-10-13 15:09:32 +0000 |
commit | bd25f1d9c685039381df23e49bc52cdcf4ec1b4a (patch) | |
tree | 33b3b16ae2ef653f74828f69742154122ff0ac2d /doc | |
parent | 70ce746bd011b101605e6d84f141d1f0c3175831 (diff) | |
download | gitlab-ce-bd25f1d9c685039381df23e49bc52cdcf4ec1b4a.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc')
-rw-r--r-- | doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md | 31 | ||||
-rw-r--r-- | doc/api/alert_management_alerts.md | 2 | ||||
-rw-r--r-- | doc/api/product_analytics.md | 5 | ||||
-rw-r--r-- | doc/user/project/repository/mirror/index.md | 35 |
4 files changed, 40 insertions, 33 deletions
diff --git a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md index 6c716274df2..d730d62a0ce 100644 --- a/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md +++ b/doc/administration/troubleshooting/gitlab_rails_cheat_sheet.md @@ -262,36 +262,7 @@ This content has been converted to a Rake task, see [verify database values can ### Transfer mirror users and tokens to a single service account -Use case: If you have multiple users using their own GitHub credentials to set up -repository mirroring, mirroring breaks when people leave the company. Use this -script to migrate disparate mirroring users and tokens into a single service account: - -```ruby -svc_user = User.find_by(username: 'ourServiceUser') -token = 'githubAccessToken' - -Project.where(mirror: true).each do |project| - import_url = project.import_url - - # The url we want is https://token@project/path.git - repo_url = if import_url.include?('@') - # Case 1: The url is something like https://23423432@project/path.git - import_url.split('@').last - elsif import_url.include?('//') - # Case 2: The url is something like https://project/path.git - import_url.split('//').last - end - - next unless repo_url - - final_url = "https://#{token}@#{repo_url}" - - project.mirror_user = svc_user - project.import_url = final_url - project.username_only_import_url = final_url - project.save -end -``` +This content has been moved to [Troubleshooting Repository mirroring](../../user/project/repository/mirror/index.md#transfer-mirror-users-and-tokens-to-a-single-service-account-in-rails-console). ## Users diff --git a/doc/api/alert_management_alerts.md b/doc/api/alert_management_alerts.md index 44756863938..bf3d6287341 100644 --- a/doc/api/alert_management_alerts.md +++ b/doc/api/alert_management_alerts.md @@ -79,7 +79,7 @@ Example response: ## Update metric image ```plaintext -PUT /projects/:id/alert_management_alerts/:alert_iid/metric_image/:image_id +PUT /projects/:id/alert_management_alerts/:alert_iid/metric_images/:image_id ``` | Attribute | Type | Required | Description | diff --git a/doc/api/product_analytics.md b/doc/api/product_analytics.md index 2409167b363..4653a52732a 100644 --- a/doc/api/product_analytics.md +++ b/doc/api/product_analytics.md @@ -21,7 +21,7 @@ Make sure to define the `cube_api_base_url` and `cube_api_key` application setti Generate an access token that can be used to query the Cube API. For example: ```plaintext -POST /projects/:id/product_analytics/request +POST /projects/:id/product_analytics/request/load ``` | Attribute | Type | Required | Description | @@ -62,6 +62,7 @@ The body of the request should be a valid Cube query. "Jitsu.docPath" ], "limit": 23 - } + }, + "queryType": "multi" } ``` diff --git a/doc/user/project/repository/mirror/index.md b/doc/user/project/repository/mirror/index.md index 2eb8c15c9ec..fa6d8d82559 100644 --- a/doc/user/project/repository/mirror/index.md +++ b/doc/user/project/repository/mirror/index.md @@ -316,3 +316,38 @@ Mirroring does not support the short version of SSH clone URLs (`git@gitlab.com: and requires the full version including the protocol (`ssh://git@gitlab.com/gitlab-org/gitlab.git`). Make sure that host and project path are separated using `/` instead of `:`. + +### Transfer mirror users and tokens to a single service account in Rails console + +This requires access to the [GitLab Rails console](../../../../administration/operations/rails_console.md#starting-a-rails-console-session). + +Use case: If you have multiple users using their own GitHub credentials to set up +repository mirroring, mirroring breaks when people leave the company. Use this +script to migrate disparate mirroring users and tokens into a single service account: + +```ruby +svc_user = User.find_by(username: 'ourServiceUser') +token = 'githubAccessToken' + +Project.where(mirror: true).each do |project| + import_url = project.import_url + + # The url we want is https://token@project/path.git + repo_url = if import_url.include?('@') + # Case 1: The url is something like https://23423432@project/path.git + import_url.split('@').last + elsif import_url.include?('//') + # Case 2: The url is something like https://project/path.git + import_url.split('//').last + end + + next unless repo_url + + final_url = "https://#{token}@#{repo_url}" + + project.mirror_user = svc_user + project.import_url = final_url + project.username_only_import_url = final_url + project.save +end +``` |