Skip to content
Snippets Groups Projects
  1. Jun 29, 2020
    • Stan Hu's avatar
      Upgrade to Grape v1.3.3 · 3a0c6dd9
      Stan Hu authored
      This brings back many of the changes in
      !27276. This was
      reverted due to some failures in the QA tests with nil parameters.
      
      Grape v1.3.3 brings in Ruby 2.7 support and a number of fixes:
      https://github.com/ruby-grape/grape/blob/master/CHANGELOG.md
      
      1. Move all inherited `Grape::API` -> `Grape::API::Instance`
      2. Remove use of Virtus since this has been removed from Grape.
      3. Extract `Rack::Response` from API error
      4. Grape v1.2.3 pulled in a fix used in `SafeFile`:
      https://github.com/ruby-grape/grape/pull/1844, so we no longer need
      to maintain our custom type.
      5. Adapt `WorkhorseFile` with the latest changes to make custom types
      work with Grape and dry-types.
      6. Ensure `Array[String]` is coerced properly.
      
      The change from Virtus to dry-types now requires all strings to be
      coerced to arrays. Before this was done within Virtus.
      
      7. Coerce `Array[Integer]` types to arrays of integers
      
      8. Use a new helper, `coerce_nil_params_to_array!`, that coerces nil
      Array inputs to empty arrays to preserve previous behavior.
      
      If you have a parameter of type `Array[String]`, for example, Grape used
      to coerce a provided `nil` value to `[]`. Grape no longer does this for
      us, so we need a helper method that will automatically do this if the
      parameter is present.
      
      This merge request also introduces two Rubocop rules for Grape v1.3:
      
      1. `Grape::API::Instance` instead of `Grape::API` is required, unless we
      solve #215230.
      
      2. Grape parameters defined with `Array` types (e.g. `Array[String]`,
      `Array[Integer]`) must have a `coerce_with` block or they will fail to
      parse properly. See
      https://github.com/ruby-grape/grape/blob/master/UPGRADING.md for more
      details.
      3a0c6dd9
  2. Jun 25, 2020
  3. May 27, 2020
  4. May 26, 2020
    • Patrick Derichs's avatar
      Add API endpoint for resource milestone events · a54aee49
      Patrick Derichs authored
      Also add specs and documentation
      
      Edit intro to docs page
      
      Edit docs examples
      
      - Rearrange example requests and responses
      - Surround request URLs in quotation marks
      
      Apply suggestion to app/finders/resource_milestone_event_finder.rb
      
      Apply suggestion to doc/api/resource_milestone_events.md
      a54aee49
  5. May 15, 2020
    • Bob Van Landuyt's avatar
      Log the context metadata for rails requests · 05b7fccd
      Bob Van Landuyt authored and Stan Hu's avatar Stan Hu committed
      This logs the context for Rails-controller and Grape-API reqeusts
      similar to what we do for Sidekiq.
      
      The information comes from Labkit::Context.
      
      This also avoids logging information for unpersisted groups and
      projects in controllers. This was needed since the `#new` actions of
      controllers would assign those ivars but the information is not
      relevant for logs.
      05b7fccd
    • Sean Carroll's avatar
      Freeze Period API changes · e0627762
      Sean Carroll authored and charlie ablett's avatar charlie ablett committed
      Part of #24295
      
      See merge request !29382
      e0627762
  6. May 14, 2020
  7. May 13, 2020
  8. Apr 30, 2020
    • Oswaldo Ferreira's avatar
      Log Puma timeouts for API calls · b7a0bee7
      Oswaldo Ferreira authored
      This handles a specific exception raised
      by `rack-timeout` Gem when Puma requests
      surpass the configured timeout.
      
      This exception wasn't being handled properly
      (and logged), given it inherits from `Exception`,
      which is not handled by Grape `rescue_from :all`.
      b7a0bee7
  9. Apr 27, 2020
    • Stan Hu's avatar
      Revert "Merge branch 'sh-update-grape-gem' into 'master'" · 106dbbfb
      Stan Hu authored
      This reverts merge request !27276
      106dbbfb
    • Stan Hu's avatar
      Upgrade Grape v1.1.0 to v1.3.2 · f31bac1d
      Stan Hu authored
      This brings in Ruby 2.7 suport and a number of fixes:
      https://github.com/ruby-grape/grape/blob/master/CHANGELOG.md
      
      1. Move all inherited Grape::API -> Grape::API::Instance
      2. Remove use of Virtus since this has been removed from Grape.
      3. Extract Rack::Response from API error
      4. Grape v1.2.3 pulled in a fix used in SafeFile:
      https://github.com/ruby-grape/grape/pull/1844, so we no longer need
      to maintain our custom type.
      5. Adapt WorkhorseFile with the latest changes to make custom types work
      with Grape and dry-types.
      6. Ensure Array[String] is coerced properly.
      
      The change from Virtus to dry-types now requires all strings to be
      coerced to arrays. Before this was done within Virtus.
      
      7. Coerce Array[Integer] types to arrays of integers
      
      The change from Virtus to dry-types now requires all strings to be
      coerced to arrays of integers. Before this was done within Virtus.
      f31bac1d
  10. Apr 14, 2020
  11. Apr 07, 2020
  12. Apr 06, 2020
  13. Mar 31, 2020
  14. Mar 27, 2020
  15. Mar 06, 2020
    • Drew Blessing's avatar
      Fix SCIM API Application Context · e530327a
      Drew Blessing authored and Bob Van Landuyt's avatar Bob Van Landuyt committed
      The SCIM API needs
      to override the Application Context and set the user to nil
      since the SCIM API doesn't operate in the context of a user.
      Rather, the SCIM API uses a static token specific to the group
      enabling SCIM.
      
      Without overriding the context saving a user will hang when
      attempting to resolve the current_user set in the Application
      Context in the main API (lib/api/api.rb).
      e530327a
  16. Feb 28, 2020
    • Sean McGivern's avatar
      API endpoint to remove jobs from Sidekiq based on metadata · 5b4fe788
      Sean McGivern authored
      This API endpoint uses job metadata to remove jobs from a queue. It can
      only be used by admins, and deletes as many jobs as it can in 30
      seconds. If it exceeds 30 seconds, it returns a flag indicating that the
      user should try again to finish processing the queue.
      
      (Because of the way Sidekiq queues work, it can't resume where it left
      off, so you just have to start from scratch each time.)
      
      By default, it's implemented in GraphQL, but there's also a matching
      REST endpoint for convenience.
      Verified
      5b4fe788
  17. Feb 20, 2020
  18. Feb 11, 2020
    • George Koltsov's avatar
      Add Group Import API endpoint · 6bf2c12d
      George Koltsov authored and Ash McKenzie's avatar Ash McKenzie committed
      - Add POST '/groups/import' API endpoint
      - Triggers Group Import functionality similar to Project Import
      - Imports a group structure along with it's relations
      6bf2c12d
  19. Feb 10, 2020
  20. Jan 22, 2020
    • Oswaldo Ferreira's avatar
      Add subscription_plan and caller_id to ApplicationContext · 040a742e
      Oswaldo Ferreira authored
      It adds new attributes subscription_plan and caller_id.
      
      The subscription_plan can be "free", "bronze", "silver" or "gold",
      these are exclusively fetched from the given namespace (or the
      project if it's not given).
      
      The caller_id can be the controller action name if it's a regular
      Rails request, or the Grape route, when it's an API request.
      
      These new attributes will also be logged at Sidekiq logs, along
      the project, user and namespace.
      040a742e
  21. Jan 11, 2020
  22. Jan 07, 2020
  23. Jan 03, 2020
    • Bob Van Landuyt's avatar
      Wrap requests in an ApplicationContext · 3c5be56e
      Bob Van Landuyt authored
      This provides context to all requests made to Rails controllers or
      grape endpoints.
      
      Doing this starts a new `Labkit::Context`, to which we can provide a
      namespace, project and user.
      
      We're currently setting the following values:
      
      - Web requests: In the ApplicationController we wrap the entire
        request in a `with_context`.
        - user: based on the `auth_user` if there is one
        - project: We try to read the @Project instance variable of the
          controller.
        - namespace: We try to read the @group instance variable of the
          controller. If there was none, but the project was set, we'll use
          that path to set the namespace
      
      - API requests: The application context is pushed in a before block
        setting the following values:
        - user: to `current_user` if there is one
        - project: to `@Project`
        - namespace: to `@group`
      
      - Internal API requests: the application context is pushed in a before
        block:
        - user: When to the user set in `Api::Support::GitAccessActor`
        - project: to @Project if it was available
      
      The 3 supported attributes for a context are read lazily when
      required.
      
      This also replaces the existing correlation middlewares with the new
      Labkit::Context middlewares.
      
      The rack middleware wraps each rack request in an overarching context
      that adds the correlation id. The context is cleaned up after the
      request, so we're sure all child contexts are cleaned up as well.
      
      The sidekiq client middleware will write the context into the job that
       goes into redis when a job is scheduled.
      
      The sidekiq server middleware will then re-instantiate this context so
      the job gets executed with the same context that was alive when it was
      scheduled. This means that any new job scheduled from sidekiq would
      also have this context.
      3c5be56e
  24. Dec 09, 2019
  25. Dec 06, 2019
  26. Nov 14, 2019
  27. Nov 07, 2019
  28. Sep 09, 2019
  29. Sep 06, 2019
    • Krasimir Angelov's avatar
      Add skeleton Pages internal API · 477ba2b3
      Krasimir Angelov authored
      Basic `/internal/pages` endpoint that will be used for Pages virtual
      domains internal API. The endpoint is currently behind feature flag and
      provides authetication similar to how Workhorse is authenticating with
      the GitLab.
      477ba2b3
  30. Sep 04, 2019
  31. Sep 03, 2019
  32. Aug 30, 2019
    • Gosia Ksionek's avatar
      Refactor IP address state class · 9b182cbd
      Gosia Ksionek authored and Mike Kozono's avatar Mike Kozono committed
      Add middleware to api
      
      Add new middleware class
      
      Cast ip to string
      
      Add specyfication for groups endpoint
      
      Add specs for projects endpoint
      
      Add working specs for ip_saver
      
      Add changelog entry
      
      Add string freeze
      
      Fix rubocop offences
      
      Add code review remarks
      
      Fix typo in filename
      
      Add docs about api restriction
      
      Update docs file
      
      Add changelod
      
      Remove not needed file
      
      Update docs file
      
      Add changelod
      
      Remove changelog
      
      Apply suggestion to doc/user/group/index.md
      
      Add code review remarks
      
      Remove not needed code
      
      Bring back to_s method on remote ip
      
      Add if clause to restrictor
      
      To avoid locking out of ssh calls
      
      Make regex wider so it covers all internal endpoints
      
      Add remote ip to be used in middleware
      
      Add rubocop remarks
      9b182cbd
  33. Aug 20, 2019
  34. Aug 05, 2019
    • Steve Abrams's avatar
      Add group level container repository endpoints · 3dbf3997
      Steve Abrams authored and Mayra Cabrera's avatar Mayra Cabrera committed
      API endpoints for requesting container repositories
      and container repositories with their tag information
      are enabled for users that want to specify the group
      containing the repository rather than the specific project.
      3dbf3997
  35. Jul 30, 2019
    • Yorick Peterse's avatar
      Inject EE modules in a CE compatible fashion · 1112fec4
      Yorick Peterse authored
      All instances of injecting an EE specific module have been changed to
      use the new methods for this: prepend_if_ee, extend_if_ee, and
      include_if_ee. This allows these lines to be included in CE, even when
      the modules to inject do not exist. This in turn allows us to backport
      these lines to CE and keep them there, instead of having to strip them
      out.
      Verified
      1112fec4
Loading