发布模块不适用于Azure DevOps管道

Xanderu

因此,经过一番混乱和按摩之后,我的举升和换档管道遇到了大多数问题,除了以下两项突出的问题:

  1. 当以天蓝色的devops管道运行时(当我在本地运行它时,它可以正常工作),出现以下错误:
Publish-Module : The specified module 'xanderu.helpers' with version '0.3.2' was not published because no module with 
that name and version was found in any module directory.
  1. 成功构建后,我希望我的模块从Azdo管道推送到公共的Github存储库中(以便其他人可以利用我构建的内容)

这是驱动整个过程的源代码的链接:https : //github.com/Xander-Rudolph/powershell

关于AZDO管道运行时,为什么发布模块无法找到我复制到documents文件夹中的模块,有人有任何想法吗?

这是其失败的确切位置(文件。\ Public \ Publish-ToPSGallery.ps1):

        $PublishModulePath = Join-Path $module.FullName /$moduleName
        $UserModulePath = ($env:PSModulePath -split ";")[0]
        ...
        copy-item $PublishModulePath $UserModulePath -force -Recurse
        Publish-Module @moduleParams -RequiredVersion $thisVersion
        Remove-Item (Join-Path $UserModulePath /$moduleName) -Force -Recurse

编辑:遵循@WaitingForGuacamole的建议后,我现在更加困惑。这些文件实际上在两个地方都存在,因此有关Microsoft置备的某些内容必须检查不同的路径...

2021-02-22T13:14:26.1798590Z copy from D:\a\1\s\modules\xanderu.helpers\xanderu.helpers to C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules...
2021-02-22T13:14:26.1907802Z Publish path contents:
2021-02-22T13:14:26.2053090Z 
2021-02-22T13:14:26.2055406Z 
2021-02-22T13:14:26.2057324Z     Directory: D:\a\1\s\modules\xanderu.helpers\xanderu.helpers
2021-02-22T13:14:26.2057953Z 
2021-02-22T13:14:26.2058831Z 
2021-02-22T13:14:26.2062498Z Mode                LastWriteTime         Length Name                                                                  
2021-02-22T13:14:26.2065623Z ----                -------------         ------ ----                                                                  
2021-02-22T13:14:26.2090344Z d-----        2/22/2021   1:13 PM                private                                                               
2021-02-22T13:14:26.2091497Z d-----        2/22/2021   1:13 PM                public                                                                
2021-02-22T13:14:26.2213533Z -a----        2/22/2021   1:13 PM           8344 xanderu.helpers.psd1                                                  
2021-02-22T13:14:26.2225536Z -a----        2/22/2021   1:13 PM           3986 xanderu.helpers.psm1                                                  
2021-02-22T13:14:26.2236604Z 
2021-02-22T13:14:26.2239849Z 
2021-02-22T13:14:26.2240328Z     Directory: D:\a\1\s\modules\xanderu.helpers\xanderu.helpers\private
2021-02-22T13:14:26.2240554Z 
2021-02-22T13:14:26.2240651Z 
2021-02-22T13:14:26.2242897Z Mode                LastWriteTime         Length Name                                                                  
2021-02-22T13:14:26.2245357Z ----                -------------         ------ ----                                                                  
2021-02-22T13:14:26.2249485Z -a----        2/22/2021   1:13 PM           8681 New-ModuleTemplate.ps1                                                
2021-02-22T13:14:26.2259995Z -a----        2/22/2021   1:13 PM           2112 New-ScriptTemplate.ps1                                                
2021-02-22T13:14:26.2268743Z 
2021-02-22T13:14:26.2269195Z 
2021-02-22T13:14:26.2270936Z     Directory: D:\a\1\s\modules\xanderu.helpers\xanderu.helpers\public
2021-02-22T13:14:26.2271221Z 
2021-02-22T13:14:26.2271676Z 
2021-02-22T13:14:26.2275692Z Mode                LastWriteTime         Length Name                                                                  
2021-02-22T13:14:26.2277782Z ----                -------------         ------ ----                                                                  
2021-02-22T13:14:26.2281863Z -a----        2/22/2021   1:13 PM           3386 New-PowershellTemplate.ps1                                            
2021-02-22T13:14:26.2294701Z -a----        2/22/2021   1:13 PM          15800 Publish-ToPSGallery.ps1                                               
2021-02-22T13:14:26.2304889Z User path contents:
2021-02-22T13:14:26.2319844Z 
2021-02-22T13:14:26.2320556Z 
2021-02-22T13:14:26.2322076Z     Directory: C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules
2021-02-22T13:14:26.2322549Z 
2021-02-22T13:14:26.2323876Z 
2021-02-22T13:14:26.2328059Z Mode                LastWriteTime         Length Name                                                                  
2021-02-22T13:14:26.2331429Z ----                -------------         ------ ----                                                                  
2021-02-22T13:14:26.2340492Z d-----        2/22/2021   1:14 PM                private                                                               
2021-02-22T13:14:26.2350981Z d-----        2/22/2021   1:14 PM                public                                                                
2021-02-22T13:14:26.2356420Z -a----        2/22/2021   1:13 PM           8344 xanderu.helpers.psd1                                                  
2021-02-22T13:14:26.2369615Z -a----        2/22/2021   1:13 PM           3986 xanderu.helpers.psm1                                                  
2021-02-22T13:14:26.2378132Z 
2021-02-22T13:14:26.2378762Z 
2021-02-22T13:14:26.2380262Z     Directory: C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\private
2021-02-22T13:14:26.2380559Z 
2021-02-22T13:14:26.2380712Z 
2021-02-22T13:14:26.2387210Z Mode                LastWriteTime         Length Name                                                                  
2021-02-22T13:14:26.2389867Z ----                -------------         ------ ----                                                                  
2021-02-22T13:14:26.2394106Z -a----        2/22/2021   1:13 PM           8681 New-ModuleTemplate.ps1                                                
2021-02-22T13:14:26.2406799Z -a----        2/22/2021   1:13 PM           2112 New-ScriptTemplate.ps1                                                
2021-02-22T13:14:26.2470087Z 
2021-02-22T13:14:26.2470773Z 
2021-02-22T13:14:26.2472253Z     Directory: C:\Users\VssAdministrator\Documents\WindowsPowerShell\Modules\public
2021-02-22T13:14:26.2472928Z 
2021-02-22T13:14:26.2473097Z 
2021-02-22T13:14:26.2479170Z Mode                LastWriteTime         Length Name                                                                  
2021-02-22T13:14:26.2482022Z ----                -------------         ------ ----                                                                  
2021-02-22T13:14:26.2486251Z -a----        2/22/2021   1:13 PM           3386 New-PowershellTemplate.ps1                                            
2021-02-22T13:14:26.2499805Z -a----        2/22/2021   1:13 PM          15800 Publish-ToPSGallery.ps1                                               
2021-02-22T13:14:26.8343310Z Publish-Module : The specified module 'xanderu.helpers' with version '0.3.3' was not published because no module with 
2021-02-22T13:14:26.8344032Z that name and version was found in any module directory.
2021-02-22T13:14:26.8344599Z At C:\Program Files\WindowsPowerShell\Modules\xanderu.helpers\0.3.2\public\Publish-ToPSGallery.ps1:137 char:13
2021-02-22T13:14:26.8345194Z +             Publish-Module @moduleParams -RequiredVersion $thisVersio ...
2021-02-22T13:14:26.8345691Z +             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2021-02-22T13:14:26.8346249Z     + CategoryInfo          : InvalidArgument: (xanderu.helpers:String) [Publish-Module], ArgumentException
2021-02-22T13:14:26.8346842Z     + FullyQualifiedErrorId : ModuleNotAvailableLocallyToPublish,Publish-Module
2021-02-22T13:14:26.8347201Z  

编辑2:我将路径设置为C:\ Program Files \ Windowspowershell路径,这似乎绕过了这个问题,但是它引发了有关无效权限的nuget 403错误...在这里仍然有些时髦...(请参阅模块版本0.4.2)

Xanderu

实际上,这比我做的要简单得多。关于WaitingForGuacamole的建议确实暴露了问题所在。由于某种原因,用户目录不是publish-module命令的有效位置。更新模块以使用C:\ Program Files \ WindowsPowerShell路径后,我开始看到403错误,但这实际上不是AZDO存储库的错误,这是因为我重置了PSGallery密钥并且没有更新管道参数。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章