Skip to content

Commit ce1452d

Browse files
authored
Add/remote registry (#576)
* adding support for upgrade * simplify dryrun logic * adding upgrade test for remote registry * rename to sync registry and base GitHub provider off Filesystem * preparing for refactor to add default remote registry * black and various tweaks to logic * add support for docgen to a specific branch * testing support for gitlab * add github/gitlab name check to classes * adding support to sync from file * adding support for registries sync file * Use shutil.copy2 to preserve file metadata * ensure we do not add non-container-module directories * adding separate properties for each of the source url and web url * add more user/developer docs for using registry this still needs tests written - I think I will need to make an external remote registry with some arbitrary change to test, OR just test the interaction with the remote provider and handle the updates via local test files. Signed-off-by: vsoch <[email protected]>
1 parent 444f47e commit ce1452d

File tree

374 files changed

+1747
-8568
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

374 files changed

+1747
-8568
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ and **Merged pull requests**. Critical items to know are:
1414
The versions coincide with releases on pip. Only major versions will be released as tags on Github.
1515

1616
## [0.0.x](https://github.com/singularityhub/singularity-hpc/tree/main) (0.0.x)
17+
- Add support for remote registry and sync commands --all (0.1.0)
18+
- support for GitLab and GitHub remotes
1719
- fixing bug to config set/get nested fields, default for wrapper scripts true (0.0.57)
1820
- change in behavior, instead of `key:value` for set/add `key value` now also works.
1921
- adding support for container.yaml overrides (0.0.56)

docs/getting_started/developer-guide.rst

Lines changed: 84 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,40 @@ registry entries and building containers. If you haven't read :ref:`getting_star
99
you should do that first.
1010

1111

12-
Creating a Registry
13-
===================
12+
Developer Commands
13+
==================
14+
15+
Singularity Registry HPC has a few "developer specific" commands that likely will only be
16+
used in automation, but are provided here for the interested reader.
17+
18+
Docgen
19+
------
20+
21+
To generate documentation for a registry (e.g., see `this registry example <https://singularityhub.github.io/shpc-registry>`_ we can use docgen. Docgen, by way of needing to interact with the local filesystem,
22+
currently only supports generation for a filesystem registry. E.g., here is how to generate a registry module
23+
(from a local container.yaml) that ultimately will be found in GitHub pages:
24+
25+
.. code-block:: console
26+
27+
$ shpc docgen --registry . --registry-url https://github.com/singularityhub/shpc-registry python
28+
29+
And you could easily pipe this to a file. Here is how we generate this programatically in a loop:
30+
1431

15-
A registry consists of a database of local containers files, which are added
32+
.. code-block:: console
33+
34+
for module in $(shpc show --registry ../shpc-registry); do
35+
flatname=${module#/}
36+
name=$(echo ${flatname//\//-})
37+
echo "Generating docs for $module, _library/$name.md"
38+
shpc docgen --registry ../shpc-registry --registry-url https://github.com/singularityhub/shpc-registry $module > "_library/${name}.md"
39+
done
40+
41+
42+
Creating a FileSystem Registry
43+
==============================
44+
45+
A fileystem registry consists of a database of local containers files, which are added
1646
to the module system as executables for your user base. This typically means that you are a
1747
linux administrator of your cluster, and shpc should be installed for you to use
1848
(but your users will not be interacting with it).
@@ -88,9 +118,59 @@ It's reasonable that you can store your recipes alongside these files, in the ``
88118
folder. If you see a conflict and want to request allowing for a custom install path
89119
for recipes, please open an issue.
90120

121+
Creating a Remote Registry
122+
==========================
91123

92-
.. _getting_started-writing-registry-entries:
124+
If you want to create your own remote registry (currently supported to be on GitHub or GitLab)
125+
the easiest thing to do is start with one of our shpc provided registries as a template:
126+
127+
- `**GitHub** <https://github.com/singularityhub/shpc-registry>`_
128+
- `**GitLab** <https://gitlab.com/singularityhub/shpc-registry>`_
129+
130+
This means (for either) you'll want to clone the original repository:
131+
132+
.. code-block:: console
133+
134+
$ git clone https://github.com/singularityhub/shpc-registry my-registry
135+
$ cd my-registry
136+
137+
Ensure you do a fetch to get the github pages branch, which deploys the web interface!
138+
139+
.. code-block:: console
140+
141+
$ git fetch
142+
143+
At this point, you can create an empty repository to push to. If you don't mind
144+
it being a fork, you can also just fork the original repository (and then pull
145+
from it instead). GitLab has a feature to fork and then remove the fork, so that
146+
is an option too. Ensure that you push the gh-pages branch too (for GitHub only):
147+
148+
.. code-block:: console
93149
150+
$ git checkout gh-pages
151+
$ git push origin gh-pages
152+
153+
Once you have your cloned registry repository, it's up to you for how you want
154+
to delete / edit / add containers! You'll likely use ``shpc add`` to generate new
155+
configs, and you might want to delete most of the default containers provided.
156+
Importantly, you should take note of the workflows in the repository. Generally:
157+
158+
- We have an update workflow (GitHub) that will check for new versions of containers. This still need to be ported to GitLab.
159+
- The docs workflow (on GitHub, this is in the .github-ci.yaml) will deploy docs to GitHub/GitLab pages.
160+
161+
For each of GitLab and GitHub, ensure after you deploy that your pages are enabled.
162+
It helps to ensure the website (static) URL is in the description to be easily find-able.
163+
Once it's deployed, ensure you see your containers, and clicking the ``</>`` (code)
164+
icon shows the library.json that shpc will use. Finally, akin to adding a filesystem registry,
165+
you can just do the same, but specify your remote URL:
166+
167+
.. code-block:: console
168+
169+
$ shpc config add registry https://github.com/singularityhub/shpc-registry
170+
171+
And that's it!
172+
173+
.. _getting_started-writing-registry-entries:
94174

95175
Writing Registry Entries
96176
========================

docs/getting_started/installation.rst

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,18 +69,16 @@ Once it's installed, you should be able to inspect the client!
6969
7070
7171
You'll next want to configure and create your registry, discussed next in :ref:`getting-started`.
72-
Generally, remember that your modules will be installed in
73-
the ``modules`` folder, and container recipes are nested in ``registry``. If you don't
74-
want your container images (sif files) installed alongside your module recipes,
72+
73+
Generally, remember that your modules will be installed in the ``modules`` folder, and container
74+
recipes will come from the remote registry `shpc-registry <https://github.com/singularityhub/shpc-registry>`_ by default. If you don't want your container images (sif files) installed alongside your module recipes,
7575
then you can define ``container_base`` to be somewhere else. You
7676
can change these easily with ``shpc config``, as they are defined via these
7777
variables in the config:
7878

7979

8080
.. code-block:: console
8181
82-
83-
$ shpc config add registry /<DIR>
8482
$ shpc config set module_base /<DIR>
8583
$ shpc config set container_base /<DIR>
8684

0 commit comments

Comments
 (0)