Updating vessel package when version points to a git branch

I currently have a vessel package defined in my package-set.dhall like this:

let packages = [
  ...
  { name = "candb"
  , repo = "https://github.com/canscale/candb"
  , version = "alpha"
  , dependencies = [ "base" ]
  },
]

It points to the alpha git branch. However, when that branch gets updated remotely, and I run vessel install again, it doesn’t fetch the new version of the branch from github. Instead, I have to cd into .vessel/candb/alpha and run git pull to get the latest package code.

Is this expected behavior with vessel or more like a bug? @icme FYI

2 Likes

Thanks for pointing this out.

This is unfortunately one of the drawbacks of using branches instead of tagged commits or a commit hash with vessel. It just checks to see if you already have the specific vessel tag/branch/commit hash <version_name> in the .vessel/<dependency>/<version_name> directory.

If you’re tracking a branch name (like I’ve been doing with “alpha” in this example), then you open yourself up to this issue since the alpha branch, and therefore the package’s “version” is constantly changing. I therefore feel like the current behavior of vessel install or a dfx build x using "packtool": "vessel sources" not re-fetching updates for the version provided in the package-set.dhall could be the proper behavior, since a version really shouldn’t change.

A general temporary solution is to just delete the .vessel folder, or in this case just delete the .vessel/candb/alpha folder and then re-run vessel install or dfx build <canister_name>.

A potential feature add to vessel that might solve this would be to add something like a -f flag, which would force re-fetch all of dependencies of a project listed in the package-set.dhall, and overwrite any dependencies that already exist. This would be very much similar to npm install <dependency> --force, as shown in the docs for npm install.

An alternative solution to this would be to include a branch property that could be used in place of the version in the package-set.dhall if one wanted to specifically track a branch, which would signify that this package should be re-fetched on every vessel install.

I’m curious what the vessel author and current maintainers have to say about this, and if branches as versions are an acceptable/supported use case going forward - @kritzcreek @ggreif @PaulLiu

2 Likes

I like the idea of a -f flag. Or even something like a vessel update command. The versioning supported right now is very primitive.

For anyone who finds this conversation in the future, I recently opened a PR implementing vessel install -f. Cheers!

3 Likes