PowerShell / DSC

This repo is for the DSC v3 project
MIT License
133 stars 22 forks source link

Installing resources #398

Open mgreenegit opened 2 months ago

mgreenegit commented 2 months ago

Summary of the new feature / enhancement

From PS & DevOps Summit session on authoring DSCv3 modules - we will need some way to install resources.

ideally, this could even happen on demand but only from trusted sources. @joshcorr ### Proposed technical implementation details (optional) Since each language has distinct ways to install "things", we could make "install" a capability of adapters. dsc resource install 'computermanagementdsc' --adapter 'microsoft.dsc/powershell' (would run install-psresource computermanagementdsc)
michaeltlombardi commented 2 months ago

Related issues include:

There are two related problems that this issue is discussing, both highlighted in the linked issues:

  1. How do I discover DSC Resources that aren't already on my machine?
  2. How do I install those resources other than finding and downloading/installing them manually or with separate software depending on my platform, how the software is packaged, etc?

92 addresses the discoverability problem by proposing a registry of DSC Resources, similar to the PowerShell Gallery.

47 is specifically discussing a functional-within-DSC mechanism for the installation problem.

This situation is more complicated for DSCv3 than in PSDSC - in PSDSC, you could always just rely on a PowerShell repository for both discovery and install, because there was only one package type independent of platform. For DSCv3, a resource might be available through one or more package management tools and only some subset of available operating systems.

It seems unlikely that we'll write a meta resource that itself handles installing apt, yum, winget, MSI, standalone binary, and OSX packages. More likely, we'll have to do something like I proposed in #92, where resource manifests advertise how to install their associated CLI software (and any resource without the install property can only be manually installed):

{
    "$schema": "https://aka.ms/dsc/schemas/resource_manifest",
    "manifestVersion": "1.0",
    "type": "TSToy/gotstoy",
    "version": "0.1.0",
    "install": {
        "type": "DSC/Intall.GitHubRelease",
        "properties": {
            "repo":  "TSToy/gotstoy"
            "version": "0.1.0"
        }
    },
}