Sysand git repositories as usage sources

Hi,

I am experimenting with using git repositories as project usage locations, noting the docs implying the possibility here: Project metadata - Sysand User Guide

This is a useful feature, as it means I can develop privately, using existing infrastructure (git server), without needing to stand up another tool (private sysand index). Thanks for including it.

It isn’t immediately clear from the docs how the git repository should store and present the sysand package to the world. Are any of the following acceptable?

A naive experiment:

sysand add https://github.com/hugoormo/FiBo2SysMLv2.git

returns

error: Failed to satisfy usage constraints:
requested project(s) alternative nr 0 depends on https://github.com/hugoormo/FiBo2SysMLv2

Despite the error, the usage is still added to `.project.json`:

{
  "name": "test",
  "version": "0.0.1",
  "usage": [
    {
      "resource": "https://github.com/hugoormo/FiBo2SysMLv2.git"
    }
  ]
}

This seems to mean that if i try to add another usage, the error caused by the first malformed import will be reported - i get no feedback about the success or not of my second import:

sysand add https://github.com/sensmetry/detect.git

reports an error about the first import again:


error: Failed to satisfy usage constraints:
requested project(s) alternative nr 0 depends on https://github.com/hugoormo/FiBo2SysMLv2

Clearing the usages array in `.project.json` and adding the Detect git repo reports the following, even though `.meta.json`/ `.project.json` are in the root dir of the repo:

error: no supported sources for project with IRI `https://github.com/sensmetry/detect.git`

Are you able to provide any guidance on best practice here?

Thanks!

Further testing:

sysand add git+ssh://git@local-ip:local-port/local-org/my_repo.git results in the following error:

error: incomplete projectEditableProject { inner: LocalSrcProject { project_path: “.” }, nominal_path: “.”, include_original_sources: false }.

my_repo.git contains a .project.json and .meta.json in the root per Project metadata - Sysand User Guide . Note that the docs do not explicitly state what sysand expects to find at the git url. Presumably the project and meta jsons, or if it is a workspace, a workspace json?

In most cases where a non-index usage is specified, Sysand expects to get either a .kpar file (if the destination is a file) or find .project.json + .meta.json files directly inside the directory (if the destination is a directory). It does not have special support for GitHub releases and does not look inside any subdirectories.

Git usages are not currently supported.

1 Like

Hi Sean,

We are working on adding Git support as a source.

Meanwhile, you can use GitHub/GitLab releases to get a persistent URL to your packaged kpar file. I’ve created a sample project and repo that publishes to GitHub releases here: Smart Home Hub Example

If you follow the setup there, you will be able to add your projects with:

  • Persistent URL to the latest version:
sysand add https://github.com/sensmetry/smart-home-hub-example/releases/latest/download/smart_home_hub_example.kpar
  • Persistent URL to a pinned version:
sysand add https://github.com/sensmetry/smart-home-hub-example/releases/download/v0.1.0/smart_home_hub_example-0.1.0.kpar

Hi Sean,

We have examples of how to use GitHub and GitLab as private indices, as an alternative to pointing Sysand to a specific git repo or a specific .kpar file as that can make updating packages a bit cumbersome.

There is currently an open PR on GitHub that will document these examples on docs.sysand.org, but you can also review and fork the example GitHub and GitLab repositories without waiting for the PR to land:

Edit: The documentation is available here: Self-hosting a project index - Sysand User Guide

GitHub/GitLab repositories for reviewing and forking are available here:

@Simas this was very useful, thanks. It works for me from your repo, tested here: Usages from local filesystem indexes - #4 by sean . As in that link it did not work from my personal repo. I have not yet figured out why (error in the kpar build or error in the usage URL resolution).

This will be my solution going forward. Looking forward to native git support as a source.

@Simonas Thanks

Yes, the workflow is slightly different for private repositories, since you need to authenticate there. There are examples on how to set this up for different platforms here.

Specifically for GitHub, have a look at Self-hosting a project index - Sysand User Guide

Best,
Simas