PowerShell / PowerShell/PSResourceGet

Unable to publish-module to NuGet with a required module dependency

Open
#843 30 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Area-Publish Issue-Bug
Dominant language
C#
Stars
576
Forks
114
Avg merge
1d 2h
Merged PRs (30d)
7

Description

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

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 previously published version of 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.

In my CI I'm using PowershellGet 3.0.17-beta17.

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

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
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
Visuals

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the module manifest at src/CloudTek.Automation.K8S/CloudTek.Automation.K8S.psd1 and the referenced PrePublish.ps1 and scripts/Publish.ps1 entry points. Reproduce the Install-Module and Publish-Module sequence on the stated PowerShell and Linux environment, then verify that a module with a RequiredModules dependency can be published from the local CI filesystem without the invalid-entry error.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, powershell
Domain
ci-cd, release, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.