Commit Graph

69 Commits

Author SHA1 Message Date
GitLab Bot 9972dddfe0 Add latest changes from gitlab-org/gitlab@master 2025-05-07 21:12:35 +00:00
GitLab Bot 77466783f6 Add latest changes from gitlab-org/gitlab@master 2025-02-14 03:12:26 +00:00
GitLab Bot a26438c547 Add latest changes from gitlab-org/gitlab@master 2025-02-12 21:11:54 +00:00
GitLab Bot 15cc871f89 Add latest changes from gitlab-org/gitlab@master 2025-01-10 18:27:33 +00:00
GitLab Bot 06e48d0168 Add latest changes from gitlab-org/gitlab@master 2024-10-08 00:13:36 +00:00
GitLab Bot f429d27fd3 Add latest changes from gitlab-org/gitlab@master 2024-08-30 12:12:45 +00:00
GitLab Bot 62cf14d9de Add latest changes from gitlab-org/gitlab@master 2024-04-12 09:13:20 +00:00
GitLab Bot 33cd068657 Add latest changes from gitlab-org/gitlab@master 2024-04-11 15:10:10 +00:00
GitLab Bot 9057f06ae6 Add latest changes from gitlab-org/gitlab@master 2024-03-28 15:10:54 +00:00
GitLab Bot a4d135ac38 Add latest changes from gitlab-org/gitlab@master 2024-03-05 15:09:16 +00:00
GitLab Bot 78ea62d0cf Add latest changes from gitlab-org/gitlab@master 2024-02-28 21:09:33 +00:00
GitLab Bot 4aa6fba6d8 Add latest changes from gitlab-org/gitlab@master 2023-12-21 00:13:46 +00:00
GitLab Bot 5fcd4e5fbc Add latest changes from gitlab-org/gitlab@master 2023-10-16 18:10:30 +00:00
GitLab Bot 1bbd0179d7 Add latest changes from gitlab-org/gitlab@master 2023-06-29 18:10:36 +00:00
GitLab Bot fa69a57b46 Add latest changes from gitlab-org/gitlab@master 2023-04-26 18:19:16 +00:00
GitLab Bot f6b58d1490 Add latest changes from gitlab-org/gitlab@master 2023-03-15 18:11:11 +00:00
GitLab Bot b50c9d31e3 Add latest changes from gitlab-org/gitlab@master 2023-03-15 12:13:34 +00:00
GitLab Bot e22c3819ad Add latest changes from gitlab-org/gitlab@master 2023-03-06 18:08:12 +00:00
GitLab Bot 919e3e3cd8 Add latest changes from gitlab-org/gitlab@master 2023-02-07 21:09:58 +00:00
GitLab Bot 33998a0e76 Add latest changes from gitlab-org/gitlab@master 2023-02-06 18:09:43 +00:00
GitLab Bot 5db6a7a014 Add latest changes from gitlab-org/gitlab@master 2023-01-05 15:08:39 +00:00
GitLab Bot 17c478bc80 Add latest changes from gitlab-org/gitlab@master 2022-12-15 00:08:38 +00:00
GitLab Bot af833d9730 Add latest changes from gitlab-org/gitlab@master 2022-12-02 18:07:23 +00:00
GitLab Bot dcd075c981 Add latest changes from gitlab-org/gitlab@master 2022-10-14 00:10:41 +00:00
GitLab Bot 0cd52ae4af Add latest changes from gitlab-org/gitlab@master 2022-10-13 00:08:53 +00:00
GitLab Bot 146284d119 Add latest changes from gitlab-org/gitlab@master 2022-10-05 12:09:04 +00:00
GitLab Bot 99aa31992d Add latest changes from gitlab-org/gitlab@master 2022-09-15 18:10:36 +00:00
GitLab Bot 57b795ee00 Add latest changes from gitlab-org/gitlab@master 2022-06-22 06:08:52 +00:00
GitLab Bot d2675fa4de Add latest changes from gitlab-org/gitlab@master 2022-06-09 15:09:21 +00:00
GitLab Bot 1843215ebb Add latest changes from gitlab-org/gitlab@master 2022-04-15 09:08:25 +00:00
GitLab Bot e7fb614993 Add latest changes from gitlab-org/gitlab@master 2022-03-31 18:08:39 +00:00
GitLab Bot 82f12c2090 Add latest changes from gitlab-org/gitlab@master 2022-03-23 18:08:47 +00:00
GitLab Bot d237ada361 Add latest changes from gitlab-org/gitlab@master 2022-01-12 00:16:35 +00:00
GitLab Bot 1361891b0a Add latest changes from gitlab-org/gitlab@master 2020-12-09 12:09:42 +00:00
GitLab Bot c19dce027b Add latest changes from gitlab-org/gitlab@master 2020-11-13 21:09:31 +00:00
GitLab Bot bd27a42f54 Add latest changes from gitlab-org/gitlab@master 2020-08-11 12:09:55 +00:00
GitLab Bot 0790cf032c Add latest changes from gitlab-org/gitlab@master 2020-08-06 21:10:15 +00:00
GitLab Bot 58320d8e03 Add latest changes from gitlab-org/gitlab@master 2020-07-29 15:09:39 +00:00
GitLab Bot 640e72ca92 Add latest changes from gitlab-org/gitlab@master 2020-06-04 03:08:05 +00:00
GitLab Bot 0d6fa03312 Add latest changes from gitlab-org/gitlab@master 2020-02-06 18:08:54 +00:00
GitLab Bot 1ce6af4aad Add latest changes from gitlab-org/gitlab@master 2020-01-24 00:08:51 +00:00
Matija Čupić 1f40372029
Do not authorize with OAuth for CICD only projects 2019-07-23 11:48:23 +02:00
gfyoung 93a44e135b Add some frozen string to spec/**/*.rb
Adds frozen string to the following:

* spec/bin/**/*.rb
* spec/config/**/*.rb
* spec/controllers/**/*.rb

xref https://gitlab.com/gitlab-org/gitlab-ce/issues/59758
2019-04-15 10:17:05 +00:00
Luke Bennett 534a61179e
Improve the GitHub and Gitea import feature table interface
These are backend changes.
Use Vue for the import feature UI for "githubish"
providers (GitHub and Gitea).
Add "Go to project" button after a successful import.
Use CI-style status icons and improve spacing of the
table and its component.
Adds ETag polling to the github and gitea import
jobs endpoint.
2019-02-13 00:15:57 +00:00
Stan Hu 88f2e9615c
Alias GitHub and BitBucket OAuth2 callback URLs
To prevent an OAuth2 covert redirect vulnerability, this commit adds and
uses an alias for the GitHub and BitBucket OAuth2 callback URLs to the
following paths:

GitHub: /users/auth/-/import/github
Bitbucket: /users/auth/-/import/bitbucket

This allows admins to put a more restrictive callback URL in the OAuth2
configuration settings. Instead of https://example.com, admins can now use:

https://example.com/users/auth

It's possible but not trivial to change Devise and OmniAuth to use a
different prefix for callback URLs instead of /users/auth. For now,
aliasing the import URLs under the /users/auth namespace should suffice.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/56663
2019-01-31 16:52:48 +01:00
Stan Hu b4e2679437 Allow GitHub imports via token even if OAuth2 provider not configured
Previously, the GitHub importer would only work if the site configured
an OAuth2 provider were configured. Users attempting to import via a
GitHub personal access token would see an Error 500 due to a failed
redirection. We fix this by only doing the redirection if the provider
has been configured and allowing users to see the new import page.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/38524
2018-12-10 11:56:14 -08:00
Yorick Peterse 4dfe26cd8b
Rewrite the GitHub importer from scratch
Prior to this MR there were two GitHub related importers:

* Github::Import: the main importer used for GitHub projects
* Gitlab::GithubImport: importer that's somewhat confusingly used for
  importing Gitea projects (apparently they have a compatible API)

This MR renames the Gitea importer to Gitlab::LegacyGithubImport and
introduces a new GitHub importer in the Gitlab::GithubImport namespace.
This new GitHub importer uses Sidekiq for importing multiple resources
in parallel, though it also has the ability to import data sequentially
should this be necessary.

The new code is spread across the following directories:

* lib/gitlab/github_import: this directory contains most of the importer
  code such as the classes used for importing resources.
* app/workers/gitlab/github_import: this directory contains the Sidekiq
  workers, most of which simply use the code from the directory above.
* app/workers/concerns/gitlab/github_import: this directory provides a
  few modules that are included in every GitHub importer worker.

== Stages

The import work is divided into separate stages, with each stage
importing a specific set of data. Stages will schedule the work that
needs to be performed, followed by scheduling a job for the
"AdvanceStageWorker" worker. This worker will periodically check if all
work is completed and schedule the next stage if this is the case. If
work is not yet completed this worker will reschedule itself.

Using this approach we don't have to block threads by calling `sleep()`,
as doing so for large projects could block the thread from doing any
work for many hours.

== Retrying Work

Workers will reschedule themselves whenever necessary. For example,
hitting the GitHub API's rate limit will result in jobs rescheduling
themselves. These jobs are not processed until the rate limit has been
reset.

== User Lookups

Part of the importing process involves looking up user details in the
GitHub API so we can map them to GitLab users. The old importer used
an in-memory cache, but this obviously doesn't work when the work is
spread across different threads.

The new importer uses a Redis cache and makes sure we only perform
API/database calls if absolutely necessary.  Frequently used keys are
refreshed, and lookup misses are also cached; removing the need for
performing API/database calls if we know we don't have the data we're
looking for.

== Performance & Models

The new importer in various places uses raw INSERT statements (as
generated by `Gitlab::Database.bulk_insert`) instead of using Rails
models. This allows us to bypass any validations and callbacks,
drastically reducing the number of SQL queries and Gitaly RPC calls
necessary to import projects.

To ensure the code produces valid data the corresponding tests check if
the produced rows are valid according to the model validation rules.
2017-11-07 23:24:59 +01:00
Grzegorz Bizon 0430b76441 Enable Style/DotPosition Rubocop 👮 2017-06-21 13:48:12 +00:00
Rémy Coutable e046e4c14d Namespace access token session key in `Import::GithubController`
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-19 17:35:51 +01:00
Rémy Coutable 103114e3d7 Rename Gogs to Gitea, DRY the controller and improve views
Signed-off-by: Rémy Coutable <remy@rymai.me>
2016-12-19 17:35:51 +01:00