PowerShell/PowerShellGetv2

Install-Module fails to install from a local path on GitHub actions runner

mmisztal1980 opened this issue · 0 comments

Prerequisites

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

Steps to reproduce

I'm working on emitting powershell modules from a github repo to nuget. My repo contains 2 modules:

  • A: CloudTek.Automation.Shell
  • B: CloudTek.Automatuon.K8S

B has a dependency on A, therefore I've added it to it's RequiredModules . I've encountered a problem during Publish-Module and I'm attempting to solve it. If my understanding is correct, in order to successfully publish B with Publish-Module, A needs to be installed locally 1st as indicated here.

Expected behavior

I'm expecting `Install-Module` on A to succeed while installing B locally from a path on the local filesystem of a GitHub actions runner (ubuntu-latest), so that I can execute `Publish-Module` on B in the next step.

Actual behavior

The pipeline fails as seen here

Install-Module fails with:

VERBOSE: Repository details, Name = 'CloudTek.Automation.Shell', Location = '/home/runner/work/automation/automation/src/CloudTek.Automation.Shell'; IsTrusted = 'False'; IsRegistered = 'True'.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: Using the specified source names : 'CloudTek.Automation.Shell'.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is '/home/runner/work/automation/automation/src/CloudTek.Automation.Shell' and PackageManagementProvider is 'NuGet'.
VERBOSE: Total package yield:'0' for the specified package 'CloudTek.Automation.Shell'.
Entering debug mode. Use h or ? for help. 

At /home/runner/.local/share/powershell/Modules/PowerShellGet/2.2.5/PSModule.psm1:9711 char:13
+             $installedPackages = PackageManagement\Install-Package @P …
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Install-Package: No match was found for the specified search criteria and module name
'CloudTek.Automation.Shell'. Try Get-PSRepository to see all available
registered module repositories.

followed by Publish-Module's failure to publish

VERBOSE: Repository details, Name = 'NuGet', Location = 'https://api.nuget.org/v3/index.json'; IsTrusted = 'False'; IsRegistered = 'True'.
VERBOSE: Repository details, Name = 'NuGet', Location = 'https://api.nuget.org/v3/index.json'; IsTrusted = 'False'; IsRegistered = 'True'.
VERBOSE: Publish Location:'https://api.nuget.org/v3/index.json'.
Write-Error: /home/runner/work/_temp/43d11780-5c96-43ce-83ec-0d6aafbdc1b7.ps1:2
Line |
   2 |  ./Publish.ps1 `
     |  ~~~~~~~~~~~~~~~
     | Failed to publish module CloudTek.Automation.K8S :   The
     | specified RequiredModules entry 'CloudTek.Automation.Shell' in
     | the module manifest
     | '/home/runner/work/automation/automation/src/CloudTek.Automation.K8S/CloudTek.Automation.K8S.psd1' is invalid. Try again after updating this entry with valid values.


### Error details

```console
Exception             : System.Exception: No match was found for the specified 
                        search criteria and module name 'CloudTek.Automation.Sh
                        ell'. Try Get-PSRepository to see all available registe
                        red module repositories.
TargetObject          : Microsoft.PowerShell.PackageManagement.Cmdlets.InstallP
                        ackage
CategoryInfo          : ObjectNotFound: (Microsoft.PowerShel…lets.InstallPackag
                        e:InstallPackage) [Install-Package], Exception
FullyQualifiedErrorId : NoMatchFoundForCriteria,Microsoft.PowerShell.PackageMan
                        agement.Cmdlets.InstallPackage
ErrorDetails          : 
InvocationInfo        : System.Management.Automation.InvocationInfo
ScriptStackTrace      : at Install-Module<Process>, /home/runner/.local/share/p
                        owershell/Modules/PowerShellGet/2.2.5/PSModule.psm1: li
                        ne 9711
                        at <ScriptBlock>, /home/runner/work/automation/automati
                        on/src/CloudTek.Automation.K8S/PrePublish.ps1: line 16
                        at <ScriptBlock>, /home/runner/work/automation/automati
                        on/src/CloudTek.Automation.K8S/PrePublish.ps1: line 7
                        at <ScriptBlock>, /home/runner/work/automation/automati
                        on/scripts/Publish.ps1: line 31
                        at <ScriptBlock>, /home/runner/work/_temp/476525ff-140e
                        -429e-810c-50cafc565387.ps1: line 2
                        at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo : {0, 1}

Environment data

Key   : PSVersion
Value : 7.2.6
Name  : PSVersion


Key   : PSEdition
Value : Core
Name  : PSEdition


Key   : GitCommitId
Value : 7.2.6
Name  : GitCommitId


Key   : OS
Value : Linux 5.15.0-1022-azure #27~20.04.1-Ubuntu SMP Mon Oct 17 02:03:50 UTC 
        2022
Name  : OS


Key   : Platform
Value : Unix
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

Version

2.2.5

Visuals

No response