Run components from Viash Hub#816
Conversation
…t from Still allows any component command even if it doesn't make much sense
|
This looks fantastic! Let me build it and try it out before I review, just in case. |
There was a problem hiding this comment.
Hmmm...
When I try to run it, I get:
viash run vsh://toolbox/v0.1.0/yq -- --input codecov.yaml --output output.yamlFetching ANC from https://api-dev.viash-hub.dev/auto-net-config/auto-net-config
Result of fetching ANC from api-dev.viash-hub.dev: Some((AutoNetConfig(v1,2025-04-24T10:56:21+00:00,api-dev.viash-hub.dev/auto-net-config/auto-net-config,Viash-Hub,vsh,Hosts(packages.viash-hub.com,git.viash-hub.com,sshttp.viash-hub.com,images.viash-hub.com,packages.viash-hub.com,Gitlab,web-dev.viash-hub.dev,api-dev.viash-hub.dev,Https),Map(component -> Map(name -> Validation(500,^[a-zA-Z]\w*$), namespace -> Validation(500,^[a-zA-Z]\w*$)), package -> Map(name -> Validation(500,^[a-zA-Z]\w*$)))),{"api_version":"v1","hosts":{"back":"api-dev.viash-hub.dev","back_protocol":"https","front":"web-dev.viash-hub.dev","http":"packages.viash-hub.com","images":"images.viash-hub.com","sources":"packages.viash-hub.com","sources_type":"gitlab","ssh":"git.viash-hub.com","sshttp":"sshttp.viash-hub.com"},"name":"Viash-Hub","prefix":"vsh","provided_by":"api-dev.viash-hub.dev/auto-net-config/auto-net-config","valid_until":"2025-04-24T10:56:21+00:00","validation":{"component":{"name":{"length":500,"pattern":"^[a-zA-Z]\\w*$"},"namespace":{"length":500,"pattern":"^[a-zA-Z]\\w*$"}},"package":{"name":{"length":500,"pattern":"^[a-zA-Z]\\w*$"}}}}))
Fetching package bundle from: Https://api-dev.viash-hub.dev/package-bundle/toolbox/v0.1.0/yq?runner=executable
Exception in thread "ThreadProcess-spawn-Thread-4" java.io.FileNotFoundException: /home/rcannood/.viash/package-bundle-cache/toolbox-v0.1.0-yq-executable.tar.gz (No such file or directory)
There is probably a very logical explanation for this :)
- Can we use
www.viash-hub.comapi.viash-hub.com instead of api-dev.viash-hub.dev? - Can we add a command, something like
viash get ...? Or something likeviash install ..., such that we can install a symlink the executable to.local/binor something like that. Happy to move this to a separate github issue - Could we add some docs to explain how to use the functionality implemented by this command?
|
Woopsie! Fetching packages when the cache folder doesn't exist yet should be fixed now. |
|
1 line in the documention for |
add a few lines on how to use viash run to a component using the package bundle strip a few stripMargin calls that are not needed
bd74c13 to
19fab4f
Compare
|
I think the ANC is still set to Is it okay to delay this PR until it's changed to |
There was a problem hiding this comment.
Pull Request Overview
This PR adds functionality to run Viash components directly from Viash Hub by introducing a new package bundle syntax and auto-network configuration (ANC) system. The implementation allows users to execute components without local building using a vsh:// URI scheme.
- Package bundle fetching from Viash Hub with caching and ETag support
- Auto-network configuration (ANC) system for discovering Viash Hub endpoints
- Documentation updates to consistently use "Viash" capitalization
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/scala/io/viash/helpers/autonetconfig/ | New ANC system for discovering Viash Hub endpoints with caching |
| src/main/scala/io/viash/Main.scala | Package bundle fetching implementation with HTTP client and cache management |
| src/main/scala/io/viash/cli/CLIConf.scala | Updated CLI descriptions and added package bundle usage examples |
| src/main/scala/io/viash/config/dependencies/ | Minor regex fix and documentation correction |
| CHANGELOG.md | Documentation of new package bundle functionality |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| Files.createDirectories(path) | ||
| val etag = Try(Source.fromFile(etag_path.toString).getLines().next()).toOption | ||
|
|
||
| val anc = AutoNetConfig.fetch("api-dev.viash-hub.dev") |
There was a problem hiding this comment.
Hard-coded development URL should be configurable or use production endpoint. Consider using a configuration parameter or environment variable to specify the ANC endpoint.
| val anc = AutoNetConfig.fetch("api-dev.viash-hub.dev") | |
| val ancEndpoint = sys.env.getOrElse("VIASH_ANC_ENDPOINT", "api-dev.viash-hub.dev") | |
| val anc = AutoNetConfig.fetch(ancEndpoint) |
There was a problem hiding this comment.
I fixed the anc address, but while we should have some sort of setting to set anc addresses, I don't think this is the proper way to do it. We should have a system where other prefixes can be specified as well.
Describe your changes
Related issue(s)
Closes #xxxx
Type of Change
Checklist
Requirements:
Tests:
Documentation:
Test Environment