summaryrefslogtreecommitdiff
path: root/app/controllers/import/github_controller.rb
Commit message (Collapse)AuthorAgeFilesLines
* Add latest changes from gitlab-org/gitlab@13-7-stable-eev13.7.0-rc42GitLab Bot2020-12-171-8/+14
|
* Add latest changes from gitlab-org/gitlab@13-6-stable-eev13.6.0-rc42GitLab Bot2020-11-191-8/+12
|
* Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42GitLab Bot2020-10-211-1/+1
|
* Add latest changes from gitlab-org/gitlab@13-3-stable-eeGitLab Bot2020-08-201-7/+69
|
* Add latest changes from gitlab-org/gitlab@13-2-stable-eeGitLab Bot2020-07-201-58/+41
|
* Add latest changes from gitlab-org/gitlab@13-1-stable-eeGitLab Bot2020-06-181-1/+1
|
* Add latest changes from gitlab-org/gitlab@13-0-stable-eeGitLab Bot2020-05-201-1/+1
|
* Add latest changes from gitlab-org/gitlab@masterGitLab Bot2020-04-141-1/+9
|
* Add latest changes from gitlab-org/gitlab@masterGitLab Bot2019-09-181-3/+18
|
* Add latest changes from gitlab-org/gitlab@masterGitLab Bot2019-09-181-1/+1
|
* Add latest changes from gitlab-org/gitlab@masterGitLab Bot2019-09-131-0/+2
|
* Do not authorize with OAuth for CICD only projectsmc/feature/use-only-pat-cicd-projectsMatija Čupić2019-07-231-2/+6
|
* Improve the GitHub and Gitea import feature table interfaceLuke Bennett2019-02-131-13/+70
| | | | | | | | | | | 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.
* Alias GitHub and BitBucket OAuth2 callback URLsStan Hu2019-01-311-1/+1
| | | | | | | | | | | | | | | | | | | | 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
* Backport github import fix from EEDmitriy Zaporozhets2019-01-171-1/+5
| | | | | | For codebase consistency Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
* API for importing external reposBen2019-01-171-20/+9
|
* Allow GitHub imports via token even if OAuth2 provider not configuredStan Hu2018-12-101-1/+1
| | | | | | | | | | 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
* Fix typos in comments and specsGeorge Tsiolis2018-11-011-1/+1
|
* Strip whitespace around GitHub personal access tokensStan Hu2018-10-171-1/+1
| | | | | | | Some browsers insert a trailing whitespace after pasting the token into the field. This should help reduce confusion. Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/46588
* Enable more frozen string in app/controllers/gfyoung2018-09-231-0/+2
| | | | | | | | | | | | | | | | Enables frozen string for the following: * app/controllers/dashboard/**/*.rb * app/controllers/explore/**/*.rb * app/controllers/google_api/**/*.rb * app/controllers/groups/**/*.rb * app/controllers/import/**/*.rb * app/controllers/instance_statistics/**/*.rb * app/controllers/ldap/**/*.rb * app/controllers/oauth/**/*.rb * app/controllers/profiles/**/*.rb Partially addresses #47424.
* Disable existing offenses for the CodeReuse copsYorick Peterse2018-09-111-0/+4
| | | | | This whitelists all existing offenses for the various CodeReuse cops, of which most are triggered by the CodeReuse/ActiveRecord cop.
* Show a more helpful error for import statusStan Hu2018-06-061-1/+1
| | | | | | | | Importing a project from GitHub for a project namespace that already exists would show an unhelpful error, "An error occurred while importing project." We now add the base message from Projects::CreateService when this fails. Closes #47365
* Backports every CE related change from ee-44542 to CETiago Botelho2018-05-041-3/+2
|
* CE backport for creating CI/CD projects from GitHubRubén Dávila2018-03-071-4/+14
|
* Replace $.post in importer status with axiosClement Ho2018-02-091-7/+12
|
* Rewrite the GitHub importer from scratchYorick Peterse2017-11-071-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Whitelist or fix additional `Gitlab/PublicSend` cop violationsrs-more-public-send-whitelistsRobert Speicher2017-08-141-1/+1
| | | | | An upcoming update to rubocop-gitlab-security added additional violations.
* Re-enable SqlInjection and CommandInjectionBrian Neel2017-08-081-3/+3
|
* Namespace access token session key in `Import::GithubController`Rémy Coutable2016-12-191-7/+11
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Improve Gitlab::ImportSourcesRémy Coutable2016-12-191-1/+1
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* Rename Gogs to Gitea, DRY the controller and improve viewsRémy Coutable2016-12-191-34/+57
| | | | Signed-off-by: Rémy Coutable <remy@rymai.me>
* modify github import JS and controller so we can now specify a namespace ↵James Lopez2016-09-201-3/+4
| | | | | | | | and/or name for a project. - Fixed and added specs. - Added different namespace options depending on user privilages - Updated docs.
* Refactoring Import::BaseController#find_or_create_namespaceDouglas Barbosa Alexandre2016-08-311-2/+6
|
* Don't create groups for unallowed users when importing projectsDouglas Barbosa Alexandre2016-08-311-6/+1
|
* Make GH one-off auth the default again for importing GH projectsRémy Coutable2016-06-301-1/+1
| | | | | | Advertise the PAT as an alternative unless GH import is not configured. Signed-off-by: Rémy Coutable <remy@rymai.me>
* Import from Github using Personal Access Tokens.Eric K Idema2016-06-301-3/+22
| | | | | | | | | | | | | This stands as an alternative to using OAuth to access a user's Github repositories. This is setup in such a way that it can be used without OAuth configuration. From a UI perspective, the how to import modal has been replaced by a full page, which includes a form for posting a personal access token back to the Import::GithubController. If the user has logged in via GitHub, skip the Personal Access Token and go directly to Github for an access token via OAuth.
* Fix duplicate repositories in GitHub import pageStan Hu2015-10-191-4/+0
| | | | | | | | | | | | | By default, all the current user's repositories are accessible via the /users endpoint. There's no need to traverse all the organization repositories as well. See: * http://www.rubydoc.info/github/pengwynn/octokit/Octokit/Client/Repositories#repositories-instance_method * https://developer.github.com/v3/repos/#list-your-repositories Closes #2523
* Only render 404 page from /publicinified_404_errorValery Sizov2015-10-131-1/+1
|
* Remove user OAuth tokens stored in database for Bitbucket, GitHub, and GitLabStan Hu2015-08-231-6/+10
| | | | | | | | | | | | | | | | | | | | | | | and request them each session. Pass these tokens to the project import data. This prevents the need to encrypt these tokens and clear them in case they expire or get revoked. For example, if you deleted and re-created OAuth2 keys for Bitbucket, you would get an Error 500 with no way to recover: ``` Started GET "/import/bitbucket/status" for x.x.x.x at 2015-08-07 05:24:10 +0000 Processing by Import::BitbucketController#status as HTML Completed 500 Internal Server Error in 607ms (ActiveRecord: 2.3ms) NameError (uninitialized constant Import::BitbucketController::Unauthorized): app/controllers/import/bitbucket_controller.rb:77:in `rescue in go_to_bitbucket_for_permissions' app/controllers/import/bitbucket_controller.rb:74:in `go_to_bitbucket_for_permissions' app/controllers/import/bitbucket_controller.rb:86:in `bitbucket_unauthorized' ``` Closes #1871
* Fixed the Rails/ActionFilter copJeroen van Baarsen2015-04-201-3/+3
| | | | Signed-off-by: Jeroen van Baarsen <jeroenvanbaarsen@gmail.com>
* Import GitHub, Bitbucket or GitLab.com projects owned by authenticated user ↵Douwe Maan2015-03-311-1/+4
| | | | into current namespace.
* Fix missing GitHub organisation repositories on import page.Douwe Maan2015-03-121-1/+1
|
* Load public key in initializer.Douwe Maan2015-02-241-0/+5
|
* GitHub importer refactoringValery Sizov2015-02-051-15/+7
|
* gitlab.com importer: refactorigValery Sizov2015-02-051-17/+5
|
* Gitlab.com integration: code foldingValery Sizov2015-02-051-1/+1
|
* GitLab.com integration: refactoringValery Sizov2015-02-051-0/+80