summaryrefslogtreecommitdiff
path: root/lib/api/internal.rb
Commit message (Collapse)AuthorAgeFilesLines
* Remove the mr_push_options feature flagLuke Duncalfe2019-05-171-6/+2
| | | | | | | | `Gitlab::QueryLimiting.whitelist` has been moved from being inside the feature flag conditional check to the `process_mr_push_options` `Api::Internal` helper. https://gitlab.com/gitlab-org/gitlab-ce/issues/60250
* Whitelist query limits for internal APIStan Hu2019-05-031-0/+2
| | | | | | | | | When creating a merge request for push options, there may be over 100 queries that are run to create a merge request. Even after we reduce the number of queries by disabling the Sidekiq jobs, it appears we still hover near this limit. Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/11450
* Feature flag for merge requestion push optionsLuke Duncalfe2019-04-091-2/+4
| | | | | https://gitlab.com/gitlab-org/gitlab-ce/issues/43263 https://gitlab.com/gitlab-org/gitlab-ce/issues/53198
* Refactor PushOptionsHandlerService from reviewLuke Duncalfe2019-04-091-18/+2
| | | | | | | | | | Exceptions are no longer raised, instead all errors encountered are added to the errors property. MergeRequests::BuildService is used to generate attributes of a new merge request. Code moved from Api::Internal to Api::Helpers::InternalHelpers.
* Use Gitlab::PushOptions for `ci.skip` push optionLuke Duncalfe2019-04-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously the raw push option Array was sent to Pipeline::Chain::Skip. This commit updates this class (and the chain of classes that pass the push option parameters from the API internal `post_receive` endpoint to that class) to treat push options as a Hash of options parsed by GitLab::PushOptions. The GitLab::PushOptions class takes options like this: -o ci.skip -o merge_request.create -o merge_request.target=branch and turns them into a Hash like this: { ci: { skip: true }, merge_request: { create: true, target: 'branch' } } This now how Pipeline::Chain::Skip is determining if the `ci.skip` push option was used.
* Support merge request create with push optionsLuke Duncalfe2019-04-091-7/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To create a new merge request: git push -u origin -o merge_request.create To create a new merge request setting target branch: git push -u origin -o merge_request.create \ -o merge_request.target=123 To update an existing merge request with a new target branch: git push -u origin -o merge_request.target=123 A new Gitlab::PushOptions class handles parsing and validating the push options array. This can be the start of the standard of GitLab accepting push options that follow namespacing rules. Rules are discussed in issue https://gitlab.com/gitlab-org/gitlab-ce/issues/43263. E.g. these push options: -o merge_request.create -o merge_request.target=123 Become parsed as: { merge_request: { create: true, target: '123', } } And are fetched with the class via: push_options.get(:merge_request) push_options.get(:merge_request, :create) push_options.get(:merge_request, :target) A new MergeRequests::PushOptionsHandlerService takes the `merge_request` namespaced push options and handles creating and updating merge requests. Any errors encountered are passed to the existing `output` Hash in Api::Internal's `post_receive` endpoint, and passed to gitlab-shell where they're output to the user. Issue https://gitlab.com/gitlab-org/gitlab-ce/issues/43263
* Allow console messages be sent to gitlab-shell9217-warn-on-git-fetch-over-ssh-if-the-secondary-is-lagging-the-primaryAsh McKenzie2019-04-041-1/+2
| | | | Currently a no-op for CE
* Allow multiple repositories per projectBob Van Landuyt2019-03-261-1/+1
| | | | | | | | This changes the repository type from a binary `wiki?` to a type. So we can have more than 2 repository types. Now everywhere we called `.wiki?` and expected a boolean, we check that type.
* Merge branch 'resolve-lib-differences' into 'master'Robert Speicher2019-03-121-1/+9
|\ | | | | | | | | Resolve CE to EE differences in the lib/api directory See merge request gitlab-org/gitlab-ce!25430
| * Move LFS HTTP URL to a separate methodYorick Peterse2019-03-041-1/+9
| | | | | | | | | | | | This adds a method to API::Internal that returns the URL to use for LFS authentication tokens. This makes it possible for EE to redefine this behaviour, without having to directly modify the source code.
* | Remove fake repository_path responseFabio Papa2019-03-121-5/+0
|/ | | | | | The repository_path is no longer needed since https://gitlab.com/gitlab-org/gitlab-shell/merge_requests/231, which closes https://gitlab.com/gitlab-org/gitlab-shell/issues/135.
* Include gl_project_path in API /internal/allowed responseStan Hu2019-02-161-0/+1
| | | | | | This will enable us to track the human-readable project path with SSH access in gitlab-shell. Currently the Gitaly logs will only show the hashed storage and gl_repository path (e.g. project-1234).
* Include expires_in for LFS authentication payload57353-git-push-fails-on-large-lfs-files-where-the-push-take-a-long-timeAsh McKenzie2019-02-151-1/+1
| | | | | | | | | When using git-lfs with SSH we weren't passing in the expires_header header which is allows large transfers to succeed in the event the current default of 30 mins expires. https://github.com/git-lfs/git-lfs/blob/master/docs/api/server-discovery.md#ssh
* Move LFS auth hash creation into GitLab::LfsTokenAsh McKenzie2019-02-111-7/+1
|
* Add support for Git push options, specifically ci.skipJonathon Reinhart2018-12-311-1/+2
| | | | | | | | | | | | | | | | | gitlab-org/gitlab-shell!166 added support for collecting push options from the environment, and passing them along to the /internal/post_receive API endpoint. This change handles the new push_options JSON element in the payload, and passes them on through to the GitPushService and GitTagPushService services. Futhermore, it adds support for the first push option, ci.skip. With this change, one can use 'git push -o ci.skip' to skip CI pipe execution. Note that the pipeline is still created, but in the "skipped" state, just like with the 'ci skip' commit message text. Implements #18667
* Adds tracing messages for slow git pushesTiago Botelho2018-10-251-0/+2
| | | | | | Whenever a git push takes more than 50 seconds the user will receive a trace from each check performed along with their timings
* Make getting a user by the username case insensitiveWilliam George2018-10-181-2/+2
|
* Enable frozen string in lib/api and lib/backupgfyoung2018-09-291-0/+2
| | | | | | | | | | Partially addresses #47424. Had to make changes to spec files because stubbing methods on frozen objects is a mess in RSpec and leads to failures: https://github.com/rspec/rspec-mocks/issues/1190
* Disable existing offenses for the CodeReuse copsYorick Peterse2018-09-111-0/+10
| | | | | This whitelists all existing offenses for the various CodeReuse cops, of which most are triggered by the CodeReuse/ActiveRecord cop.
* Add receive_max_input_size setting to Application settingsRubén Dávila2018-09-071-0/+8
| | | | | If user has configure the setting then it will be passed to gitlab-shell and gitlab-workhorse
* Update /api/v4/allowedAsh McKenzie2018-09-061-21/+38
| | | | | - Use proper HTTP codes for /api/v4/allowed response - CustomAction support
* Add support for SSH certificate authenticationÆvar Arnfjörð Bjarmason2018-08-011-17/+38
| | | | | | | | | | | | | | | | | | | | Why and how to enable this is covered in the docs being changed here. This requires gitlab-org/gitlab-shell@2e8b670 ("Add support for SSH certificate authentication", 2018-06-14) which has been merged in and tagged as 8.0.0, so GITLAB_SHELL_VERSION needs to be bumped. Merging this closes gitlab-org/gitlab-ce#34572 see gitlab-org/gitlab-shell!207 for the gitlab-shell MR. Implementation notes: - The APIs being changed here are all internal, and their sole consumer is gitlab-shell. - Most of the changed code is a MR to gitlab-shell, see the gitlab-org/gitlab-shell!207 MR. That change covers why only some of the internal methods get a new "username" parameter, and why some others only get a "user_id".
* Merge branch 'zj-internal-repo-path' into 'master'Grzegorz Bizon2018-05-281-1/+5
|\ | | | | | | | | Don't pass the repository path to Gitlab Shell See merge request gitlab-org/gitlab-ce!19011
| * Return '/' as a bogus repo path to gitlab-shellzj-internal-repo-pathJacob Vosmaer2018-05-251-1/+5
| |
| * Don't pass the repository path to Gitlab ShellZeger-Jan van de Weg2018-05-171-1/+1
| | | | | | | | This isn't a requirement, and removes deprecated method calls
* | Replace Gitlab::REVISION with Gitlab.revision and handle installations ↵46600-fix-gitlab-revision-when-not-in-git-repoRémy Coutable2018-05-241-1/+1
|/ | | | | | without a .git directory Signed-off-by: Rémy Coutable <remy@rymai.me>
* Resolve "Make a Rubocop that forbids returning from a block"🙈 jacopo beschi 🙉2018-04-181-5/+5
|
* Remove support for absolute dirs from Git::EnvJacob Vosmaer (GitLab)2018-03-301-2/+1
|
* Use hashed storage in the specs40744-hashed-storage-specsNick Thomas2018-02-071-1/+1
|
* Moves project creationg to git access check for git pushTiago Botelho2018-02-061-10/+5
|
* Abstracts ProjectMoved and ProjectCreated into a BaseProjectTiago Botelho2018-02-061-2/+2
|
* Move new project on push logic to a serviceTiago Botelho2018-02-061-9/+7
|
* Add specsTiago Botelho2018-02-061-8/+1
|
* Adds remote messsage when project is created in a push over SSH or HTTPTiago Botelho2018-02-061-5/+12
|
* Adds option to push over SSH to create a new projectTiago Botelho2018-02-061-1/+14
|
* Adds Rubocop rule for line break around conditionals🙈 jacopo beschi 🙉2018-01-111-0/+1
|
* Backport authorized_keys branch 'find-key-by-fingerprint'Pablo Carranza2018-01-081-0/+12
| | | | | | | | | | | | | | | | | | | | | Add find key by base64 key or fingerprint to the internal API See merge request !250 Squashed changes: Add unique index to fingerprint Add new index to schema Add internal api to get ssh key by fingerprint Change API endpoint to authorized_keys Add InsecureKeyFingerprint that calculates the fingerprint without shelling out Add require for gitlab key fingerprint Remove uniqueness of fingerprint index Remove unique option from migration Fix spec style in fingerprint test Fix rubocop complain Extract insecure key fingerprint to separate file Change migration to support building index concurrently Remove those hideous tabs
* Gracefully handle orphaned write deploy keys in /internal/post_receivesh-handle-orphaned-deploy-keysStan Hu2017-12-241-3/+6
| | | | | | | | | On GitLab.com, there are write deploy keys with no associated users. Pushes with these deploy keys end with an Error 500 since we attempt to look up redirect message. If there is no user, don't attempt to display a redirect message. Closes #41466
* Allow git pull/push on project redirectsMayra Cabrera2017-12-081-2/+11
|
* Use relative git object paths to construct absolute ones before setting Envfix/git-env-repo-pathsAhmad Sherif2017-11-141-1/+3
|
* add username to authorized result, so that gitlab-shell can pass it to hooksDavid Turner2017-09-291-0/+7
|
* refactor users update serviceJames Lopez2017-09-281-1/+1
|
* refactor services to match EE signatureJames Lopez2017-09-281-1/+1
|
* Implement /internal/pre-receive for shell operationsAlejandro Rodríguez2017-09-051-0/+8
|
* Return a value to check if redis is available on /internal/checkAlejandro Rodríguez2017-09-051-1/+2
|
* Implement /internal/post_receive unified endpoint for PostReceive tasksgitaly-shell-redisAlejandro Rodríguez2017-08-311-1/+16
|
* Renamed Gitaly servicesAndrew Newdigate2017-07-181-1/+1
|
* Handle case when BroadcastMessage.current is nilStan Hu2017-07-131-1/+1
| | | | | | | Somehow Rails.cache.fetch occasionally returns `nil` values, which causes this endpoint to crash. Closes #35094
* Send Gitaly Repository with /api/internal/allowedgitaly-internal-allowed-send-repoKim "BKC" Carlbäcker2017-07-071-1/+2
| | | | | - Make single gitaly payload - Add feature-flag specs to verify payload
* update code based on feedbackJames Lopez2017-06-231-2/+4
|