chocolatey / chocolatey/choco

Cache download url objects

Open
#1,390 33 comments 0 reactions 0 assignees View on GitHub
0 - Backlog Pro/Business
Dominant language
C#
Stars
11.5k
Forks
960
PR merge metrics
No merged PRs in 30d

Description

@ferventcoder thanks for your response on https://stackoverflow.com/questions/45867716/nexus-to-serve-up-chocolately-packages about recompile packages. That is good to know, but it got me thinking that there is a code smell with this approach. Choco is touching the original source. Why not cache the download urls? Choco already has a convention to require url, checksum and checksum type for x86 and/or x64 installs, so it could be possible to do this. This approach doesn't molest the original choco package.

Since the word cache is already used, let's call this `stash` for the purpose of this conversation. Feel free to change it.

Stash will store objects downloaded from urls defined in choco package. The stash will be in nuget format with url hashed and appended after version (I don't know nuget but I think that should work, if not, then you get the general gist).

Stash Command

`choco stash [list]|add|remove|disable|enable []`

Examples

```
choco stash add -n=global -s="https://somewhere/out/there/api/v2/" -k="'314132413251235'"
choco stash add --default -n=development -s="https://somewhere/else/out/there/api/v2/" -k="'231238747123423'"
choco stash remove -n=stage
choco stash disable -n=global
choco stash enable -n=global
```

Options/Switches
```
-n, --name=VALUE
Name - the name of the stash. Required with some actions. Defaults to
empty.

-s, --source=VALUE
Source - The source. This can be a folder/file share or an http location.
If it is a url, it will be a location you can go to in a browser and
it returns OData with something that says Packages in the browser,
similar to what you see when you go to https://chocolatey.org/api/v2/.

-k, --key=VALUE
Key - The Source's key. Encrypted in chocolatey.config file.

--default
Default stash - Only one stash can be default. First stash added
to list will automatically be set as default. Stashed urls will use
default when --stash-name is not provided.

--ignore-stash
Ignore Stash - A comma delimited list of URIs that will be ignored. By
default source is automatically ignored.
```

Choco install/upgrade

Options/Switches
```
--no-stash
No Stash - Will not stash object downloaded even if stash is enabled

--stash-name
Stash Name - Name of stash to store downloaded object. If not provided,
the default stash is used.
```

Algorythm

- If stash is enabled and --no-stash false then
- hash url
- check if stashed
- if stashed
- download from stash to local cache
- validate against checksum
- else
- download url to local cache
- validate against checksum
- push to stash
- end
- else
- download url to local cache
- validate against checksum
- end
- continue to do what choco does today

This seems like a cleaner approach, but I don't know all the ins and outs like you do.

Contributor guide

Open the contributing guide

Research direction

The issue proposes a new `choco stash` command and new stash options for install and upgrade; no files, tests, or implementation entry points are named. Start by locating the existing command and download flows, then determine the project's design before assessing whether the listed stash behavior and URL validation requirements can be completed.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.