Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
AgeCommit message (Collapse)Author
2016-07-08Merge branch '18627-wildcard-branch-protection' into 'master' Douwe Maan
Allow specifying protected branches using wildcards Closes #18627 # Tasks - [ ] #18627 !4665 Allow specifying protected branches using wildcards - [x] Find existing usages of protected branches - Protecting branches - `ProtectedBranchesController` is used to mark a branch protected/unprotected - `API::Branches` can be used to mark a branch protected/unprotected - Enforcing branch protection - `Gitlab::GitAccess` has helpers (`can_push_to_branch?`, `check`) that are used to deny pushes if a branch is protected - Over SSH: `gitlab-shell` receives a push, and calls `/allowed` on the GitLab API, which calls `GitAccess.check` - Over HTTP: - `gitlab-workhorse` receives the request, and forwards it to rails - Rails (in the `GitHttpController#git-recieve-pack`) runs basic checks (is the user logged in, not protected branch checks) and returns ok with `GL_ID` and `RepoPath` - `gitlab-workhorse` looks at the response, and calls the relevant `gitlab-shell` action from `git-http/handlePostRPC` - Rest of this flow is the same as the SSH flow above - [x] Implementation - [x] Backend - [x] Change `project#protected_branch?` to look at wildcard protected branches - [x] Change `project#developers_can_push_to_protected_branch?` - [x] Change `project#open_branches` - [x] Better error message when creating a disallowed branch from the Web UI - [x] Frontend - [x] Protected branches page should allow typing out a wildcard pattern - [x] Add help text explaining the use of wildcards - [x] Show matching branches for each protected branch - [x] ~~On the index page~~ - [x] On a show page - [x] Index? - [x] Can't have the "last commit" column for wildcard protected branches - [x] Fix / write tests - [x] What happens if a hook is missing in dev? - [x] Refactor - [x] Test workflows - Create a branch matching a wildcard pattern - Push to a branch matching a wildcard pattern - Force push to a branch matching a wildcard pattern - Delete a branch matching a wildcard pattern - [x] Test using Web UI - [x] Test over SSH - [x] Test over HTTP - [x] Test as developer and master - [x] Investigate performance - [x] Test with a large number of protected branches / branches - [x] Paginate list of protected branches - [x] ~~Possibly rewrite `open_branches`~~ - [x] Add `iid`s to existing `ProtectedBranch`es - [x] Add documentation - [x] Add CHANGELOG entry - [x] Add screenshots - [x] Make sure [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/2f753e3ed2ce681b4444944d521f4419e8ed37f7/builds) passes - [x] Assign to endboss for review - [x] Address @DouweM's comments - [x] `protected_branch_params` - [x] `exact_match` instead of `explicit_match` - [x] When would self.name be blank? - [x] Move `protected_branches.each` to a partial - [x] Move `matching_branches.each` to a partial - [x] If the branch is in @matching_branches, it's not been removed - [x] move this regex to a method and memoize it - [x] `commit_sha` directly for exact matches - [x] Number of matches for wildcard matches, with a link - [x] Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/43f9ce0e88194b8f719bb1c1e656b7fc13278d56/builds) to pass - [x] Respond to @DouweM's comments - [x] Don't use iid - [x] Controller should use `@project.protected_branches.new` - [x] move the memoization to `def wildcard_regex` - [x] render with `collection: @protected_branches` - [x] Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/f7beedf122fa0c7aa89e86181fe7499321fb10ca/builds) to pass - [x] Wait for @DouweM's review - [x] Wait for @jschatz1's review - [x] Respond to @jschatz1's comments - [x] Use the new dropdown style - [x] description should be moved to the description section without the styling - [x] Protect button should be disabled when no branch is selected - [x] Update screenshots - [x] Merge conflicts - [x] Make sure [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/20f3cfe8d5540eab64c2ba548043d600b28c61ba/builds) passes - [ ] Revisit performance, possibly with staging/production data - [ ] Get a dump of staging / run against staging live - [ ] Get SSH access to staging - [ ] Wait for review/merge # Screenshots ## Creating wildcard protected branches ![1](/uploads/9446afccfdf6fa381e00c800dd2cc82e/1.png) ![2](/uploads/0b154503b297a818d3577488c575d845/2.png) ![3](/uploads/36217f79df9e41cc1550601f02627fe8/3.png) ![4](/uploads/041ca9bd529bcfa5373fca67e917cbcb/4.png) ### Using the `GLDropdown` component ![2016-06-30_14-16-15](/uploads/508afc2a5e2463c2954641409a560d88/2016-06-30_14-16-15.gif) ## Enforcing wildcard protected branches ### From the Web UI ![Screen_Shot_2016-06-20_at_1.21.18_PM](/uploads/8b5d4b1911e9152698a0488daf1880bc/Screen_Shot_2016-06-20_at_1.21.18_PM.png) ### Over SSH ![SSH](/uploads/7365989d7e4c406ef37b6ae5106442c9/SSH.gif) ### Over HTTPS ![HTTPS](/uploads/a7c0f56ae58efcffc75e6700fa2f4ac0/HTTPS.gif) ## Listing matching branches ![Screen_Shot_2016-06-20_at_1.33.44_PM](/uploads/d054113022f5d7ec64c0e57e501ac104/Screen_Shot_2016-06-20_at_1.33.44_PM.png) See merge request !4665
2016-07-07Merge branch 'new-diff-notes' into 'master' Douwe Maan
New diff notes Fixes #12732, #14731, #19375, #14783 Builds on https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4110 To do: - [x] Get it mostly working - [x] Validate position validity - [x] Fix: Don’t link to `#` - [x] Fix: Base ref can be `nil`, potentially, when the MR has an oprhan source branch => Yep, doesn’t work. We need to store a `start_id` - [x] Optimize: Fewer duplicate `git diff` compares - [x] Optimize: Pass paths to `PositionTracer#diff` for faster diffs - [x] Refactor: Use `head_id` in `MergeRequest`/`MergeRequestDiff` instead of `source_sha` - [x] Refactor: Convert existing array-based diff refs to the DiffRefs model - [x] Tweak: Use `note_type` in `Autosave` key - [x] Tweak: Remove `line_code: note.line_code` from `link_to_reply_discussion` - [x] Update: `SentNotifications` and reply-by-email receiver - [x] Update: MR diff notification email - [x] Update: API (MR, Commit note creation and entity) - [x] Update: GitHub importer - [x] Address any other TODO comments - [x] Fix: Suppress "edited 4 minutes ago" - [x] Write tests - [x] `LineMapper` - [x] `PositionTracer` - [x] `Position` - [x] `DiffPositionUpdateService` - [x] `DiffNote` - [x] `MergeRequests::RefreshService` / `MergeRequest#update_diff_notes_positions` - [x] Make sure commits with diff notes don't get cleaned up, since this would prevent the diff notes from being rendered (https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/5062) Future improvements: - Display unresolved comments on files outside the diff, if the comment was added when that file _was_ part of the diff - Allow commenting on sections between hunks, when expanding the diff using `...` - (We'd need to generate line code based on Position if we have it, even if it falls outside bounds of diff) - `diff_hunk` on diff note API entity - Show diff hunk in notification email - Resolved line notes would have a boolean, and be inactive through `notes.any? { !active? || resolved? }` - Multi line notes would store a number of positions, and do the right thing (™) in grouping and then rendering if the first item is multiline? => true - Image diff notes could store x,y,width,height instead of old_line,new_line for similar grouping. Does it need a reference to say if it's on old or new? These can't have line_codes, clearly. Rendering would be interesting. - Show commit line comments in the MR diff - Comment on specific selected words - Comment on file header - Unfold top of discussion diff note - New diff notes API for commits and MRs /cc @rspeicher See merge request !4101
2016-07-07Merge branch 'fix/import-export-log' into 'master' Rémy Coutable
Fix log statements in import/export Fixes - as seen in the logs: ``` Import/Export error raised on /opt/gitlab/embedded/service/gitlab-rails/lib/gitlab/import_export/file_importer.rb:19:in `rescue in import': undefined method `message' for #<String:0x007fc45e977e10> ``` See merge request !5129
2016-07-07fix log statements in import/exportJames Lopez
2016-07-07Remove duplication, unused methods, and some other style thingsDouwe Maan
2016-07-07Add some more code comments.Douwe Maan
2016-07-07Add send_git_patch helperDouwe Maan
2016-07-07Display new diff notes and allow creation through the web interfaceDouwe Maan
2016-07-07Allow reply-by-email with diff notesDouwe Maan
2016-07-07Add Gitlab::Git::PositionTracerDouwe Maan
2016-07-07Add Gitlab::Diff::LineMapperDouwe Maan
2016-07-07Add Gitlab::Git::PositionDouwe Maan
2016-07-07Extract parts of LegacyDiffNote into DiffOnNote concern and move part of ↵Douwe Maan
responsibility to other classes
2016-07-07Style diff and blob file headers the same wayDouwe Maan
2016-07-07Add DiffFile#blob and #old_blobDouwe Maan
2016-07-07Add Timeless helper module to prevent updated_at from being updatedDouwe Maan
2016-07-07Represent DiffRefs as proper class instead of tuple arrayDouwe Maan
2016-07-07Rename MergeRequest methods that return commits or shas to be more clear and ↵Douwe Maan
consistent
2016-07-06Consider that a GH exists only if both `ref`, and `sha` existDouglas Barbosa Alexandre
2016-07-06Doesn't trigger Git hooks when cleaning up restored branches from GitHubDouglas Barbosa Alexandre
2016-07-06Merge branch 'gh-labels' into 'master' Robert Speicher
Allow `?`, or `&` for label names Closes #18727 See merge request !4724
2016-07-06Merge branch 'fix/import-url-validator' into 'master' Robert Speicher
Fixing URL validation for import_url on projects Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/17536 This MR fixes problems related to bypassing `import_url` validation on projects. This makes sure the URL is properly validated so we don't enter crap and fail while running workers that handle this URL. It also adds a migration to fix current invalid `import_url`s See merge request !4753
2016-07-06Merge branch 'fix/project-export-error' into 'master' Rémy Coutable
Add more debug info to import/export and memory killer This should help debug https://gitlab.com/gitlab-org/gitlab-ce/issues/19124 further See merge request !5108
2016-07-06fix typoJames Lopez
2016-07-06even more debugJames Lopez
2016-07-06Use CGI.unescapeHTML rather than doing the gsub with a mapDouglas Barbosa Alexandre
2016-07-06Move `unescape_html_entities` from LabelsHelper to Label modelDouglas Barbosa Alexandre
2016-07-06Render references for labels that name contains ?, or &Douglas Barbosa Alexandre
2016-07-06Revert back to not defining a default Git access protocol.Patricio Cano
2016-07-06Default Git access protocol to `web`Patricio Cano
2016-07-06Rename `enabled_git_access_protocols` to singular.Patricio Cano
2016-07-06Don't allow empty strings in the `protocol` check.Patricio Cano
2016-07-06Correct access control flow for Git HTTP requests.Patricio Cano
2016-07-06Clarify protocol access check, and make Git HTTP access call more specific.Patricio Cano
2016-07-06Raise an error if no protocol is passed to the GitAccess check.Patricio Cano
2016-07-06Rename ENV['PROTOCOL'] to ENV['GL_PROTOCOL'] to conform to what GitLab Shell ↵Patricio Cano
expects and make the `protocol` param in `GitAccess` mandatory.
2016-07-06Only allow Git Access on the allowed protocolPatricio Cano
2016-07-05Merge branch 'update-gemoji' into 'master' Robert Speicher
Add lib/gitlab/emoji.rb instead of gitlab_emoji gem and upgrade Gemojione - No reason to split it into a separate gem when the gem barely did anything. We can use gemojione directly, making updating gemojione that much easier. Unless there's a particularly good reason we were using the gem? - Fixes the Rake task since it broke after all the AwardEmoji changes. - Update gemojione to 2.6.1. Spring Update changes! http://emojione.com/releases/#2.2.0 See merge request !4919
2016-07-05RailsCache metrics now includes fetch_hit/fetch_miss and read_hit/read_miss ↵Paco Guzman
info.
2016-07-05Instrument cache fetch hit and cache fetch missesPaco Guzman
2016-07-05Merge branch 'refactor/ci-config-move-global-entries' into 'master' Rémy Coutable
Move global ci entries handling from legacy to new config ## What does this MR do? This MR moves responsibility of handling global CI config entries (like `image`, `services`), from legacy `GitlabCiYamlProcessor` to new CI Config ## Why was this MR needed? This is the next iteration of CI configuration refactoring ## What are the relevant issue numbers? #15060 ## Does this MR meet the acceptance criteria? - Tests - [x] Added for this feature/bug - [x] All builds are passing - [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides) - [x] Branch has no merge conflicts with `master` (if you do - rebase it please) See merge request !4820
2016-07-05Improve the error message displayed when branch creation fails.Timothy Andrew
Note: This feature was developed independently on master while this was in review. I've removed the conflicting bits and left the relevant additions, mainly a test for `Gitlab::Git::Hook`. The original commit message follows: 1. `gitlab-shell` outputs errors to `stderr`, but we weren't using this information, prior to this commit. Now we capture the `stderr`, and display it in the flash message when branch creation fails. 2. This can be used to display better errors for other git operation failures with small tweaks. 3. The return value of `Gitlab::Git::Hook#trigger` is changed from a simple `true`/`false` to a tuple of `[status, errors]`. All usages and tests have been updated to reflect this change. 4. This is only relevant to branch creation _from the Web UI_, since SSH and HTTP pushes access `gitlab-shell` either directly or through `gitlab-workhorse`. 5. A few minor changes need to be made on the `gitlab-shell` end. Right now, the `stderr` message it outputs is prefixed by "GitLab: ", which shows up in our flash message. This is better removed.
2016-07-04Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhqDmitriy Zaporozhets
2016-07-04Merge branch 'more_descriptive_git_shell_messages' into 'master' Dmitriy Zaporozhets
Handle custom Git hook result in GitLab UI ## What does this MR do? This MR fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/19190 It allows to show messages from git custom hooks ## Screenshots (if relevant) ![joxi_screenshot_1467651998090](/uploads/7f814523c96712c07b4f4b52c843aab3/joxi_screenshot_1467651998090.png) See merge request !5073
2016-07-04Handle custom Git hook result in GitLab UIValery Sizov
2016-07-04Add minor improvements in readability in CI configGrzegorz Bizon
2016-07-04Merge branch 'save-artifacts_sizes' into 'master' Rémy Coutable
Save artifacts sizes ## What does this MR do? Introduce ci_builds.artifacts_size as an integer, so that it's easier to access than reading from the file again. ## What are the relevant issue numbers? Closes #18869 See merge request !4964
2016-07-04Better message for git hooks and file locksValery Sizov
2016-07-04Merge remote-tracking branch 'upstream/master' into save-artifacts_sizesLin Jen-Shin
* upstream/master: (175 commits) Document Repository#keep_around Don't garbage collect commits that have related DB records like comments Update CHANGELOG Update RedCloth to 4.3.2 for CVE-2012-6684 Fix typo in Merge Requests API documentation Downgrade to Redis 3.2.2 due to massive memory leak with Sidekiq Enable Style/EmptyLines cop, remove redundant ones Update CHANGELOG Cache results from jQuery selectors to retrieve namespace name Fix import button when import fail due the namespace already been taken Fix snippets comments not displayed Fix emoji paths in relative root configurations Exclude requesters from Project#members, Group#members and User#members Upgrade Thin from 1.6.1 to 1.7.0. Many squashed commits Cache autocomplete results Upgrade Sidekiq from 4.1.2 to 4.1.4. Upgrade seed-fu from 2.3.5 to 2.3.6 use has_many relationship with events Support creating a todo on issuables via API ...
2016-07-04Extract CI configuration entry node factory methodGrzegorz Bizon