mani icon indicating copy to clipboard operation
mani copied to clipboard

Support URL in import

Open BryanHuntNV opened this issue 11 months ago • 5 comments

Describe the solution you'd like

I'd like the ability to specify an import as a URL.

Additional context

I work on several projects where each project is several repositories. I have started defining a mani config file for each project and I'm including them in my main mani config file. This requires the repository containing the project mani config to be cloned. If I could instead import the project mani config as a URL, I could clone an entire project from a mani sync.

BryanHuntNV avatar Jan 16 '25 11:01 BryanHuntNV

I don't understand, can you provide example configs of how you want it to work.

alajmo avatar Jan 16 '25 12:01 alajmo

import:
  - https://gitlab.example.com/path/to/repository/-/raw/main/mani.yaml?ref_type=heads

BryanHuntNV avatar Jan 16 '25 14:01 BryanHuntNV

can't you just write it like this:

mani.yaml

import:
  - foo/projects.yaml

projects:
  mani:
    url: [email protected]:alajmo/mani.git

foo/projects.yaml

projects:
  sake:
    url: [email protected]:alajmo/sake.git
  pinto:
    url: [email protected]:alajmo/pinto.git

The imports is for importing files, not urls (. Running mani sync for the above structure will produce this directory structure:

.
├── foo
│   ├── pinto
│   ├── projects.yaml
│   └── sake
├── mani
└── mani.yaml

alajmo avatar Jan 16 '25 15:01 alajmo

No, that's not the point of the request. Consider the case where you do not have any projects cloned in your directory and you want to run mani sync to populate your directory. The included foo/project.yaml file is on your GitLab / GitHub server and thus only available via http.

BryanHuntNV avatar Jan 16 '25 15:01 BryanHuntNV

I understand, you want to fetch remote mani files, this is a bit more work to accomplish, and not sure how many users are using this setup of having remote projects with a mani.yaml file per project.

In the meantime, one solution is to have a separate command for syncing remote projects, which invokes mani sync after downloading the file (note, you have to have a empty file other/mani.yaml, otherwise it will complain about not finding the file):

import:
  - other/mani.yaml

projects:
  root:
    path: .

tasks:
  sync: |
    wget -P other/mani.yaml https://gitlab.example.com/path/to/repository/-/raw/main/mani.yaml?ref_type=heads
    mani sync

then run mani run sync --cwd.

alajmo avatar Jan 29 '25 15:01 alajmo