choco icon indicating copy to clipboard operation
choco copied to clipboard

Enable pushing a choco package from a remote CI server like CI appveyor.

Open moh-hassan opened this issue 1 year ago • 6 comments

Issue: Enhancement or feature request

Is Your Feature Request Related To A Problem? Please describe.

N/A

Describe The Solution. Why is it needed?

choco push command enble pushing the package located on the file system as described in doc:

choco push [<path to nupkg>] [<options/switches>]

[<path to nupkg>] is a file located on disk

There is a scenario that choco package is created on a CI server like appveyor then pushed to github release site. e.g. https://github.com/user1/mypackage/releases/download/v1.2.3/mypackage.1.2.3.nupkg

To publish this package: 1- Download the package from github and save to disk by PowerShell script, like:

$url='https://github.com/user1/mypackage/releases/download/v1.2.3/mypackage.1.2.3.nupkg'
$pkg='c:\mypackages\mypackage.1.2.3.nupkg'
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile($url,$pkg)

2 - Run choco push command to push the package with my apikey.

choco push $pkg --api-key $Env:api_key 
  • Suggested Feature Request:

It's nice if choco push has a feature to push directly from http(s)/ftp server where the package is located.

Solution 1:

The push command will auto download the package from the web server http(s) to a file on disk, then push the file

Syntax of the command:
choco push [<path to nupkg> | url to nupkg] [<options/switches>]

Example:
choco push https://github.com/user1/mypackage/releases/download/v1.2.3/mypackage.1.2.3.nupkg   --api-key $Env:api_key 

Solution 2:

A new command may be: push-url

Syntax of the command:
choco push-url [url to nupkg] [<options/switches>]

Example:

choco push-url  https://github.com/user1/mypackage/releases/download/v1.2.3/mypackage.1.2.3.nupkg  --api-key $Env:api_key 

Additional Context.

The advantage of this feature is end-to-end pushing the package from http(s)/ftp server without downloading and pushing.

Related Issues

N/A

moh-hassan avatar Aug 14 '22 23:08 moh-hassan

@moh-hassan Can you go back and complete the template otherwise we will not be able to look at this issue.

pauby avatar Aug 15 '22 08:08 pauby

@pauby Thanks for reply I updated the issue as you suggested.

moh-hassan avatar Aug 16 '22 02:08 moh-hassan

There is a scenario that choco package is created on a CI server like appveyor then pushed to github release site.

I'd generally suggest pushing the package directly in the CI build.

With the .nuspec elements Chocolatey has added that are not available in nuget, you already need Chocolatey installed on the CI server to pack the package. CI systems normally have a way to specify secrets, so the API key can be stored there. Then choco push can be run, while specifying the API key and path to the .nupkg.

Here is an example of that in action: https://ci.appveyor.com/project/chocolateycommunity/chocolatey-packages https://github.com/chocolatey-community/chocolatey-packages/blob/master/.appveyor.yml

TheCakeIsNaOH avatar Aug 19 '22 19:08 TheCakeIsNaOH

Thanks @TheCakeIsNaOH for suggestion. Pushing the package directly from within appveyor can be an option. Sometimes, the package owner/maintainer may delay the pushing of the package to have a chance to: Do more tests on the actual package: validate , remote anti-virus check , install /run/uninstall package, then finally push the package. This new feature can enable pushing the package from the remote http(s) to chocolatey gallery (end-to-end production / from source to target). It can be: Pack now and Push Later :)

moh-hassan avatar Aug 21 '22 15:08 moh-hassan

@moh-hassan This can be completed today by pushing the package from the local folder.

Sometimes, the package owner/maintainer may delay the pushing of the package to have a chance to: Do more tests on the actual package: validate , remote anti-virus check , install /run/uninstall package, then finally push the package.

I'm not sure I understand. If you are talking about pushing from a URL then how does the above help with that? If you are doing all of the above then you'll have the package locally to push anyway?

This new feature can enable pushing the package from the remote http(s) to chocolatey gallery (end-to-end production / from source to target).

Again, I'm not seeing the connection from this to the one above?

It can be: Pack now and Push Later :)

You can do that now by packing it locally and then pushing it directly.

pauby avatar Aug 22 '22 10:08 pauby

@pauby
My comment to @TheCakeIsNaOH was to show why one may pack only and delay pushing the package in Appveyor. It's not related to this feature.

My concern in the provided feature is enabling the pushing of a package whatever it's located on disk or located on a remote http(s) without the need of downloading the package on disk then pushing.

moh-hassan avatar Aug 22 '22 23:08 moh-hassan