PSResourceGet icon indicating copy to clipboard operation
PSResourceGet copied to clipboard

Please support git/http

Open danielniccoli opened this issue 4 years ago • 10 comments

I'd like to suggest offering support for git/http based repositores.

PowerShellGet 2 supports only NuGet or SMB repositories. NuGet repositories like powershellgallery.com (PSG) is great as a platforum to centrally distribute (especially binary) modules.

Disadvantages of NuGet and SMB repositories

It's an entry barrier because after you commited the code to your git repository, you need additional steps to publish the module to PSG, starting by registering a PSG account and retrieving an API key. Then you must maintain the code repository as well as the PSG repository.

For company-use this is even more of a burden. Modules may be company-internal, meaning that they cannot be published at PSG. In addition to the above, you require a NuGet repository, which requires a server, a repository service and specific knowldge, which in turn requires more staff, more budget and more time. Alternatively you can rely on SMB repositories, which require nothing more than a file server. However, there may be limitations due to security concerns or file share permission management.

Advantages of git/http repositories

With git/http support, you would be able to install a module from any git server, regardless of the transport protocol. Publishing modules would be integrated into the development flow. Modules can be locally developed and pushed into any git repository, be it local or on an SMB share, on GitHub, GitLab or BitBucket. From there PowerShellGet 3 should be able to download them via SMB or http GET.

This would enable beginners or maintainers of smaller modules to keep all of their workflow on the same platform.

This would also enable companies to develop internal-use modules and distribute them using already available tools.

How it could work

Take a look at the built-in Go package management. Modules can be directly published to github (instead of something like npm or pypi) and can be retrieved and with e.g. go get github.com/google/codesearch/index.

Without knowing how Golang solved this, one example would be like this: Let's say we want to publish a module named CompanyADUserTools.

  • The master branch would be the current stable version of the module. Tags are used for versioning and they must be equal to the version string in the module metadata (psd1).
  • To install the module, you could do Install-Module https://gitlab.intranet.company.com/it/CompanyADUserTools.
  • This would get the module from the master branch.
  • To publish a new version, merge the changes into master and tag it as a new version.
  • To update the module you would then run Install-Module https://gitlab.intranet.company.com/it/CompanyADUserTools. PowerShellGet would then compare the installed version with the master branch versions, or simply just get the current master branch.
  • Using tags you can install older versions of the module.

danielniccoli avatar Jul 01 '20 17:07 danielniccoli

Issue-Label Bot is automatically applying the label feature_request to this issue, with a confidence of 0.93. Please mark this comment with :thumbsup: or :thumbsdown: to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

issue-label-bot[bot] avatar Jul 01 '20 17:07 issue-label-bot[bot]

Tools like Scoop and their manifest are a great example of how to do this right with Git repositories. I think right now the main focus should be parity with PowershellGet 2.x to get adoption and support, then this should be considered as a 3.1+ item.

JustinGrote avatar Jul 08 '20 17:07 JustinGrote

I would like to have this sooner rather than later. One needs to learn YAML to do any CI\CD thru GitHubActions or AzPipelines. This would make consuming modules\scripts from GitHub repositories much easier.

Ayanmullick avatar Jul 27 '20 14:07 Ayanmullick

To the people who downvoted this: It would be helpful for a constructive discussion if you could give your opinion and the reason for the downvote.

danielniccoli avatar Aug 03 '20 18:08 danielniccoli

@Ayanmullick the source code is right there, you could attempt a PR, though they aren't taking PRs at the moment :)

JustinGrote avatar Aug 03 '20 18:08 JustinGrote

Please, let us not shut down opinions with a "the source code is right there" argument. He's emphasizing that this is imporant to him. We all know that priorisation is done by the people working on the code.

danielniccoli avatar Aug 03 '20 19:08 danielniccoli

@danielniccoli, my understanding is that PowerShell supports this for other providers like Cloudsmith repo but not for GitHub or ADO.

https://help.cloudsmith.io/docs/powershell-modules-repository#upload-a-package-via-native-powershell-module-tooling

Ayanmullick avatar Jun 09 '22 05:06 Ayanmullick

@Ayanmullick these are still NuGet repositories. Notice the -ProviderName NuGet parameter.

danielniccoli avatar Jun 10 '22 15:06 danielniccoli