Expand Package Manager integration to support other source plugins

Created on 28 September 2022, about 2 years ago
Updated 19 June 2024, 6 months ago

Problem/Motivation

#3284945: Install endpoints that leverage Package Manager + core APIs โ†’ adds support for the Drupal.org mock source plugin, but is tightly coupled.
For some source plugins, like Drupal Core modules, there's no need to have integration.
But it should be possible for other plugins to get composer installation functionality

Steps to reproduce

Proposed resolution

Remaining tasks

  • โœ… File an issue about this project
  • โ˜ Manual Testing
  • โ˜ Code Review
  • โ˜ Accessibility Review
  • โ˜ Automated tests needed/written?
โœจ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

๐Ÿ‡บ๐Ÿ‡ธUnited States tim.plunkett Philadelphia

Live updates comments and jobs are added and updated live.
  • Starshot blocker

    A potential blocker for Drupal Starshot. More information: http://www.drupal.org/project/starshot

Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    This is needed in order for Project Browser to support the Recipes initiative, which is strategically important. Therefore, I think we should un-postpone this and make it happen.

    For implementation, I would suggest simply adding something like this to \Drupal\project_browser\Plugin\ProjectBrowserSourceInterface:

    public function isProjectSafe(Project $project): bool;
    

    To prevent BC breaks, I would add a default implementation to \Drupal\project_browser\Plugin\ProjectBrowserSourceBase which always returns FALSE.

    I also think it would be beneficial for the method to receive a full Project object, if possible, rather than just a project ID, in the case the "is this safe" decision needs to be based on multiple factors (like whether the project is maintained, etc.) That would probably require some sort of way to retrieve the Project object from a cache of some kind. Should be interesting!

  • Status changed to Active 12 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Postponed for over a year...!

    Well, a lot has changed in that year. I think we can bravely move forward with this one.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Nope!

  • First commit to issue fork.
  • Merge request !428Revert "WIP: Expand PM support" โ†’ (Open) created by srishtiiee
  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    Not currently mergeable.
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    Custom Commands Failed
  • Pipeline finished with Failed
    11 months ago
    Total: 317s
    #88714
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    64 pass, 3 fail
  • Pipeline finished with Failed
    11 months ago
    Total: 312s
    #88737
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    Custom Commands Failed
  • Pipeline finished with Failed
    11 months ago
    Total: 323s
    #89596
  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    11 months ago
    Total: 336s
    #89915
  • Merge request !430Resolve #3312354 "Expand pm support" โ†’ (Open) created by srishtiiee
  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    11 months ago
    Total: 326s
    #90249
  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    11 months ago
    Total: 358s
    #90296
  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    @srishtiiee You mentioned in Slack:

    Tim suggested that having the caching layer on top and using the same for all plugins as it currently did isnโ€™t appropriate as the caching is query specific. I opened a new MR with plugin level caching and need feedback on it whether Iโ€™m on the right track and what the next steps would be.

    I donโ€™t know the Project Browser codebase at all, but I want to help you if I can!

    So Iโ€™m trying to grok what youโ€™re doing in https://git.drupalcode.org/project/project_browser/-/merge_requests/430/... ๐Ÿค“

    AFAICT you:

    1. removed the caching from ProjectBrowserEndPointController, which essentially boils down to removing an if-branch and pulling up the else level to a higher level
    2. moved it into MockDrupalDotOrg instead

    Doesnโ€™t this mean that thereโ€™s no caching at all anymore? ๐Ÿค” What am I missing? ๐Ÿ™ˆ

  • ๐Ÿ‡ฎ๐Ÿ‡ณIndia srishtiiee

    I intended to move the whole caching layer one level down to the plugins instead of having a common layer for all the source plugins. I might have incorrectly interpreted what @tim.plunkett had suggested but the idea was to have the plugins handle their caching individually/separately which is what I tried to do by moving it into the MockDrupalDotOrg plugin.

  • ๐Ÿ‡ง๐Ÿ‡ชBelgium wim leers Ghent ๐Ÿ‡ง๐Ÿ‡ช๐Ÿ‡ช๐Ÿ‡บ

    Aha, I see, that makes sense!

    But this did not yet update https://git.drupalcode.org/project/project_browser/-/blob/1.0.x/src/Plug..., which is why I was confused. But โ€ฆ looking at that plugin now, I see:

      protected function getProjectData(): array {
        $stored_projects = $this->cacheBin->get('DrupalCore:projects');
        if ($stored_projects) {
          return $stored_projects->data;
        }
    

    so there's no changes needed? Which also means you've just removed extraneous caching for when this plugin is being used?

    If the above is correct, then AFAICT, yes, you're on the right track ๐Ÿ˜„๐Ÿ‘

  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 11 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    11 months ago
    Total: 1106s
    #91196
  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 10 months ago
    Waiting for branch to pass
  • Pipeline finished with Success
    10 months ago
    #100307
  • Status changed to Needs review 10 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    I have almost no complaints here. Just a couple of questions. But otherwise I feel like this is RTBC.

  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 10 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    10 months ago
    Total: 310s
    #102134
  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 10 months ago
    Waiting for branch to pass
  • Pipeline finished with Success
    10 months ago
    Total: 360s
    #102145
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 10 months ago
    Custom Commands Failed
  • Pipeline finished with Success
    10 months ago
    #103810
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    I think this looks good. I do have one question on the MR for @tim.plunkett, though: https://git.drupalcode.org/project/project_browser/-/merge_requests/430#...

  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 10 months ago
    Custom Commands Failed
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 10 months ago
    Custom Commands Failed
  • Pipeline finished with Canceled
    10 months ago
    Total: 133s
    #106901
  • Pipeline finished with Failed
    10 months ago
    Total: 308s
    #106904
  • Open in Jenkins โ†’ Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 10 months ago
    Custom Commands Failed
  • Pipeline finished with Success
    10 months ago
    Total: 322s
    #110006
  • Status changed to RTBC 10 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    No response from @bnjmnm, so...whatever.

    I'm happy to chalk it up to a "how did this ever work" moment and move on.

    Agreed. Let's move forward.

    I don't expect that this should actually land as-is, but it's usable in its current state! So, RTBC.

  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 9 months ago
    Waiting for branch to pass
  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 9 months ago
    Waiting for branch to pass
  • First commit to issue fork.
  • Open on Drupal.org โ†’
    Core: 10.2.x + Environment: PHP 8.1 & MySQL 5.7
    last update 9 months ago
    Waiting for branch to pass
  • Pipeline finished with Failed
    9 months ago
    Total: 363s
    #135638
  • Status changed to Needs work 9 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine

    Failing PHPCS - I've rebased, please fix! :)

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine

    re-triage

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisfromredfin Portland, Maine
  • Status changed to Closed: duplicate 6 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    I think we have pretty much already done this, now that the activator API and the recipe source plugin have landed.

  • Status changed to Closed: outdated 6 months ago
  • ๐Ÿ‡บ๐Ÿ‡ธUnited States phenaproxima Massachusetts

    Actually, this is more just outdated than anything.

    What we really need is a new issue that rips out the hard-coding that prevents any project that's not from the drupalorg_mockapi source from being installed. With that gone, there'd automatically be first-class support for Package Manager across all sources.

  • ๐Ÿ‡ฆ๐Ÿ‡บAustralia pameeela

    @phenaproxima would you be able to create an issue for it, since it sounds like you have the direction?

Production build 0.71.5 2024