PowerShell / PowerShell/PSResourceGet
Unable to publish-module to NuGet with a required module dependency
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 576
- Fork
- 114
- Merge medio
- 1g 2h
- PR unite (30g)
- 7
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Iniziare dal manifesto del modulo in src/CloudTek.Automation.K8S/CloudTek.Automation.K8S.psd1 e dagli entry point referenziati PrePublish.ps1 e scripts/Publish.ps1. Riprodurre la sequenza Install-Module e Publish-Module nell’ambiente PowerShell e Linux indicato, quindi verificare che un modulo con una dipendenza RequiredModules possa essere pubblicato dal filesystem CI locale senza generare l’errore "invalid-entry".
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- github-actions, powershell
- Ambito
- ci-cd, release, tooling
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100