Skip to content

Conversation

hcannoodt
Copy link
Collaborator

@hcannoodt hcannoodt commented Mar 24, 2025

Describe your changes

Related issue(s)

Closes #xxxx

Type of Change

  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • New functionality (non-breaking change which adds functionality)
  • Major change (non-breaking change which modifies existing functionality)
  • Minor change (non-breaking change which does not modify existing functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • This change requires a documentation update

Checklist

Requirements:

  • I have read the CONTRIBUTING doc.
  • I have performed a self-review of my code by checking the "Changed Files" tab.
  • My code follows the code style of this project.

Tests:

  • I have added tests that prove my fix is effective or that my feature works.
  • New and existing unit tests pass locally with my changes.

Documentation:

  • Proposed changes are described in the CHANGELOG.md.
  • I have updated the documentation accordingly.

Test Environment

@hcannoodt hcannoodt requested a review from rcannood March 28, 2025 13:50
@rcannood
Copy link
Member

rcannood commented Mar 31, 2025

This looks fantastic! Let me build it and try it out before I review, just in case.

Copy link
Member

@rcannood rcannood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmm...


When I try to run it, I get:

viash run vsh://toolbox/v0.1.0/yq -- --input codecov.yaml --output output.yaml
Fetching 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.com api.viash-hub.com instead of api-dev.viash-hub.dev?
  • Can we add a command, something like viash get ...? Or something like viash install ..., such that we can install a symlink the executable to .local/bin or 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?

@hcannoodt
Copy link
Collaborator Author

Woopsie! Fetching packages when the cache folder doesn't exist yet should be fixed now.

@hcannoodt
Copy link
Collaborator Author

1 line in the documention for viash run was added and an example
Fixed some documentation inconsistencies too while I was touching it.

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
@hcannoodt hcannoodt force-pushed the feature/package_bundle branch from bd74c13 to 19fab4f Compare April 24, 2025 09:22
@rcannood rcannood changed the title Feature/package bundle Run components from Viash Hub Apr 24, 2025
@rcannood
Copy link
Member

I think the ANC is still set to AutoNetConfig.fetch("api-dev.viash-hub.dev").

Is it okay to delay this PR until it's changed to AutoNetConfig.fetch("api.viash-hub.dev")? And maybe allow an environment variable to change the setting? ^^

@rcannood rcannood requested a review from Copilot October 1, 2025 07:47
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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")
Copy link
Preview

Copilot AI Oct 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard-coded development URL should be configurable or use production endpoint. Consider using a configuration parameter or environment variable to specify the ANC endpoint.

Suggested change
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)

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@hcannoodt hcannoodt requested a review from rcannood October 1, 2025 12:06
Copy link
Member

@rcannood rcannood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@hcannoodt hcannoodt merged commit e91a154 into develop Oct 1, 2025
20 of 31 checks passed
@rcannood rcannood deleted the feature/package_bundle branch October 1, 2025 14:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants