无法将对现有Powershell模块的更新发布到我们的Artifact Store。
在我的脚本中,我注册我的存储库和软件包源:
Register-PSRepository -Name ArtifactoryDev -SourceLocation $NuGetDevUrl -PublishLocation $NuGetDevUrl -InstallationPolicy Trusted -Credential $Cred
Register-PackageSource -Name ArtifactoryDev -ProviderName NuGet -Location $NuGetDevUrl -Trusted -Credential $Cred
然后,我在脚本结尾处尝试发布模块以更新Artifactory中现有的模块:
Publish-Module -Path $Module.Path -Repository $RepositoryName -NuGetApiKey "$($ArtifactoryUser):$($ArtifactoryToken)" -Credential $Cred -Force -ErrorAction Stop -Verbose -Debug
我遇到以下错误
2019-06-27T12:12:24.2452350Z ##[error]PackageManagement\Get-PackageSource : Unable to find repository 'ArtifactoryDev'. Use Get-PSRepository to see all
available repositories.
At C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.1.5\PSModule.psm1:9360 char:35
+ ... ckageSources = PackageManagement\Get-PackageSource @PSBoundParameters
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Microsoft.Power...etPackageSource:GetPackageSource) [Get-PackageSource]
, Exception
+ FullyQualifiedErrorId : SourceNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.GetPackageSource
要检查存储库是否存在,我想打电话给 Get-PackageSource-名称ArtifatoryDev
我可以在结果中看到它:
Name ProviderName IsTrusted Location
---- ------------ --------- --------
ArtifactoryDev PowerShellGet True http://myremoterepo
答案 0 :(得分:1)
我在发布功能上也遇到了类似的问题。您是否在发布前尝试过注销并重新注册该回购协议?我发现可以解决问题。出于某种原因,发布模块会在发布之前对存储库进行一次匿名调用以检查版本(我认为),如果存储库是安全的(或不允许进行匿名身份验证),则可能会出错。通过在发布之前注销并重新注册该回购协议,我发现以某种方式解决了匿名调用...不确定确切的原因。