Skip to content
Snippets Groups Projects

Extract common parts of the Maven dependency proxy

Merged David Fernandez requested to merge 435644-extract-dependency-proxy-logic into master
All threads resolved!

:sunglasses: Context

In Maven dependency proxy (&3610 - closed), we implemented and delivered the Maven dependency proxy. Read about it here: https://docs.gitlab.com/ee/user/packages/package_registry/dependency_proxy/.

We are now starting working on npm Virtual Registry MVC: Single Upstream and A... (&3608) which is exactly the same features set (GitLab acting as a pull through cache) but for the NPM package format.

The Maven dependency proxy has some interactions with the Package Registry as it uses it as a cache location (see https://docs.gitlab.com/ee/user/packages/package_registry/dependency_proxy/#advanced-caching). This is the core behavior of the dependency proxy for packages that we will need to implement for NPM.

To avoid a massive code duplication, in this MR, we're going to extract all the common logic that will be used by both dependency proxies.

This is preparatory work for the implementation of NPM dependency proxy: implement the download tg... (#435644 - closed) and later.

If you're interested to see these changes + the first step for the NPM proxy, see NPM dependency proxy tgz download file endpoint (!144320 - merged). If we look at the ee/lib/api/dependency_proxy/packages/npm.rb, we only need 100 lines to implement the first endpoint of the NPM dependency proxy :heart_eyes_cat:

:mag: What does this MR do and why?

  • Extract the Maven dependency proxy caching logic into helper functions.
  • Update the tracking events so that they adapt to the considered package format.
  • Move the DependencyProxy::Packages::Maven::VerifyPackageFileEtagService to DependencyProxy::Packages::VerifyPackageFileEtagService as this service is part of the caching logic and is not really tied to a package format (and we're going to use for NPM too).
    • Move the related specs.

No changelog here as this is a pure code extract with no impact on the existing Maven dependency proxy behaviors. If there is an impact, that will be considered as a typebug.

We are quite confident in this refactoring as the maven dependency proxy is covered by a pretty large requests spec and a feature spec (which also checks all the :ping_pong: s done with workhorse).

:race_car: MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

:white_check_mark:

:tv: Screenshots or screen recordings

No changes in the UI :unicorn:

:gear: How to set up and validate locally

Follow https://docs.gitlab.com/ee/user/packages/package_registry/dependency_proxy/

Edited by David Fernandez

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Contributor
    2 Warnings
    :warning: This merge request is quite big (560 lines changed), please consider splitting it into multiple merge requests.
    :warning: e3c5f77d: The commit body should not contain more than 72 characters per line. For more information, take a look at our Commit message guidelines.

    Reviewer roulette

    Category Reviewer Maintainer
    backend @praba.m7n profile link current availability (UTC+5.5, 4.5 hours ahead of author) @egrieff profile link current availability (UTC+1, same timezone as author)
    test for spec/features/* @praba.m7n profile link current availability (UTC+5.5, 4.5 hours ahead of author) Maintainer review is optional for test for spec/features/*

    Please check reviewer's status!

    • available Reviewer is available!
    • unavailable Reviewer is unavailable!

    Please refer to documentation page for guidance on how you can benefit from the Reviewer Roulette, or use the GitLab Review Workload Dashboard to find other available reviewers.

    If needed, you can retry the :repeat: danger-review job that generated this comment.

    Generated by :no_entry_sign: Danger

  • David Fernandez changed the description

    changed the description

  • David Fernandez resolved all threads

    resolved all threads

  • David Fernandez
  • David Fernandez
  • David Fernandez
  • David Fernandez
  • David Fernandez
  • David Fernandez
  • David Fernandez
  • David Fernandez changed the description

    changed the description

  • added workflowin review label and removed workflowin dev label

  • David Fernandez requested review from @mkhalifa3 and @subashis

    requested review from @mkhalifa3 and @subashis

  • Contributor

    E2E Test Result Summary

    allure-report-publisher generated test report!

    e2e-test-on-gdk: :white_check_mark: test report for 2aa646b7

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Monitor     | 4      | 0      | 0       | 0     | 4     | ✅     |
    | Data Stores | 0      | 0      | 2       | 0     | 2     | ➖     |
    | Govern      | 3      | 0      | 0       | 0     | 3     | ✅     |
    | Create      | 8      | 0      | 3       | 0     | 11    | ✅     |
    | Package     | 24     | 0      | 2       | 0     | 26    | ✅     |
    | Plan        | 4      | 0      | 0       | 0     | 4     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 43     | 0      | 7       | 0     | 50    | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+

    e2e-package-and-test: :white_check_mark: test report for 2aa646b7

    expand test summary
    +------------------------------------------------------------------+
    |                          suites summary                          |
    +-------------+--------+--------+---------+-------+-------+--------+
    |             | passed | failed | skipped | flaky | total | result |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Package     | 227    | 0      | 16      | 18    | 243   | ✅     |
    | Create      | 140    | 0      | 21      | 4     | 161   | ✅     |
    | Data Stores | 0      | 0      | 2       | 0     | 2     | ➖     |
    | Plan        | 4      | 0      | 0       | 0     | 4     | ✅     |
    | Govern      | 3      | 0      | 0       | 0     | 3     | ✅     |
    | Monitor     | 4      | 0      | 0       | 0     | 4     | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
    | Total       | 378    | 0      | 39      | 22    | 417   | ✅     |
    +-------------+--------+--------+---------+-------+-------+--------+
  • mentioned in issue #435644 (closed)

  • Moaz Khalifa
  • Moaz Khalifa
  • Subashis Chakraborty approved this merge request

    approved this merge request

  • David Fernandez added 1 commit

    added 1 commit

    Compare with previous version

  • Author Maintainer

    Applying pipeline:skip-undercoverage as the two functions without tests will be actually be used by the NPM dependency proxy.

    For the Maven dependency proxy, we override them to have a different behavior.

  • David Fernandez requested review from @mkhalifa3

    requested review from @mkhalifa3

  • Moaz Khalifa requested review from @egrieff

    requested review from @egrieff

  • Moaz Khalifa approved this merge request

    approved this merge request

  • Moaz Khalifa removed review request for @mkhalifa3

    removed review request for @mkhalifa3

  • 🤖 GitLab Bot 🤖 changed milestone to %16.10

    changed milestone to %16.10

  • Eugenia Grieff approved this merge request

    approved this merge request

  • David Fernandez requested review from @egrieff

    requested review from @egrieff

  • Eugenia Grieff resolved all threads

    resolved all threads

  • Eugenia Grieff enabled an automatic merge when the pipeline for 47c9c444 succeeds

    enabled an automatic merge when the pipeline for 47c9c444 succeeds

  • merged

  • Eugenia Grieff mentioned in commit 740c2759

    mentioned in commit 740c2759

  • added workflowstaging label and removed workflowcanary label

  • Please register or sign in to reply
    Loading