Skip to content

GitLab Next

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab GitLab
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 39,511
    • Issues 39,511
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 1,222
    • Merge requests 1,222
  • Requirements
    • Requirements
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
    • Value stream
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLabGitLab
  • Merge requests
  • !30980

You need to sign in or sign up before continuing.
Merged
Created May 04, 2020 by Nick Kipling@nkiplingContributor8 of 8 tasks completed8/8 tasks

Add package_name param to group packages API

  • Overview 31
  • Commits 4
  • Pipelines 8
  • Changes 5

What does this MR do?

Issue: #216451 (closed)

Adds the package_name parameter to the :id/packages API endpoint at the group level. This allows the list of packages returned from this API call to be filtered by package_name.

Screenshots

No visual changes.

Database

Query:

SELECT
    "packages_packages".*
FROM
    "packages_packages"
WHERE
    "packages_packages"."project_id" IN (17842971, 17719928, 17545989, 17471714, 17421565, 17130955, 17120503, 16494314, 15875037)
    AND ("packages_packages"."package_type" != 4
        OR "packages_packages"."name" != 'NuGet.Temporary.Package')
    AND "packages_packages"."version" IS NOT NULL
    AND "packages_packages"."name" ILIKE '%pypipackage%'
ORDER BY
    created_at DESC
LIMIT 20 OFFSET 0;

Explain (from chatops):

Limit  (cost=86.45..86.45 rows=1 width=83) (actual time=8.567..8.567 rows=1 loops=1)
  Buffers: shared hit=34 read=31
  I/O Timings: read=6.227
  ->  Sort  (cost=86.45..86.45 rows=1 width=83) (actual time=8.567..8.567 rows=1 loops=1)
        Sort Key: created_at DESC
        Sort Method: quicksort  Memory: 25kB
        Buffers: shared hit=34 read=31
        I/O Timings: read=6.227
        ->  Bitmap Heap Scan on packages_packages  (cost=76.54..86.44 rows=1 width=83) (actual time=8.487..8.546 rows=1 loops=1)
              Recheck Cond: ((name)::text ~~* '%pypipackage%'::text)
              Filter: ((version IS NOT NULL) AND ((package_type <> 4) OR ((name)::text <> 'NuGet.Temporary.Package'::text)) AND (project_id = ANY ('{17842971,17719928,17545989,17471714,17421565,17130955,17120503,16494314,15875037}'::integer[])))
              Rows Removed by Filter: 7
              Heap Blocks: exact=8
              Buffers: shared hit=31 read=31
              I/O Timings: read=6.227
              ->  Bitmap Index Scan on index_packages_packages_on_name_trigram  (cost=0.00..76.54 rows=6 width=0) (actual time=8.197..8.197 rows=8 loops=1)
                    Index Cond: ((name)::text ~~* '%pypipackage%'::text)
                    Buffers: shared hit=26 read=28
                    I/O Timings: read=6.196
Planning time: 5.741 ms
Execution time: 8.688 ms

Visual: https://explain.depesz.com/s/39JX

Does this MR meet the acceptance criteria?

Conformity

  • Changelog entry
  • Documentation (if required)
  • Code review guidelines
  • Merge request performance guidelines
  • Style guides
  • Database guides
  • Separation of EE specific content

Availability and Testing

  • Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
  • [-] Tested in all supported browsers
  • [-] Informed Infrastructure department of a default or new setting change, if applicable per definition of done

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • [-] Label as security and @ mention @gitlab-com/gl-security/appsec
  • [-] The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • [-] Security reports checked/validated by a reviewer from the AppSec team
Edited May 05, 2020 by Nick Kipling
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: 216451-add-package_name-as-option-to-group-packages-api

Enable Gitpod?

To use Gitpod you must first enable the feature in the integrations section of your user preferences.

Cancel Enable Gitpod