Closed danmetzler closed 2 years ago
It occurs to me that the above proposal would force other users, if anyone is using this, to modify their $au_GallerUrl config. It's possible to avoid that by adding another global variable, perhaps $au_GalleryFeed...
if ( !$au_GalleryUrl ) { $au_GalleryUrl = 'https://chocolatey.org' }
if (!$au_GalleryFeed) { $au_GalleryFeed = 'packages' }
$choco_url = "$au_GalleryUrl/$au_GalleryFeed/{0}/{1}" -f $global:Latest.PackageName, $package.RemoteVersion
au_GalleryFeed in essence is just a holder for the middle part of the url. If it isn't defined then it behaves as it does today.
Its IMO better to have alternate variable and deprecate au_GalleryUrl
$au_GalleryPackageRootUrl = 'https://chocolatey.org/packages'
Previous one would be kept for compatibility reasons, but if new one is there it is used instead.
I agree using a new alternate variable is a better solution.
I've also run into this recently while using Artifactory's NuGet repo for chocolatey packages. I've worked around it in my case by setting the au_PushUrl
env var in the update.ps1
script for each package to push to the packages/package_name/
path:
$Env:au_PushUrl = 'https://artifactory.example.com/artifactory/api/nuget/chocolatey-local/packages/package_name/'
Then au_GalleryUrl
env var in update_all.ps1
is the standard path to the repo:
$global:au_GalleryUrl = 'https://artifactory.example.com/artifactory/api/nuget/chocolatey-local/'
+1 for the suggested fix of adding $au_GalleryPackageRootUrl
au_GalleryUrl assumes all chocolatey packages are hosted in a feed called packages. So in Update-Package.ps1 it is referenced like this:
When packages are hosted in an internal feed this is not always the case; as when the internal feed is in something like Inedo's Proget. This could be fixed by changing the code as follows: