Skip to content
Snippets Groups Projects
  1. Sep 04, 2019
  2. Aug 26, 2019
  3. Aug 22, 2019
  4. Aug 15, 2019
    • Nick Thomas's avatar
      Only read rebase status from the model · d31b733f
      Nick Thomas authored and Mayra Cabrera's avatar Mayra Cabrera committed
      Prior to 12.1, rebase status was looked up directly from Gitaly. In
      https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/14417 , a DB
      column was added to track the status instead. However, we couldn't stop
      looking at the gitaly status immediately, since some rebases may been
      running across the upgrade.
      
      Now that we're in 12.3, it is safe to remove the direct-to-gitaly
      lookup. This also happens to fix a 500 error that is seen when viewing
      an MR for a fork where the source project has been removed.
      
      We still look at the Gitaly status in the service, just in case Gitaly
      and Sidekiq get out of sync - I assume this is possible, and it's a
      relatively cheap check.
      
      Since we atomically check and set `merge_requests.rebase_jid`, we
      should never enqueue two `RebaseWorker` jobs in parallel.
      d31b733f
  5. Jul 31, 2019
    • Oswaldo Ferreir's avatar
      Add exclusive lease to mergeability check process · f4cd926c
      Oswaldo Ferreir authored
      Concurrent calls to UserMergeToRef RPC updating a single ref
      can lead to an opaque fail that is being rescued at Gitaly.
      
      So this commit adds an exclusive lease to the mergeability
      check process with the key as the current MR ID.
      f4cd926c
  6. Jul 24, 2019
    • Christian Couder's avatar
      Support title and desc on merge w/ push option · 7cf4bf84
      Christian Couder authored
      MergeRequests::PushOptionsHandlerService has been updated to allow
      creating and updating merge requests with the `title` and
      `description` set using git push options.
      
      To create a new merge request and set its title and description:
      
            git push -u origin -o merge_request.create \
              -o merge_request.title="My title" \
              -o merge_request.description="My description"
      
      To update an existing merge request and set its title and
      description:
      
            git push -u origin -o merge_request.title="My title" \
              -o merge_request.description="My description"
      
      Issue https://gitlab.com/gitlab-org/gitlab-ce/issues/64320
      7cf4bf84
  7. Jul 17, 2019
    • Bob Van Landuyt's avatar
      Filter params in MR build service · 6c27c0d3
      Bob Van Landuyt authored
      Reusing the existing `IssuableBaseService#filter_params` which uses
      the policies to determine what params a user can set, and which values
      it can be set to.
      
      This also removed the need for the seperate call to
      `IssuableBaseService#ensure_milestone_available`.
      
      The `Issues::BuildService` does not suffer from this because it limits
      the params that are assignable to the `title`, `description` and
      `milestone_id`.
      6c27c0d3
    • Christian Couder's avatar
      Refactor create_params and update_params · 0d98f1bb
      Christian Couder authored
      Let's move shared code between create_params and update_params
      into a new base_params.
      
      update_params becomes very thin, but it still may be clearer that
      the params are being shared if we have a method called
      base_params, rather than have create_params merge in
      update_params.
      0d98f1bb
    • Christian Couder's avatar
      Support rm src branch on merge w/ push option · 8256d407
      Christian Couder authored
      MergeRequests::PushOptionsHandlerService has been updated to allow
      creating and updating merge requests with the
      `remove_source_branch` set using git push options.
      
      To create a new merge request and set it to remove the source branch
      when it is merged:
      
        git push -u origin -o merge_request.create \
          -o merge_request.remove_source_branch
      
      To update an existing merge request and set it to remove the source
      branch when it is merged:
      
        git push -u origin -o merge_request.remove_source_branch
      
      Issue https://gitlab.com/gitlab-org/gitlab-ce/issues/64320
      8256d407
  8. Jul 10, 2019
  9. Jul 09, 2019
    • Oswaldo Ferreir's avatar
      [CE port] Bypass push rules for merge to ref service · 84dd3149
      Oswaldo Ferreir authored
      Turns out push rules to validate commit message does
      not apply in the context of automatic merge to
      the refs/merge-requests/:iid/merge. Mainly because
      if it fails to merge to it, we currently can't give enough
      preemptive feedback to the user and it'll turn the
      merge request unmergeable (given we automatically
      mark it as unmergeable if we can't merge to the ref).
      
      In general, it's a systematic operation, which already
      bypasses user authorization and git hooks.
      
      Therefore, this commit makes it bypass the push rules
      at EE as well.
      84dd3149
  10. Jul 05, 2019
  11. Jul 04, 2019
    • Nick Thomas's avatar
      Allow asynchronous rebase operations to be monitored · 381468d0
      Nick Thomas authored
      This MR introduces tracking of the `rebase_jid` for merge requests. As
      with `merge_ongoing?`, `rebase_in_progress?` will now return true if a
      rebase is proceeding in sidekiq.
      
      After one release, we should remove the Gitaly-based lookup of rebases.
      It is much better to track this kind of thing via the database.
      Verified
      381468d0
  12. Jun 28, 2019
  13. Jun 21, 2019
  14. Jun 20, 2019
    • Oswaldo Ferreir's avatar
      Only force recheck when merge-ref is outdated · 1f0b50c4
      Oswaldo Ferreir authored
      When recheck flag is true, we make sure the merge-ref
      is indeed outdated. If it is, we update it along
      the merge status.
      1f0b50c4
    • Oswaldo Ferreir's avatar
      Automatically update MR merge-ref along merge status · 3af348b6
      Oswaldo Ferreir authored
      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.
      3af348b6
  15. Jun 11, 2019
  16. Jun 10, 2019
  17. Jun 06, 2019
  18. Jun 04, 2019
  19. Jun 03, 2019
    • Shinya Maeda's avatar
      Abstract auto merge processes · d4b46936
      Shinya Maeda authored
      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
      d4b46936
  20. May 31, 2019
    • Oswaldo Ferreir's avatar
      Add payload to the service response · 4246a621
      Oswaldo Ferreir authored
      This introduces payload to the ServiceResponse with
      the merge ref HEAD commit data
      4246a621
    • Oswaldo Ferreir's avatar
      Automatically update MR merge-ref along merge status · b965009d
      Oswaldo Ferreir authored
      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.
      b965009d
  21. May 06, 2019
  22. May 02, 2019
    • Luke Duncalfe's avatar
      Add support for two-step Gitaly Rebase RPC · 49cb4b3d
      Luke Duncalfe authored and Douwe Maan's avatar Douwe Maan committed
      The new two-step Gitaly `Rebase` RPC yields the rebase commit SHA to the
      client before proceeding with the rebase.
      
      This avoids an issue where the rebase commit SHA was returned when the
      RPC had fully completed, and in some cases this would be after the Rails
      `post_receive` worker services had already run. In these situations,
      the merge request did not yet have its rebase_commit_sha attribute set
      introducing the possibility for bugs (such as previous approvals being
      reset).
      
      https://gitlab.com/gitlab-org/gitlab-ee/issues/5966
      49cb4b3d
  23. Apr 30, 2019
    • Shinya Maeda's avatar
      Fix environment automatic on_stop trigger · daa8f784
      Shinya Maeda authored
      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
      daa8f784
  24. Apr 15, 2019
  25. Apr 09, 2019
    • Nick Thomas's avatar
      Fix MR assignees for push options · f9b4d5ef
      Nick Thomas authored
      With multiple MR assignees, `merge_request.assignee_id` is always nil,
      and `merge_request.assignee_ids` isn't in `merge_request.attributes`.
      So the existing code doesn't set assignees in the created MR.
      
      This fix gets all the tests passing, but we should also check that no
      other associations in the MergeRequest need similar fixups.
      Verified
      f9b4d5ef
    • Zeger-Jan van de Weg's avatar
      Update comments about N + 1 Gitaly calls · 469844c4
      Zeger-Jan van de Weg authored
      To make sure all known issues are linked to the correct epic, I've gone
      through the code base, and updated the comments where required.
      Unverified
      469844c4
  26. Apr 08, 2019
    • Luke Duncalfe's avatar
      Update service to handle unexpected exceptions · b5bcf80c
      Luke Duncalfe authored
      This will ensure that now and in the future, PushOptionsHandlerService
      will not cause the post_receive API endpoint from running other code if
      something causes an unknown exception.
      b5bcf80c
    • Luke Duncalfe's avatar
      Refactor PushOptionsHandlerService from review · e73f537c
      Luke Duncalfe authored
      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.
      e73f537c
    • Luke Duncalfe's avatar
      Support merge on pipeline success w/ push options · 68f189ad
      Luke Duncalfe authored
      MergeRequests::PushOptionsHandlerService has been updated to allow
      creating and updating merge requests with the
      `merge_when_pipeline_succeeds` set using git push options.
      
      To create a new merge request and set it to merge when the pipeline
      succeeds:
      
        git push -u origin -o merge_request.create \
          -o merge_request.merge_when_pipeline_succeeds
      
      To update an existing merge request and set it to merge when the
      pipeline succeeds:
      
        git push -u origin -o merge_request.merge_when_pipeline_succeeds
      
      Issue https://gitlab.com/gitlab-org/gitlab-ce/issues/53198
      68f189ad
    • Oswaldo Ferreir's avatar
    • Luke Duncalfe's avatar
      Support merge request create with push options · aa352a95
      Luke Duncalfe authored
      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
      aa352a95
    • Shinya Maeda's avatar
      Prevent triggering pipelines when target branch is updated · e0efa97c
      Shinya Maeda authored
      Currently, pipelines for merge requests are triggered when source or
      target branch is updated. However, we should create only when source
      branch is updated, because it runs unexpected pipelines.
      e0efa97c
  27. Apr 05, 2019
Loading