- 
        Couldn't load subscription status. 
- Fork 54
Experimental PowerShell discover extension #1071
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
          
     Open
      
      
            Gijsreyn
  wants to merge
  41
  commits into
  PowerShell:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
Gijsreyn:implement-powershell-discover
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from 21 commits
      Commits
    
    
            Show all changes
          
          
            41 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      dd41634
              
                Init
              
              
                Gijsreyn 9e04ed5
              
                Use concurrentbag
              
              
                Gijsreyn dae94e4
              
                Use .NET
              
              
                Gijsreyn 6ec70d7
              
                Use .NET with enumeration option
              
              
                Gijsreyn d13045d
              
                Init
              
              
                Gijsreyn 33b7ab2
              
                Use concurrentbag
              
              
                Gijsreyn f12038e
              
                Use .NET
              
              
                Gijsreyn 991f7ce
              
                Use .NET with enumeration option
              
              
                Gijsreyn 1e80819
              
                Remove undiscovered resource
              
              
                Gijsreyn 6337045
              
                Merge branch 'implement-powershell-discover' of https://github.com/Gi…
              
              
                Gijsreyn 69ef042
              
                Init
              
              
                Gijsreyn f7c606a
              
                Use concurrentbag
              
              
                Gijsreyn f93e691
              
                Use .NET
              
              
                Gijsreyn 16bf2f5
              
                Use .NET with enumeration option
              
              
                Gijsreyn 34375b6
              
                Init
              
              
                Gijsreyn 16b41c4
              
                Use concurrentbag
              
              
                Gijsreyn 3037ffe
              
                Use .NET
              
              
                Gijsreyn 1ef6482
              
                Use .NET with enumeration option
              
              
                Gijsreyn f15195a
              
                Remove undiscovered resource
              
              
                Gijsreyn 1caa83a
              
                Merge branch 'implement-powershell-discover' of https://github.com/Gi…
              
              
                Gijsreyn a7263ba
              
                Fix point 2
              
              
                Gijsreyn 640c664
              
                Add newline
              
              
                Gijsreyn 1b58423
              
                Merge branch 'main' into implement-powershell-discover
              
              
                Gijsreyn 6992c43
              
                Merge branch 'main' into implement-powershell-discover
              
              
                Gijsreyn 5ec950e
              
                Merge branch 'main' into implement-powershell-discover
              
              
                Gijsreyn c139f8a
              
                Merge branch 'main' into implement-powershell-discover
              
              
                Gijsreyn 861a017
              
                Add caching
              
              
                Gijsreyn 48202c7
              
                Debug tests
              
              
                Gijsreyn e99c662
              
                Format file
              
              
                Gijsreyn 0dfe4cd
              
                Revert to working situation
              
              
                Gijsreyn ff104c2
              
                Create function
              
              
                Gijsreyn 091e017
              
                Catch empty value
              
              
                Gijsreyn 9b6c993
              
                Re-add tests
              
              
                Gijsreyn 5c736a7
              
                Update tests
              
              
                Gijsreyn 12009a9
              
                Remove Write-DscTrace
              
              
                Gijsreyn 4438bf9
              
                Move test plus docs fix
              
              
                Gijsreyn 55bb84b
              
                Merge branch 'main' of https://github.com/Gijsreyn/operation-methods …
              
              
                Gijsreyn d9082b8
              
                Merge conflict
              
              
                Gijsreyn 7152173
              
                Merge branch 'main' into implement-powershell-discover
              
              
                Gijsreyn a8e5dbd
              
                Trying to fix new build
              
              
                Gijsreyn 451db62
              
                Merge branch 'implement-powershell-discover' of https://github.com/Gi…
              
              
                Gijsreyn File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| powershell.discover.ps1 | ||
| powershell.dsc.extension.json | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|  | ||
| [CmdletBinding()] | ||
| param () | ||
|  | ||
| begin { | ||
| $psPaths = $env:PSModulePath -split [System.IO.Path]::PathSeparator | Where-Object { $_ -notmatch 'WindowsPowerShell' } | ||
| } | ||
| process { | ||
| $manifests = $psPaths | ForEach-Object -Parallel { | ||
| $searchPatterns = @('*.dsc.resource.json', '*.dsc.resource.yaml', '*.dsc.resource.yml') | ||
| $enumOptions = [System.IO.EnumerationOptions]@{ IgnoreInaccessible = $false; RecurseSubdirectories = $true } | ||
|         
                  Gijsreyn marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
| foreach ($pattern in $searchPatterns) { | ||
| try { | ||
| [System.IO.Directory]::EnumerateFiles($_, $pattern, $enumOptions) | ForEach-Object { | ||
| @{ manifestPath = $_ } | ||
| } | ||
| } catch { } | ||
| } | ||
| } -ThrottleLimit 10 | ||
| } | ||
| end { | ||
| $manifests | ForEach-Object { $_ | ConvertTo-Json -Compress } | ||
| } | ||
|         
                  Gijsreyn marked this conversation as resolved.
              Outdated
          
            Show resolved
            Hide resolved | ||
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|  | ||
| BeforeAll { | ||
| $fakeManifest = @{ | ||
| '$schema' = "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json" | ||
| type = "Test/FakeResource" | ||
| version = "0.1.0" | ||
| get = @{ | ||
| executable = "fakeResource" | ||
| args = @( | ||
| "get", | ||
| @{ | ||
| jsonInputArg = "--input" | ||
| mandatory = $true | ||
| } | ||
| ) | ||
| } | ||
| } | ||
|  | ||
| $manifestPath = Join-Path $TestDrive "fake.dsc.resource.json" | ||
| $fakeManifest | ConvertTo-Json -Depth 10 | Set-Content -Path $manifestPath | ||
| $env:PSModulePath += [System.IO.Path]::PathSeparator + $TestDrive | ||
| } | ||
|  | ||
| Describe 'Tests for PowerShell resource discovery' { | ||
| It 'Should find DSC PowerShell resources' { | ||
| $out = dsc resource list | ConvertFrom-Json | ||
| $LASTEXITCODE | Should -Be 0 | ||
| $out.directory | Should -Contain $TestDrive | ||
| } | ||
| } | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| { | ||
| "$schema": "https://aka.ms/dsc/schemas/v3/bundled/resource/manifest.json", | ||
| "type": "Microsoft.PowerShell/Discover", | ||
| "version": "0.1.0", | ||
| "description": "Discovers DSC resources packaged in PowerShell 7 modules.", | ||
| "discover": { | ||
| "executable": "pwsh", | ||
| "args": [ | ||
| "-NoLogo", | ||
| "-NonInteractive", | ||
| "-ExecutionPolicy", | ||
| "Bypass", | ||
| "-NoProfile", | ||
| "-Command", | ||
| "./powershell.discover.ps1" | ||
| ] | ||
| } | ||
| } | 
      
      Oops, something went wrong.
        
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Uh oh!
There was an error while loading. Please reload this page.