1. 17 Jun, 2016 24 commits
    • Jacob Schatz's avatar
      Merge branch 'new-merge-request-commit-box-fix' into 'master' · c73aeed9
      Jacob Schatz authored
      Fixed styling of commit box in new MR
      
      ## What does this MR do?
      
      Fixes an issue that caused the new merge request commit box to go all funny styled.
      
      ## What are the relevant issue numbers?
      
      #18781 
      
      ## Screenshots (if relevant)
      
      ![Screen_Shot_2016-06-17_at_14.08.44](/uploads/b1e34b0c6bf67adc1be8748306e20b06/Screen_Shot_2016-06-17_at_14.08.44.png)
      
      See merge request !4747
      c73aeed9
    • Rémy Coutable's avatar
      Merge branch 'fix/error-when-job-variables-not-defined-but-specified' into 'master' · 7db27be1
      Rémy Coutable authored
      Fix error when CI job variables key used but not specified
      
      ## What does this MR do?
      
      This MR fixes a an error when CI job variables specified, but not defined:
      
      ```yaml
      image: ruby:2.2
      
      test:
        variables:
        script:
           - rspec
      ```
      
      ## What are the relevant issue numbers?
      
      Closes #18764  
      Follow up discussion in: #18775 
      
      ## Does this MR meet the acceptance criteria?
      
      - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
      - [x] 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] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
      
      See merge request !4745
      7db27be1
    • Rémy Coutable's avatar
      Merge branch 'registry-500-fix' into 'master' · d44bf7e3
      Rémy Coutable authored
      Properly support application/json in Container Registry
      
      ## What does this MR do?
      When requesting tags a `application/json` is used by `docker/distribution`.
      
      ## Why was this MR needed?
      Fixes regression introduced by https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/4669
      
      ## What are the relevant issue numbers?
      Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/18736
      
      
      See merge request !4742
      d44bf7e3
    • Rémy Coutable's avatar
      Merge branch 'make-sure-that-artifacts-file-is-saved' into 'master' · cdd533cc
      Rémy Coutable authored
      Make sure that artifacts_file is nullified after removing artifacts
      
      ## What does this MR do?
      Fixes a problem that `ExpireBuildArtifactsWorker` is executed for all previously removed artifacts.
      
      ## Why was this MR needed?
      Currently the `Ci::Build::erase_artifacts!` doesn't ensure that data are saved to database.
      The bang at end of this method lets you believe that it should do so.
      This adds a missing `save` to this method.
      
      ## What are the relevant issue numbers?
      None, yet.
      
      ## CHANGELOG
      Since this is regression in feature introduce in RC4 no CHANGELOG entry is needed.
      
      cc @grzesiek 
      
      
      See merge request !4741
      cdd533cc
    • Robert Speicher's avatar
      Merge branch 'rs-devise-emails' into 'master' · 3c183d1f
      Robert Speicher authored
      Customize all Devise mails
      
      Continuing from https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/3354
      
      See merge request !4297
      3c183d1f
    • Douwe Maan's avatar
      Merge branch '2979-personal-access-tokens' into 'master' · a899e7e3
      Douwe Maan authored
      Allow creating Personal Access Tokens through the website
      
      Related to #2979 
      
      - Allow a user to create personal access tokens, and use them to authenticate
      - Refactor `API::Helpers` into `API::Helpers::Core` and `API::Helpers::Authentication`
      
      # Tasks
      
      - [ ]  #2979 (!3749)  - Personal Access Tokens
          - [x]  Basic Implementation
              - [x]  Add UI to add "Personal Access Tokens"
              - [x]  Reload `lib/api` on every request
              - [x]  Respect these tokens for API requests
              - [x]  Just a param or a header too?
              - [x]  Allow revoking tokens
              - [x]  Expire tokens
              - [x]  Left bar should have a "PAT" icon
              - [x]  Scopes?
              - [x]  Copy to Clipboard
              - [x]  Show active/inactive tokens separately
                  - [x]  No need to check for expired/revoked in the appropriate places
              - [x]  Why does regular ApplicationController check for private token?
              - [x]  Support non-API requests
              - [x]  Revert (or work on) `lib/api` eager loading
          - [x]  Create MR
          - [x]  Refactoring
          - [x]  Fix tests
          - [x]  Write more tests
          - [x]  Add screenshots to MR
          - [x]  Add description of query performance to MR
          - [x]  Limit the number of queries in the `personal_access_tokens` page
          - [x]  Wait for CI to pass
          - [x]  Fix merge issues in schema.rb
          - [x]  Assign MR to endboss
          - [x]  Wait for feedback
          - [x]  Fix feedback
              - [x]  Wait for CI to pass
          - [x]  Assign to @rspeicher
          - [x]  Fix @rspeicher's comments
          - [x]  Wait for CI to pass
          - [x]  Assign back to @rspeicher
          - [x]  Write documentation and ping @axil
          - [x]  Wait for Axil to respond
          - [x]  Assign to endboss
          - [x]  Address Douwe's feedback
              - [x]  Use the `private_token` or `authentication_token` param instead of `personal_access_token`
              - [x]  Ditto for the header
          - [x]  Assign to endboss
          - [x]  Make sure CI is green
          - [x]  Address Douwe's feedback
              - [x]  Don't go through the `authenticate_user_from_private_token!` method, if a private token is supplied (or combine them)
              - [x]  In `authenticate_user_from_personal_access_token!` don't hit DB if `token_string` is `nil`
              - [x]  Use `current_user.personal_access_tokens.build` in the controller
              - [x]  Remove the "We aren't using `personal_access_token` as the root param" comment
              - [x]  `No need for = "...", we can just have the Inactive ... #{...} on the next line` in the view
              - [x]  Render dates in a (more) human format
              - [x]  CSS issue with table
              - [x]  Don't show the tokens in the UI indefinitely
              - [x]  How to implement scopes? Add-on to current impl? Doorkeeper?
          - [x]  Wait for @DouweM's comments about scopes
          - [x]  Address @DouweM's second review 
              - [x]  Try not using `native['innerHTML']`
              - [x]  use contexts for all "when ..."
              - [x]  Ensure consistency (styling) with other pages for "You don't have any tokens" message
              - [x]  "Actions" table column doesn't need a label
              - [x]  %td can be moved outside of the if/else statement
              - [x]  The header title should be "Profile Settings"
              - [x]  Can this be a `before_create`, so we don't need to use `generate`?
              - [x]  If it couldn't be revoked, will we show an error?
              - [x]  If it couldn't be saved, will we show an error?
          - [x]  Merge master
          - [x]  Update CHANGELOG entry
          - [x]  Add tests for form errors?
          - [x]  Post screenshots
          - [x]  Tag @jschatz1 for review
          - [x]  Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/0dff6fd/builds) to pass
          - [x]  Respond to @jschatz1's comments
              - [x]  Hardcoded colors should be variables
              - [x]  Should not be allowed to chose a date in the past
              - [x]  Use the same table as in the Applications tab
              - [x]  button should say "Create Personal Access Token"
              - [x]  Float the revoke to the right on the `a`
              - [x]  Change revocation message. "Are you sure you want to revoke this certificate? This action cannot be undone."
              - [x]  Date stays selected and looks selected even though date is set as "never".
              - [x]  ~~hover on the calendar button shifts~~ (not caused by this MR - happens on `milestones#new` as well)
              - [x]  Don't use the panel for the created token
                  - [x]  Use a normal flash for "Your new personal access token has been created"
                  - [x]  Show the input (with the token) below it full width.
                  - [x]  Put the "Make sure you save it - you won't be able to access it again." message near the input
              - [x]  Have the input highlight all on single click
          - [x]  Update screenshots
          - [x]  Merge master in + conflicts
          - [x]  Assign to @jschatz1 again
          - [x]  Respond to @jschatz1's comments
              - [x]  No button for clipboard, only link
              - [x]  text-danger
              - [x]  highlight fade on that area where the token was created
          - [x]  Make sure [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/d754d99179f1ffe846fcc1d8e858163b39efc5dc/builds) is green
          - [x]  Assign to @jschatz1
          - [x]  Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/faa0e3f7580bc38d4d12916b4589c64d6c2678a7/builds) to pass
          - [x]  Respond to @DouweM's feedback
              - [x]  move the redirect_to out of the if/else
              - [x]  certificate -> token
              - [x]  datepicker back to text field
              - [x]  combine the get_user_from_private_token and get_user_from_personal_access_token methods in ApplicationController
              - [x]  combine the get_user_from_private_token and get_user_from_personal_access_token methods in `lib/api/helpers`
              - [x]  don't need the new constants
          - [x]  Wait for [build](https://gitlab.com/gitlab-org/gitlab-ce/commit/9d7cda3ddce52baad9618466a5d00319b333be57/builds) to pass
          - [ ]  Wait for merge
      
      # Screenshots
      ![Screen_Shot_2016-06-16_at_8.30.33_AM](/uploads/30a168964b7c5e0eb322705747829fb6/Screen_Shot_2016-06-16_at_8.30.33_AM.png)
      ![Screen_Shot_2016-06-16_at_8.30.44_AM](/uploads/7a8202885df6120071bbe81b215aaead/Screen_Shot_2016-06-16_at_8.30.44_AM.png)
      ![Screen_Shot_2016-06-16_at_8.31.02_AM](/uploads/6905c0848864e390138b771389c7a1b2/Screen_Shot_2016-06-16_at_8.31.02_AM.png)
      ![Screen_Shot_2016-06-16_at_8.31.29_AM](/uploads/0bc92369fb2f9bc335773f6abec421c3/Screen_Shot_2016-06-16_at_8.31.29_AM.png)
      
      See merge request !3749
      a899e7e3
    • Douwe Maan's avatar
      Merge branch 'feature/project-export' into 'master' · bf029437
      Douwe Maan authored
      Export project functionality
      
      This is a MR for the export functionality of https://gitlab.com/gitlab-org/gitlab-ce/issues/3050, which adds the ability to export single projects.
      
      - [x] members
      - DB data
        - [x] issues
        - [x] issue comments
        - [x] merge requests
        - [x] merge request diff
        - [x] merge request comments
        - [x] labels
        - [x] milestones
        - [x] snippets
        - [x] releases
        - [x] events
        - [x] commit statuses
        - [x] CI builds
      - File system data
        - [x] Git repository
        - [x] wiki
        - [x] uploads
        - [ ] ~~CI build traces~~
        - [ ] ~~CI build artifacts~~
        - [ ] ~~LFS objects~~
      - DB configuration
        - [x] services
        - [x] web hooks
        - [x] protected branches
        - [x] deploy keys
        - [x] CI variables
        - [x] CI triggers
      
      See merge request !3114
      bf029437
    • Robert Speicher's avatar
      Merge branch 'clipboard-buttons-fix' into 'master' · 923e5d7d
      Robert Speicher authored
      Fix clipboard buttons on "Check out branch" modal.
      
      Closes #18794 
      
      See merge request !4760
      923e5d7d
    • Douwe Maan's avatar
      Merge branch '18724-dont-show-leave-project-to-group-member' into 'master' · 24eebc24
      Douwe Maan authored
      Don't show 'Leave Project' to group members
      
      ## What does this MR do?
      
      It hides the 'Leave Project' button to group members that are not explicitly a member of the project.
      
      ## Are there points in the code the reviewer needs to double check?
      
      No.
      
      ## Why was this MR needed?
      
      Because there was an issue opened!
      
      ## What are the relevant issue numbers?
      
      Fixes #18724.
      
      ## Does this MR meet the acceptance criteria?
      
      - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
      - [x] 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)
      - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
      
      See merge request !4739
      24eebc24
    • Rémy Coutable's avatar
      Merge branch 'validate-only-except-regexp' into 'master' · 4a6eb007
      Rémy Coutable authored
      Validate only and except regexp
      
      ## What does this MR do?
      Adds a better validation for only and except which can contain regexps.
      
      ## Why was this MR needed?
      Currently the RegexpError can be raised when processing next stage which leads to 500 in different places of code base.
      This adds early check that regexps used in only and except are valid.
      
      cc @grzesiek 
      
      - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
      - [x] Tests
        - [x] Added for this feature/bug
        - [ ] All builds are passing
      - [ ] 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)
      - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
      
      See merge request !4736
      4a6eb007
    • Robert Speicher's avatar
      Merge branch 'clipboard-button-styling' into 'master' · 2f1470d4
      Robert Speicher authored
      Fixed styling of clipboard button
      
      Closes #18773 
      
      See merge request !4728
      2f1470d4
    • Yorick Peterse's avatar
      Merge branch '18709-use-specific-git-cached-counters' into 'master' · 36550486
      Yorick Peterse authored
      Use Git cached counters on project show page
      
      See merge request !4711
      36550486
    • Robert Speicher's avatar
      Merge branch 'update-column-in-batches-where' into 'master' · 43234742
      Robert Speicher authored
      Allow customising of queries used for `update_column_in_batches`
      
      This MR makes two changes to `add_column_with_default` and `update_column_in_batches`:
      
      1. `add_column_with_default` no longer wraps the entire set of updates in a single transaction, preventing any locks from sticking around for the duration of the entire transaction
      2. `update_column_in_batches` now takes a block which can be used to customise the queries. This uses Arel as messing with raw SQL strings is a total pain
      
      In !4381 there's a need for updating existing rows/columns in a table in batches using a custom `WHERE` condition. Without the changes in this MR this would not be possible.
      
      See merge request !4680
      43234742
    • Douwe Maan's avatar
      Merge branch 'backport-view-condition-improvement-from-ee-460' into 'master' · 4a1b42b0
      Douwe Maan authored
      Fix permission checks in member row (backport from gitlab-org/gitlab-ee!460)
      
      ## What does this MR do?
      
      It improves the check we use to display or not the members' access and controls in the members list.
      
      ## Are there points in the code the reviewer needs to double check?
      
      No, I replaced an helper with just a permission check so I think it's a better solution.
      
      ## Why was this MR needed?
      
      There were a spec failure in gitlab-org/gitlab-ee!460 because of the refactor done in the "request access" MR.
      
      ## What are the relevant issue numbers?
      
      None.
      
      ## Does this MR meet the acceptance criteria?
      
      - No CHANGELOG needed
      - [x] Tests
        - [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)
      - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
      
      See merge request !4670
      4a1b42b0
    • Achilleas Pipinellis's avatar
      Merge branch 'sidekiq-api-metrics' into 'master' · 30c20263
      Achilleas Pipinellis authored
      Added API endpoint for Sidekiq Metrics.
      
      ## What does this MR do?
      
      It adds an API endpoint to gather metrics about Sidekiq, it's jobs, queues, and processes.
      
      ## Why was this MR needed?
      
      There was no API endpoint for Sidekiq information.
      
      ## What are the relevant issue numbers?
      
      Fixes #7171
      
      ## Does this MR meet the acceptance criteria?
      
      - [x] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
      - [x] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
      - [x] API support added
      - [x] Tests
        - [x] Added for this feature/bug
        - [x] All builds are passing
      
      See merge request !4653
      30c20263
    • Jacob Schatz's avatar
      Merge branch 'contrib-calendar-colors' into 'master' · 9f3ca136
      Jacob Schatz authored
      Fixed issue with user calendar colors
      
      ## What does this MR do?
      
      Fixes an issue with the colors added onto the user contrib calendar. The calendar was change recently to remove a library which affected how the colors where generated.
      
      ## What are the relevant issue numbers?
      
      Closes #18505 
      
      ## Screenshots (if relevant)
      
      ![Screen_Shot_2016-06-13_at_09.33.10](/uploads/f17451d2eb805e9d75d859cd1691e0bc/Screen_Shot_2016-06-13_at_09.33.10.png)
      
      See merge request !4614
      9f3ca136
    • Rémy Coutable's avatar
      Merge branch '14918-add-filter-dropdown-to-tag-page' into 'master' · ecd4a7b0
      Rémy Coutable authored
      Add sorting dropdown to tag page
      
      ## What does this MR do?
      
      Adds a sorting dropdown to the tags page just like the one on the branches page.
      
      ## Are there points in the code the reviewer needs to double check?
      
      No
      
      ## Why was this MR needed?
      
      Clients were asking for this
      
      ## What are the relevant issue numbers?
      
      Closes #14918
      
      ## Screenshots (if relevant)
      
      ![Captura_de_pantalla_2016-06-01_a_las_4.07.58_p.m.](/uploads/4530683ddd91d3bdbdce77748fe63f87/Captura_de_pantalla_2016-06-01_a_las_4.07.58_p.m..png)
      
      See merge request !4423
      ecd4a7b0
    • Robert Speicher's avatar
      Update VERSION to 8.9.0-rc6 · 9bbe5eb8
      Robert Speicher authored
      9bbe5eb8
    • Robert Speicher's avatar
      Merge branch 'bump-gitlab-git-10.2.0' into 'master' · 3ca15184
      Robert Speicher authored
      Use gitlab-git 10.2.0
      
      Closes #18741
      
      See merge request !4722
      3ca15184
    • Yorick Peterse's avatar
      Merge branch '18591-banzai-filter-upload-link-filter' into 'master' · bc2df255
      Yorick Peterse authored
      Banzai::Filter::UploadLinkFilter use XPath
      
      See merge request !4703
      bc2df255
    • Robert Speicher's avatar
      Merge branch 'fix-project-find-with-namespace-order' into 'master' · 27625dec
      Robert Speicher authored
      Fixed ordering in Project.find_with_namespace
      
      This MR fixes the ordering of `Project.find_with_namespace` to ensure that it returns rows that match literally first.
      
      Closes #18603
      
      See merge request !4682
      27625dec
    • Robert Speicher's avatar
      Update CHANGELOG for !4659 · 601a4232
      Robert Speicher authored
      [ci skip]
      601a4232
    • Robert Speicher's avatar
      Merge branch 'remove_jiraissue' into 'master' · c890f760
      Robert Speicher authored
      Remove JiraIssue model and replace references with ExternalIssue
      
      This MR Removes unused JiraIssue class and replaces references with ExternalIssue
      
      Closes #18203 
      
      See merge request !4659
      c890f760
    • Robert Speicher's avatar
      Merge branch 'add_autocomplete_for_labels' into 'master' · 1d342204
      Robert Speicher authored
      Add GFM autocomplete for labels
      
      Closes #14637 
      
      See merge request !4013
      1d342204
  2. 16 Jun, 2016 16 commits
    • Jacob Schatz's avatar
      Merge branch 'tree-file-title' into 'master' · 465f4c30
      Jacob Schatz authored
      Added title attribute to entries in tree view
      
      ## What does this MR do?
      
      Adds a title attribute to entries in the tree view. Moe useful when files have long names.
      
      ## What are the relevant issue numbers?
      
      Closes #18353 
      
      
      See merge request !4709
      465f4c30
    • Jacob Schatz's avatar
      Merge branch 'media-query-bug' into 'master' · e4366b8a
      Jacob Schatz authored
      Fix project header alignment media query bug
      
      ## What does this MR do?
      Fixes media query bug on project header
      
      ## Screenshots (if relevant)
      ![Screen_Shot_2016-06-15_at_3.22.20_PM](/uploads/3d84f8ffb88c316f317048e15ffea4f3/Screen_Shot_2016-06-15_at_3.22.20_PM.png)
      
      See merge request !4689
      e4366b8a
    • Jacob Schatz's avatar
      Merge branch 'hide-todo-collapsed-sidebar' into 'master' · 2368d8a4
      Jacob Schatz authored
      Hide the Todo button in the collapsed issuable sidebar.
      
      ## What does this MR do?
      
      Fixes a bug where the "Add Todo" button was displayed in the collapsed sidebar.
      
      ## Are there points in the code the reviewer needs to double check?
      
      This shouldn't remove any other elements from the collapsed sidebar.
      
      ## What are the relevant issue numbers?
      
      None
      
      ## Screenshots (if relevant)
      
      Before:
      
      ![Screen_Shot_2016-06-15_at_11.41.46_AM](/uploads/27a1ace58cf8c44ad96accd3d0b32f11/Screen_Shot_2016-06-15_at_11.41.46_AM.png)
      
      After:
      
      ![Screen_Shot_2016-06-15_at_11.40.53_AM](/uploads/91a8585680fc482682d0efafdba4d599/Screen_Shot_2016-06-15_at_11.40.53_AM.png)
      
      See merge request !4686
      2368d8a4
    • Jacob Schatz's avatar
      Merge branch 'dz-fix-mr-widget-padding' into 'master' · 22062952
      Jacob Schatz authored
      Add bottom padding for merge request command line text
      
      Because without bottom padding text is too close to the UI tabs - hard to navigate
      
      
      
      See merge request !4681
      22062952
    • Jacob Schatz's avatar
      Merge branch 'mr-download-dropdown-alignment' into 'master' · 8e0b00d4
      Jacob Schatz authored
      Fixed alignment of download dropdown
      
      ## What does this MR do?
      
      Correctly aligns the download dropdown on merge requests
      
      ## Screenshots (if relevant)
      
      ![Screen_Shot_2016-06-14_at_14.47.06](/uploads/9381f25110e5573e56aa5c3f46786df5/Screen_Shot_2016-06-14_at_14.47.06.png)
      
      See merge request !4646
      8e0b00d4
    • Jacob Schatz's avatar
      Merge branch 'push-event-banner-container' into 'master' · 4856d0af
      Jacob Schatz authored
      Fixed last push event banner not being in container
      
      ## What does this MR do?
      
      Adds the last push event content into a container with the correct class.
      
      ## What are the relevant issue numbers?
      
      Closes #18567 
      
      ## Screenshots (if relevant)
      
      ![Screen_Shot_2016-06-14_at_13.17.41](/uploads/4afa3d2c73e59c5ffbd53869e49baa92/Screen_Shot_2016-06-14_at_13.17.41.png)
      
      See merge request !4644
      4856d0af
    • Stan Hu's avatar
      Merge branch 'fair-usage-of-shared-runners' into 'master' · 90765f97
      Stan Hu authored
      Fair usage of Shared Runners
      
      ## What does this MR do?
      
      Introduces a fair usage scheduler for shared runners.
      
      It tries to assign builds to shared runner from projects that have the lowest number of builds currently running on shared runners.
      
      **Example 1**:
      ```
      We have following builds in queue:
      build 1 for project 1
      build 2 for project 1
      build 3 for project 1
      build 4 for project 2
      build 5 for project 2
      build 6 for project 3
      
      With the new algorithm we will assign builds in following order:
      - We choose build 1, because project 1 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds,
      - We choose build 4, because project 2 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds,
      - We choose build 6, because project 3 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds,
      - We choose build 2, because project 1 as other it runs 1 build,
      - We choose build 5, because project 2 runs 1 build, where project 1 runs 2 builds now,
      - We choose build 3, because project 1 and runs 2 builds.
      ```
      
       
      **Example 2**:
      ```
      We have following builds in queue:
      build 1 for project 1
      build 2 for project 1
      build 3 for project 1
      build 4 for project 2
      build 5 for project 2
      build 6 for project 3
      
      With the new algorithm we will assign builds in following order:
      - We choose build 1, because project 1 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds,
      - We finish build 1,
      - We choose build 2, because project 1 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds,
      - We choose build 4, because project 2 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds,
      - We finish build 4,
      - We choose build 5, because project 2 doesn't run currently any builds and has the lowest build number from projects that doesn't run builds,
      - We choose build 6, because project 3 doesn't run currently any builds,
      - We choose build 3, because project 1, 2 and 3 runs exactly one build now,
      ```
      
      ## Why was this MR needed?
      
      Currently, we are scheduling builds using FIFO. This is catastrophic if there are projects that create a 100-300 jobs, this basically eats most of available shared runners.
      
      ## Performance
      
      All this logic is implemented with the help of SQL queries, because this is the fastest way to process 1k-2k pending builds in queue.
      It's not the fastest SQL query, because it sorts based on number of running_builds, and this forces to calculate a number of running builds for all dependent projects. However, since we have one/two shared runners that asks every few seconds for builds this should have minimal impact on DB performance.
      
      ```
       explain analyze SELECT "ci_builds".* FROM "ci_builds" JOIN (SELECT "ci_builds"."gl_project_id", count(case when status = 'running' AND runner_id = (SELECT "ci_runners"."id" FROM "ci_runners" WHERE "ci_runners"."is_shared" = 't') then 1 end) as running_builds FROM "ci_builds" INNER JOIN "projects" ON "projects"."id" = "ci_builds"."gl_project_id" AND "projects"."pending_delete" = 'f' WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."status" IN ('running', 'pending') AND "projects"."builds_enabled" = 't' AND "projects"."shared_runners_enabled" = 't' GROUP BY "ci_builds"."gl_project_id") AS projects ON ci_builds.gl_project_id=projects.gl_project_id WHERE "ci_builds"."type" IN ('Ci::Build') AND "ci_builds"."status" = 'pending' AND "ci_builds"."runner_id" IS NULL  ORDER BY projects.running_builds ASC, ci_builds.id ASC;
                                                                                        QUERY PLAN                                                                        
                 
      --------------------------------------------------------------------------------------------------------------------------------------------------------------------
      -----------
       Sort  (cost=64777.28..64777.29 rows=1 width=1010) (actual time=301.794..302.535 rows=1537 loops=1)
         Sort Key: (count(CASE WHEN (((public.ci_builds.status)::text = 'running'::text) AND (public.ci_builds.runner_id = $0)) THEN 1 ELSE NULL::integer END)), public.ci
      _builds.id
         Sort Method: quicksort  Memory: 1423kB
         ->  Nested Loop  (cost=63279.78..64777.27 rows=1 width=1010) (actual time=66.384..298.724 rows=1537 loops=1)
               ->  HashAggregate  (cost=63177.15..63177.30 rows=15 width=15) (actual time=65.641..65.851 rows=187 loops=1)
                     InitPlan 1 (returns $0)
                       ->  Seq Scan on ci_runners  (cost=0.00..26963.66 rows=1 width=4) (actual time=1.145..34.381 rows=1 loops=1)
                             Filter: is_shared
                             Rows Removed by Filter: 6965
                     ->  Nested Loop  (cost=0.00..36186.34 rows=2715 width=15) (actual time=0.065..29.717 rows=1710 loops=1)
                           ->  Index Scan using index_ci_builds_on_status on ci_builds  (cost=0.00..8913.95 rows=3577 width=15) (actual time=0.051..12.012 rows=2583 loops
      =1)
                                 Index Cond: ((status)::text = ANY ('{running,pending}'::text[]))
                                 Filter: ((type)::text = 'Ci::Build'::text)
                                 Rows Removed by Filter: 1219
                           ->  Index Scan using projects_pkey on projects  (cost=0.00..7.61 rows=1 width=4) (actual time=0.003..0.004 rows=1 loops=2583)
                                 Index Cond: (id = public.ci_builds.gl_project_id)
                                 Filter: ((NOT pending_delete) AND builds_enabled AND shared_runners_enabled)
                                 Rows Removed by Filter: 0
               ->  Bitmap Heap Scan on ci_builds  (cost=102.63..106.64 rows=1 width=1002) (actual time=1.216..1.231 rows=8 loops=187)
                     Recheck Cond: ((gl_project_id = public.ci_builds.gl_project_id) AND ((status)::text = 'pending'::text))
                     Filter: ((runner_id IS NULL) AND ((type)::text = 'Ci::Build'::text))
                     ->  BitmapAnd  (cost=102.63..102.63 rows=1 width=0) (actual time=1.201..1.201 rows=0 loops=187)
                           ->  Bitmap Index Scan on index_ci_builds_on_gl_project_id  (cost=0.00..10.52 rows=241 width=0) (actual time=0.406..0.406 rows=1944 loops=187)
                                 Index Cond: (gl_project_id = public.ci_builds.gl_project_id)
                           ->  Bitmap Index Scan on index_ci_builds_on_status  (cost=0.00..91.78 rows=3089 width=0) (actual time=0.652..0.652 rows=3362 loops=187)
                                 Index Cond: ((status)::text = 'pending'::text)
       Total runtime: 303.832 ms
      ```
      
      ## Specific runners
      
      It doesn't affect the specific runners which still serve builds FIFO.
      
      @stanhu @markpundsack @yorickpeterse What do you think?
      
      
      See merge request !4634
      90765f97
    • Jacob Schatz's avatar
      Merge branch 'build-scroll-controls-on-complete' into 'master' · f726d7dc
      Jacob Schatz authored
      Shows build scroll buttons after build is complete
      
      ## What does this MR do?
      
      Shows the build scroll buttons whenever there is a build trace. Previously they were only shown when the build was active.
      
      ## What are the relevant issue numbers?
      
      Closes #18515 
      
      ## Screenshots (if relevant)
      
      ![Screen_Shot_2016-06-13_at_11.42.42](/uploads/6e0577f46a0cc7b4f2f13b17c85d97da/Screen_Shot_2016-06-13_at_11.42.42.png)
      
      See merge request !4621
      f726d7dc
    • Jacob Schatz's avatar
      Merge branch 'award-emoji-fix' into 'master' · 7f17b118
      Jacob Schatz authored
      Fix emoji block selector.
      
      Fixes #18465 and #18577
      
      See merge request !4604
      7f17b118
    • Jacob Schatz's avatar
      Merge branch 'diff-scroll-point' into 'master' · e405811d
      Jacob Schatz authored
      Fixed issue when opening a highlighted line diff
      
      ## What does this MR do?
      
      With the new project nav being fixed, the diff page is scrolling the highlighted under the nav meaning you cant see what is highlighted. This corrects that by added the height of the new project nav into the offset.
      
      See merge request !4597
      e405811d
    • Jacob Schatz's avatar
      Merge branch 'merge-request-default-source-branch-text' into 'master' · 80fc11ac
      Jacob Schatz authored
      Added source branch text to dropdown toggle
      
      ## What does this MR do?
      
      Previously, the dropdown toggle would default to "Select source branch", this changes that so that it defaults to the branch name and if that doesn't exist, it defaults to "Select source branch"
      
      ## Screenshots (if relevant)
      
      ![Screen_Shot_2016-06-07_at_12.20.10](/uploads/40d31e21297a99300050cf9f23bd7371/Screen_Shot_2016-06-07_at_12.20.10.png)
      
      See merge request !4504
      80fc11ac
    • Douwe Maan's avatar
      Merge branch 'banzai-issue-filter-queries' into 'master' · 8da04625
      Douwe Maan authored
      Reduce SQL query counts in IssueReferenceFilter
      
      ## What does this MR do?
      
      This MR adds a preparation phase for reference filters that allows them to prepare/create data structures used while iterating over HTML nodes. In this particular case the preparation phase is used for issue references to greatly cut down the amount of queries executed to get projects/issues for Markdown references.
      
      ## Are there points in the code the reviewer needs to double check?
      
      No.
      
      ## Why was this MR needed?
      
      Rendering Markdown containing issue references would run at most two queries for every issue reference: one to get the project and one to get the issue from said project. When rendering Markdown with lots of issue references this would result in _a lot_ of queries being executed.
      
      ## What are the relevant issue numbers?
      
      #18042
      
      See merge request !4410
      8da04625
    • Robert Speicher's avatar
      Update VERSION to 8.9.0-rc5 · 38647410
      Robert Speicher authored
      38647410
    • Jacob Schatz's avatar
      Merge branch 'template_dropdown' into 'master' · 4053a404
      Jacob Schatz authored
      Implements TemplateDropdown class to create custom template dropdowns
      
      ## What does this MR do?
      Refactorize template dropdowns. This MR creates a base TemplateSelector class so it can be reused for multiple types of templates.
      
      ## Does this MR meet the acceptance criteria?
      
      - [ ] [CHANGELOG](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CHANGELOG) entry added
      - [ ] [Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)
      - [ ] API support added
      - [ ] Tests
        - [ ] Added for this feature/bug
        - [x] All builds are passing
      - [ ] 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)
      - [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)
      
      See merge request !4697
      4053a404
    • Stan Hu's avatar
      7610a11d
    • Douwe Maan's avatar
      Merge branch '18474-missing-images-on-confirmation-email' into 'master' · 40e8204b
      Douwe Maan authored
      Fix images in emails
      
      Closes #18474. The confirmation email is actually the only one that uses the `image_tag` helper at the moment, but this will work for all of them:
      ```shell
      $ ag image_tag -G mailer
      app/views/layouts/devise_mailer.html.haml
      13:              = image_tag('mailers/gitlab_header_logo.png', id: 'logo', alt: 'GitLab Wordmark')
      24:                  = image_tag('mailers/gitlab_tanuki_2x.png', alt: 'GitLab Logo')
      ```
      
      See merge request !4705
      40e8204b