Commit Graph

749 Commits

Author SHA1 Message Date
Oswaldo Ferreira 00a273d3a9 Revert "Automatically update MR merge-ref along merge status" 2019-06-11 13:08:25 -03:00
Shinya Maeda 2a01b33e6a Create BaseService for Auto Merge architecture
It abstracts some codes for common methods in AutoMerge::*Services.
2019-06-06 10:36:02 +07:00
Douwe Maan 96ff9c6bd8 Merge branch 'osw-sync-merge-ref-upon-mergeability-check' into 'master'
Automatically update MR merge-ref along merge status

Closes #58495

See merge request gitlab-org/gitlab-ce!28513
2019-06-03 16:29:41 +00:00
Yorick Peterse 6cb750a2bb
Merge dev.gitlab.org master into GitLab.com master 2019-06-03 14:56:33 +02:00
GitLab Release Tools Bot 5dc6c8f2d0 Merge branch 'security-60039' into 'master'
Disallow invalid MR branch name

See merge request gitlab/gitlabhq!3052
2019-06-03 12:34:04 +00:00
Shinya Maeda d4b4693663 Abstract auto merge processes
We have one auto merge strategy today - Merge When Pipeline
Succeeds.

In order to add more strategies for Merge Train feature,
we abstract the architecture to be more extensible.

Removed arguments

Fix spec
2019-06-03 13:15:29 +07:00
Oswaldo Ferreira 4246a62118 Add payload to the service response
This introduces payload to the ServiceResponse with
the merge ref HEAD commit data
2019-05-31 19:16:01 -03:00
Oswaldo Ferreira 96db70a444 Simplify merge_ref_head methods 2019-05-31 19:16:01 -03:00
Oswaldo Ferreira b965009ddd Automatically update MR merge-ref along merge status
This couples the code that transitions the `MergeRequest#merge_status`
and refs/merge-requests/:iid/merge ref update.

In general, instead of directly telling `MergeToRefService` to update
the merge ref, we should rely on `MergeabilityCheckService` to keep
both the merge status and merge ref synced. Now, if the merge_status is
`can_be_merged` it means the merge-ref is also updated to the latest.

We've also updated the logic to be more systematic and less user-based.
2019-05-31 19:16:01 -03:00
Stan Hu 37a335e60e Fix remaining failures in shoulda-matcher
Starting with Rails 5, belongs_to now adds a presence validation to the
association, and so as of shoulda-matchers 4.0.0 the belong_to matcher
follows suit and tests that this validation is there by setting the
association to nil and asserting that there are validation errors. This
exposed an error with the `validate_branches` method: we need to check
the source and target project exist.
2019-05-21 23:19:07 -07:00
Shinya Maeda d4d2cf7327 Fix merge request pipeline exist method
Refactor
2019-05-06 13:20:47 +07:00
Mark Chao d8bddb1662 Validate MR branch names
Prevents refspec as branch name, which would bypass branch protection
when used in conjunction with rebase.

HEAD seems to be a special case with lots of occurrence,
so it is considered valid for now.

Another special case is `refs/head/*`, which can be imported.
2019-05-03 03:02:58 +08:00
Shinya Maeda daa8f784d0 Fix environment automatic on_stop trigger
Due to the nature of pipelines for merge requests, deployments.ref can
be a merge request ref instead of a branch name.

We support the environment auto-stop hook for this case
2019-04-30 21:15:39 +07:00
Jasper Maes 624a1cdab4 Upgrade Rails to 5.1.6.1
Model.new.attributes now also returns encrypted attributes.
2019-04-23 08:31:23 +08:00
Matija Čupić 0cfa25ff21
Backport changes from EE
This backports the changes from
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10452
2019-04-16 13:06:52 +02:00
Oswaldo Ferreira ca884980ee [CE] Support multiple assignees for merge requests
Backports https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/10161
(code out of ee/ folder).
2019-04-08 18:40:00 -03:00
Heinrich Lee Yu 0e5dbaf87f Do not show system notes on commits in the MR page 2019-04-02 22:59:43 +08:00
Igor 351b39f172 Backport splitting approval changes from CE
Author and committers approvals are split in EE
This commit provides backports for those changes

This reverts commit 886f00bcba.
2019-04-02 11:01:07 +00:00
Sean McGivern f87b7fe3b3 Merge branch 'issue_51789_part_1' into 'master'
Migrate issuable states to integer patch 1 of 2

Closes #51789

See merge request gitlab-org/gitlab-ce!25107
2019-04-02 08:39:53 +00:00
Douglas Barbosa Alexandre d8258470b5 Merge branch 'check-mergeability-in-merge-to-ref-service' into 'master'
Check mergeability in merge to ref service

See merge request gitlab-org/gitlab-ce!26757
2019-04-01 16:17:10 +00:00
Francisco Javier López 45293f66fa Fix MergeRequest#has_commits? nil comparison 2019-04-01 15:13:22 +00:00
Shinya Maeda a7d4824ded Check mergeability in merge to ref service
and add spec

Add changelog

ok

ok
2019-04-01 14:02:57 +07:00
Kamil Trzciński 0d26c48332 Merge branch 'persist-fulll-ref-path-for-mr-pipelines' into 'master'
Use merge request HEAD ref for detached merge request pipelines

Closes #58454

See merge request gitlab-org/gitlab-ce!25504
2019-03-29 10:46:02 +00:00
Shinya Maeda bf639fd504 Create detached merge request pipelines
By using `refs/merge-requests/:iid/head`

ok

ok

Improve naming nicely

Add nice tests

add nice tests

fix some more

revert
2019-03-29 13:58:45 +07:00
Nick Thomas 013f7cd24c
Inherit from ApplicationRecord instead of ActiveRecord::Base 2019-03-28 16:18:23 +00:00
Felipe Artur 16a3fea399 Merge master 2019-03-27 15:19:12 -03:00
Oswaldo Ferreira 03e0604d5d Prepare suggestion implementation for multi-line
Adds the groundwork needed in order to persist multi-line suggestions,
while providing the parsing strategy which will be reused for the
**Preview** as well.
2019-03-27 12:26:53 -03:00
Oswaldo Ferreira 929ee4d18d Add multiple assignees migration and table population
This will be further required for supporting multi-assignees MRs
2019-03-25 19:50:40 -03:00
Nathan Friend 7e6b57499f Update merge request widget pipeline block
This commit updates the pipeline block that appears on the merge request
page to include information that will be exposed by the API as part of
the post-merge pipeline feature.
2019-03-21 15:31:09 +00:00
Shinya Maeda b913169d88 Make all_pipelines method compatible with pipelines for merge requests
Make it sane

Include merge ref head

Fix union

Improve a bit

Add spec

remove

add spec

Add changelog

fix coding offence

Apply suggestion to spec/models/merge_request_spec.rb

ok

ok

Fix

Fix spec

Fix spec

fix

Simplify the things

Memoize

OK

a
2019-03-13 19:26:38 +07:00
Hiroyuki Sato de784ac105 Filter merge requests by target branch 2019-03-09 12:22:58 +00:00
Stan Hu 062efe4f7a Significantly reduce N+1 queries in /api/v4/todos endpoint
By preloading associations and batching issuable metadata lookups,
we can significantly cut the number of SQL queries needed to load
the Todos API endpoint.

On GitLab.com, my own tests showed my user's SQL queries went
from 365 to under 60 SQL queries.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/40378
2019-03-06 07:03:46 -08:00
John Jarvis 83cb748256 Merge branch 'merge-dev-to-master' into 'master'
Merge dev.gitlab.org master into GitLab.com master

Closes #2794, #2814, #2806, #2805, #2798, #2795, #2788, and #2787

See merge request gitlab-org/gitlab-ce!25746
2019-03-05 10:28:59 +00:00
Hiroyuki Sato 2b0a0f9b03 Merge branch 'master' into expose-additional-merge-request-pipeline-variables
Conflicts:
  doc/ci/variables/README.md
  spec/models/ci/pipeline_spec.rb
2019-03-04 21:07:36 +00:00
Yorick Peterse 025015048f Merge branch 'security-2773-milestones-fix' into 'master'
[master] Check issue milestone availability

See merge request gitlab/gitlabhq!2788
2019-03-04 18:37:15 +00:00
Francisco Javier López ebf16ada85 Arbitrary file read via MergeRequestDiff 2019-03-04 18:36:34 +00:00
Oswaldo Ferreira 1ad699677f Support merge to ref for merge-commit and squash
Adds the ground work for writing into
the merge ref refs/merge-requests/:iid/merge the
merge result between source and target branches of
a MR, without further side-effects such as
mailing, MR updates and target branch changes.
2019-02-25 10:40:58 -03:00
Felipe Artur 648b87315d Merge branch 'master' into issue_51789_part_1 2019-02-19 11:35:29 -03:00
Douwe Maan 8f209ed5ea Merge branch 'sh-fix-issue-9787-ce' into 'master'
Backport commit author changes from CE

See merge request gitlab-org/gitlab-ce!25294
2019-02-15 17:17:27 +00:00
Stan Hu 886f00bcba Backport commit author changes from CE
This backports the changes made in EE to fix merge request approvers
from https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/9574.
2019-02-15 05:58:23 -08:00
Olivier Gonzalez b079a6b6bb Base pipeline must be from target branch 2019-02-15 10:47:13 +00:00
Felipe Artur 9671a67a4c Fix broken specs 2019-02-14 16:33:26 -02:00
Jarka Košanová 30ab6ee416 Check issue milestone availability
Add project when creating milestone in specs

We validate milestone is from the same
project/parent group as issuable ->
we need to set project in specs correctly

Improve methods names and specs organization
2019-02-14 15:28:02 +01:00
Felipe Artur 37741c59a4 Split background migration for issues and merge requests 2019-02-14 11:48:20 -02:00
Felipe Artur 26f40aefb0 Code improvements 2019-02-13 17:31:14 -02:00
Felipe Artur e2aa332504 Improve batch size 2019-02-12 16:39:56 -02:00
Felipe Artur e9b84f50e9 Migrate issuable states to integer patch 1
Patch 1 that migrates issues/merge requests states from integer to string.
On this commit we are only adding the state_id column and syncing it with a backgroud migration.

On Patch 2 the code to use the new integer column will be deployed and the old column will be
removed.
2019-02-11 15:48:40 -02:00
Luke Duncalfe 2b7dd017af Allow custom squash commit messages 2019-02-06 12:33:11 +00:00
Mario de la Ossa 49c74068ae
Save sorting preference for Issues/MRs in BE
In order to let users' sorting preferences transfer between devices, we
save the preference for issues and MRs (one preference for issues, one
for MRs) in the backend inside the UserPreference object
2019-01-28 12:48:05 -06:00
Douwe Maan 8c1991b9bb Merge branch 'osw-fix-quick-suggestion-application-being-reverted' into 'master'
Adjust applied suggestion reverting previous changes

Closes #56017

See merge request gitlab-org/gitlab-ce!24250
2019-01-14 13:46:05 +00:00