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

Publish-PSResource for a module does not seem to respect ExternalModuleDependencies #1768

Open
3 tasks done
jamie-oconnell opened this issue Jan 2, 2025 · 0 comments
Open
3 tasks done

Comments

@jamie-oconnell
Copy link

Prerequisites

  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues.

Steps to reproduce

Trying to Publish a module to an internal hosted repo that has an ExternalModuleDependencies array included. The contained Dependencies are not skipped and cannot be resolved as they are not available in the internal repo.

Publish-PSResource -Path .\src\Test.Entra\ -Repository Test -Verbose -Debug

@{
    RootModule = 'Test.Entra.psm1'
    ModuleVersion = '0.0.0'
    CompatiblePSEditions = 'Desktop', 'Core'
    GUID = '81286142-e568-4d75-9559-de88923f27df'
    Author = 'User'
    CompanyName = 'Test'
    Copyright = '(c) Test. All rights reserved.'
    Description = 'Test'
    PowerShellVersion = '5.1'
    RequiredModules = @(
        @{"ModuleName" = "Microsoft.Graph.Authentication"; "ModuleVersion" = "2.10.0"}
    )
    FunctionsToExport = @("Test")
    CmdletsToExport = '*'
    VariablesToExport = '*'
    AliasesToExport = '*'
    PrivateData = @{
        PSData = @{
            ExternalModuleDependencies = @("Microsoft.Graph.Authentication")
        }
    }
}

Tested with a nuget V2 repo and ACR.

Expected behavior

Expect Microsoft.Graph.Authentication dependency to be skipped as it is included in ExternalModuleDependencies. Testing with PowerShellGet via Publish-Module the same Module manifest works correctly and debug logs show dependency was skipped.

Actual behavior

DEBUG: In PublishHelper::CreateNuspec()
DEBUG: In PublishHelper::ParseRequiredModules()
VERBOSE: The newly created nuspec is: C:\Users\user\AppData\Local\Temp\f6e29d91-a313-477e-bc71-2b6be7ad52c8\Test.Entra.nuspec
DEBUG: In PublishHelper::PackNupkg()
VERBOSE: Successfully packed the resource into a .nupkg
DEBUG: In PublishHelper::CheckDependenciesExist()
DEBUG: In FindHelper::FindByResourceName()
DEBUG: Parameters passed in >>> Name: 'Microsoft.Graph.Authentication'; ResourceType: 'Module'; VersionRange: '2.10.0'; NuGetVersion: '2.10.0'; VersionType: 'SpecificVersion'; Version: '2.10.0'; Prerelease: 'True'; Tag: ''; Repository: 'Test'; IncludeDependencies 'False'
DEBUG: Searching through repository 'Test'
DEBUG: In FindHelper::SearchByNames()
DEBUG: Exact version and package name are specified
DEBUG: In V2ServerAPICalls::FindVersion()
DEBUG: In V2ServerAPICalls::HttpRequestCall()
DEBUG: Request url is 'http://localhost:9011//FindPackagesById()?$filter=Id+eq+%27Microsoft.Graph.Authentication%27+and+NormalizedVersion+eq+%272.10.0%27+and+substringof(%27PSScript%27%2c+Tags)+eq+false&$inlinecount=allpages&id=%27Microsoft.Graph.Authentication%27'
DEBUG: Response is empty
VERBOSE: 'Response status code does not indicate success: 404 (Not Found).' Request sent: 'http://localhost:9011//FindPackagesById()?$filter=Id+eq+%27Microsoft.Graph.Authentication%27+and+NormalizedVersion+eq+%272.10.0%27+and+substringof(%27PSScript%27%2c+Tags)+eq+false&$inlinecount=allpages&id=%27Microsoft.Graph.Authentication%27'
Publish-PSResource: Dependency 'Microsoft.Graph.Authentication' was not found in repository 'Test'.  Make sure the dependency is published to the repository before publish this module.
VERBOSE: Deleting temporary directory 'C:\Users\user\AppData\Local\Temp\f6e29d91-a313-477e-bc71-2b6be7ad52c8'

Error details

No response

Environment data

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Binary     1.1.0      rc3        Microsoft.PowerShell.PSResourceGet  {Compress-PSResource, Find-PSResource, Get-InstalledPSResource, Get-PSResourceRepository…}
 
Key   : PSVersion
Value : 7.4.6
Name  : PSVersion
 
 
Key   : PSEdition
Value : Core
Name  : PSEdition
 
 
Key   : GitCommitId
Value : 7.4.6
Name  : GitCommitId
 
 
Key   : OS
Value : Microsoft Windows 10.0.22631
Name  : OS
 
 
Key   : Platform
Value : Win32NT
Name  : Platform
 
 
Key   : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0…}
Name  : PSCompatibleVersions
 
 
Key   : PSRemotingProtocolVersion
Value : 2.3
Name  : PSRemotingProtocolVersion
 
 
Key   : SerializationVersion
Value : 1.1.0.1
Name  : SerializationVersion
 
 
Key   : WSManStackVersion
Value : 3.0
Name  : WSManStackVersion

Visuals

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant