threefoldtech / 0-hub

Threefold Images Hub
https://hub.grid.tf
Apache License 2.0
1 stars 1 forks source link

tags: support group by tagging flists #70

Closed maxux closed 11 months ago

maxux commented 11 months ago

Support groups of flist by tags. A user can create tags, tags will contains list of flists (like a repositories) except that tags only contains symlinks. Theses symlinks can points to user flists or foreign user flists.

A new tag is created by adding an flist to a non existing tags, the same call can be applied to add more flists to that tag. Same call using HTTP DELETE method can remove an flist from that tag.

Add an flist to a tag, will create tag if doesn't exists yet (will add tf-autobuilder/0-fs-0.2.2.flist to tag v1.0.0/0-fs.flist):

$ curl -H "Authorization: bearer ..." https://hub/api/flist/me/v1.0.0/0-fs/tag/tf-autobuilder/0-fs-0.2.2
{"status": "success"}

Remove an flist from a tag (like adding):

$ curl -X DELETE -H "Authorization: bearer ..." https://hub/api/flist/me/v1.0.0/0-fs/tag/tf-autobuilder/0-fs-0.2.2
{"status": "success"}

Cross symlink to a tag (example, maxux/production will points to tf-zos/tags/v5.2.1:

$ curl -H "Authorization: bearer ..." https://hub/api/flist/me/production/crosstag/tf-zos/v5.2.1
{"status": "success"}

In case of a symlink to a tag in a repository, because it's not an flist but a tag, it's not possible to call classic API endpoint to get flist information. There is a new call to know where points a tag symlink:

$ curl https://hub/api/flist/maxux/production/taglink
{"target": "tf-zos/tags/v5.2.1"}

But regular deletion of flist even if it's a symlink to a tag, works:

$ curl -X DELETE -H "Authorization: bearer ..." https://hub/api/flist/me/production
{"status": "success"}

Roadmap:

This implement #69