Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: handle extensionPack and extensionDependencies when installing extensions #3150

Merged
merged 1 commit into from Jul 20, 2023

Conversation

benoitf
Copy link
Collaborator

@benoitf benoitf commented Jul 7, 2023

What does this PR do?

Install other extensions if extension has extensionDependencies field
Handle extension that provides extensionPack elements

example:

{
  "name": "extension-pack-example",
  "version": "0.1.1",
  "publisher": "fbenoit",
  "displayName": "Red Hat Extension Pack",
  "description": "A collection of extensions published by Red Hat",
  "license": "apache-2.0",
  "icon": "extension.png",
  "keywords": [
    "Red Hat"
  ],
  "categories": [
    "Extension Packs"
  ],
  "engines": {
    "podman-desktop": "^1.0.0"
  },
  "extensionPack": [
    "redhat.redhat-sandbox",
    "redhat.openshift-local"
  ]
}

when deploying this example both redhat.redhat-sandbox and redhat.openshift-local will be deployed

Screenshot/screencast of this PR

qRQwPBUpAd.mp4

What issues does this PR fix or reference?

fixes #2829
fixes #2828

How to test this PR?

Unit tests provided

You can also try by installing quay.io/fbenoit/ext-pack-sample extension (you'll get OpenShift Sandbox and OpenShift Local extensions if not already installed)

@benoitf benoitf requested a review from a team as a code owner July 7, 2023 12:36
@benoitf benoitf requested review from jeffmaury and cdrage and removed request for a team July 7, 2023 12:36
Copy link
Contributor

@lstocchi lstocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and works fine but what happens if the dependency has a dependency itself?

Extension A depends on B, but B depends on C?
Would C be installed when installing A?

…extensions

fixes containers#2829
fixes containers#2828

Signed-off-by: Florent Benoit <fbenoit@redhat.com>
@benoitf
Copy link
Collaborator Author

benoitf commented Jul 20, 2023

Hello @lstocchi I've changed logic to get all transitive dependencies

You can try to install quay.io/fbenoit/ext-a (ext A depends on B that depends on C)

for that you need to tweak the 'catalog'

+++ b/packages/main/src/plugin/extensions-catalog/extensions-catalog.ts
@@ -31,7 +31,8 @@ import type {
  * Allow to grab content from the online extensions catalog.
  */
 export class ExtensionsCatalog {
-  public static readonly ALL_EXTENSIONS_URL = 'https://registry.podman-desktop.io/api/extensions.json';
+  public static readonly ALL_EXTENSIONS_URL =
+    'https://raw.githubusercontent.com/benoitf/podman-desktop-catalog/main/registry.json';

Copy link
Contributor

@lstocchi lstocchi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!! Thanks 🚀

@benoitf benoitf merged commit 5e2055d into containers:main Jul 20, 2023
8 checks passed
@podman-desktop-bot podman-desktop-bot added this to the 1.3.0 milestone Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add extension-pack support Pull dependencies of extensions automatically
4 participants