Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

au_GalleryUrl implementation assumes all chocolatey packages are hosted in a feed called packages #250

Closed
danmetzler opened this issue Sep 27, 2021 · 4 comments · Fixed by #255

Comments

@danmetzler
Copy link
Contributor

au_GalleryUrl assumes all chocolatey packages are hosted in a feed called packages. So in Update-Package.ps1 it is referenced like this:

                if ( !$au_GalleryUrl ) { $au_GalleryUrl = 'https://chocolatey.org' } 
                $choco_url = "$au_GalleryUrl/packages/{0}/{1}" -f $global:Latest.PackageName, $package.RemoteVersion

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:

                if ( !$au_GalleryUrl ) { $au_GalleryUrl = 'https://chocolatey.org/packages' } 
                $choco_url = "$au_GalleryUrl/{0}/{1}" -f $global:Latest.PackageName, $package.RemoteVersion
@danmetzler
Copy link
Contributor Author

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.

@majkinetor
Copy link
Owner

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.

@danmetzler
Copy link
Contributor Author

I agree using a new alternate variable is a better solution.

@nickkeyzer
Copy link

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants