Skip to content

Commit 17eea53

Browse files
authored
review feedback (#633)
* review feedback - client help is now verbose and has examples - developer tutorial is again tested, more detail added Signed-off-by: vsoch <[email protected]>
1 parent e107eca commit 17eea53

File tree

9 files changed

+437
-75
lines changed

9 files changed

+437
-75
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ 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+
- Improvement to shpc help command output (0.1.2)
1718
- Support for remote registries on self-hosted Gitlab instances (0.1.19)
1819
- Support for uninstall and fixing bug in biocontainers install (0.1.18)
1920
- GitHub action to update a registry from a cache or listing (0.1.17)

docs/getting_started/developer-guide.rst

Lines changed: 118 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -949,34 +949,49 @@ to quickly see it. It should look like this:
949949

950950
.. code-block:: yaml
951951
952+
# This is the default line you can comment out / remove
953+
# registry: [https://github.com/singularityhub/shpc-registry]
954+
# This is your new registry path, you'll need to add this.
952955
# Please preserve the flat list format for the yaml loader
953956
registry: [/tmp/my-registry]
954957
955-
Do a sanity check to make sure your active config is the one you think it is:
958+
After making the abvoe change, exit and do a sanity check to make sure your active config is the one you think it is:
956959

957960
.. code-block:: console
958961
959962
$ shpc config get registry
960963
registry ['/tmp/my-registry']
961964
962-
Next, you can use ``shpc remove`` to remove all registry entries, and we
963-
recommend deleting quay.io first since most entries live there and it will
965+
966+
Deleting Entries
967+
^^^^^^^^^^^^^^^^
968+
969+
If you want to start freshly, you can choose to delete all the existing entries
970+
(and this is optional, you can continue the tutorial without doing this!)
971+
To do this, use the ``shpc remove`` command, which will remove all registry entries,
972+
We recommend deleting quay.io first since most entries live there and it will
964973
speed up the subsequent operation.
965974

966975
.. code-block:: console
967976
968977
$ rm -rf quay.io/biocontainers
969978
$ shpc remove # answer yes to confirmation
970979
971-
Save your changes.
980+
If you do a git status after this, you'll see many entries removed.
981+
Save your changes with a commit.
972982

973983
.. code-block:: console
974984
975985
$ git commit -a -s -m 'emptying template registry'
976986
977987
After this you will have only a skeleton set of files, and most importantly,
978988
the .github directory with automation workflows. Feel free to remove or edit files
979-
such as the ``FUNDING.yml`` and ``ISSUE_TEMPLATE``. Next, fetch to get GitHub pages.
989+
such as the ``FUNDING.yml`` and ``ISSUE_TEMPLATE``.
990+
991+
Fetch GitHub Pages
992+
^^^^^^^^^^^^^^^^^^
993+
994+
Next, use "fetch" to get GitHub pages.
980995

981996
.. code-block:: console
982997
@@ -989,21 +1004,47 @@ At this point you can edit the ``.git/config`` to be your new remote.
9891004
# Update the remote to be your new repository
9901005
vim .git/config
9911006
992-
You should only do this after you've fetched, as you will no longer be connected to the original
993-
remote! Now that you've changed the remote and commit, push your changes and then push to your main branch. We do this
1007+
As an example, here is a diff where I changed the original registry to a new one I created called `vsoch/test-registry`:
1008+
1009+
.. code-block:: git
1010+
1011+
[core]
1012+
repositoryformatversion = 0
1013+
filemode = true
1014+
bare = false
1015+
logallrefupdates = true
1016+
[remote "origin"]
1017+
# url = https://github.com/singularityhub/shpc-registry
1018+
url = [email protected]:vsoch/test-registry
1019+
fetch = +refs/heads/*:refs/remotes/origin/*
1020+
[branch "main"]
1021+
remote = origin
1022+
merge = refs/heads/main
1023+
1024+
Note that in the above, we also change "https://" to be "git" to use a different protocol.
1025+
You should only do this change after you've fetched, as you will no longer be connected to the original
1026+
remote!
1027+
1028+
Push Branches to your New Remote
1029+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
1030+
1031+
Note that we will want to push both main and GitHub pages branches.
1032+
Now that you've changed the remote and commit,
1033+
create the repository in GitHub, and push your changes and then push to your main branch. We do this
9941034
push before gh-pages so "main" becomes the primary branch.
9951035

9961036
.. code-block:: console
9971037
9981038
$ git push origin main
9991039
10001040
Then you can checkout the gh-pages branch to do the same cleanup and push.
1041+
Here is the checkout:
10011042

10021043
.. code-block:: console
10031044
10041045
$ git checkout gh-pages
10051046
1006-
This cleanup is easier - just delete the markdown files in ``_library``.
1047+
And how to do the cleanup. This cleanup is easier - just delete the markdown files in ``_library``.
10071048

10081049
.. code-block:: console
10091050
@@ -1016,31 +1057,91 @@ And then commit and push to gh-pages.
10161057
$ git commit -a -s -m 'emptying template registry gh-pages'
10171058
$ git push origin gh-pages
10181059
1060+
Note that since the main branch will try to checkout gh-pages to generate the docs,
1061+
the first documentation build might fail. Don't worry about this - the branch
1062+
will exist the second time when you add recipes.
10191063

10201064
Manually Adding Registry Entries
10211065
--------------------------------
10221066

1023-
Great! Now you have an empty registry on your filesystem that will serve as a remote.
1024-
Make sure you are back on the main branch:
1067+
Great! Now you have an empty registry on your filesystem that will be pushed to GitHub
1068+
to serve as a remote. Make sure you are back on the main branch:
10251069

10261070
.. code-block:: console
10271071
10281072
$ git checkout main
10291073
1030-
While it's possible to manually add entries (e.g., ``shpc add docker://python``)
1031-
this will miss out on aliases. Instead, navigate to your GitHub repository
1032-
and try running the ``Actions --> Generate New Container --> Run Workflow`` and
1033-
enter your container name (with tag), and a URL and description. This will
1034-
run a workflow to derive aliases and open a pull request to your repository (make
1035-
sure in your repository settings you allow actions to open pull requests).
1074+
Let's now add some containers! There are two ways to go about this:
1075+
1076+
- Manually add a recipe locally, optionally adding discovered executables
1077+
- Use a GitHub action to do the same.
1078+
1079+
We will start with the manual approach. Here is how to add a container.yaml recipe file,
1080+
without any customization for executable discovery:
1081+
1082+
.. code-block:: console
1083+
1084+
$ shpc add docker://vanessa/salad:latest
1085+
Registry entry vanessa/salad was added! Before shpc install, edit:
1086+
/tmp/my-registry/vanessa/salad/container.yaml
1087+
1088+
You could then edit that file to your liking. If you want to pull the container
1089+
to discover executables, you'll need to install guts:
10361090

1091+
.. code-block:: console
1092+
1093+
pip install git+https://github.com/singularityhub/guts@main
1094+
1095+
1096+
And then use the provided script to generate the container.yaml (with executables discovered):
1097+
1098+
.. code-block:: console
1099+
1100+
$ python .github/scripts/add_container.py --maintainer "@vsoch" --description "The Vanessa Salad container" --url "https://github.com/vsoch/salad" docker://vanessa/salad:latest
1101+
1102+
That will generate a container.yaml with executables discovered:
1103+
1104+
.. code-block:: yaml
1105+
1106+
url: https://github.com/vsoch/salad
1107+
maintainer: '@vsoch'
1108+
description: The Vanessa Salad container
1109+
latest:
1110+
latest: sha256:e8302da47e3200915c1d3a9406d9446f04da7244e4995b7135afd2b79d4f63db
1111+
tags:
1112+
latest: sha256:e8302da47e3200915c1d3a9406d9446f04da7244e4995b7135afd2b79d4f63db
1113+
docker: vanessa/salad
1114+
aliases:
1115+
salad: /code/salad
1116+
1117+
1118+
You can then push this to GitHub. If you are curious about how the docs are generated, you can
1119+
try it locally:
1120+
1121+
.. code-block:: console
1122+
1123+
$ git checkout gh-pages
1124+
$ ./generate.sh /tmp/my-registry
1125+
Registry is /tmp/my-registryGenerating docs for vsoch/salad, _library/vsoch-salad.md
1126+
1127+
1128+
There is also an associated workflow to run the same on your behalf. Note that you'll need
1129+
to:
1130+
1131+
1. Go to the ``repository --> Settings --> Actions --> Workflow Permissions`` and enable read and write.
1132+
2. Directly under that, check the box to allow actions to open pull requests for this to work.
1133+
1134+
If you get a message about push being denied to the bot, you forgot to do one of these steps!
1135+
The workflow is under ``Actions --> shpc new recipe manual --> Run Workflow``.
10371136
Remember that any container, once it goes into the registry, will have tags
10381137
and digests automatically updated via the "Update Containers" action workflow.
10391138

10401139
Creating a Cache
10411140
----------------
10421141

1043-
Instead of manually adding entries, let's create an automated way to populate
1142+
This is an advanced part of the developer tutorial! Let's say that you don't
1143+
want to go through the above to manually run commands. Instead of manually adding entries
1144+
in this manner, let's create an automated way to populate
10441145
entries from a cache. You can read more about the algorithm we use to derive aliases
10451146
in the `shpc-registry-cache <https://github.com/singularityhub/shpc-registry-cache>`_
10461147
repository, along with cache generation details. You will primarily need two things:
@@ -1103,7 +1204,6 @@ we've created. Keep in mind that caches are useful beyond Singularity Registry H
11031204
knowing the paths and executables within a container is useful for other applied and
11041205
research projects too!
11051206

1106-
11071207
Updating a Registry from a Cache
11081208
--------------------------------
11091209

docs/getting_started/user-guide.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1350,26 +1350,26 @@ module recipe in the registry:
13501350
1.11--h6270b1f_0:sha256:141120f19f849b79e05ae2fac981383988445c373b8b5db7f3dd221179af382b
13511351
13521352
1353-
or to ask for a dryrun, meaning we check for updates but don't perform them.
1353+
or to ask for a dry run, meaning we check for updates but don't perform them.
13541354

13551355
.. code-block:: console
13561356
1357-
$ shpc update quay.io/biocontainers/samtools --dryrun
1357+
$ shpc update quay.io/biocontainers/samtools --dry-run
13581358
13591359
13601360
If you want to look for a specific string or pattern in the tags, just add ``--filter``
13611361

13621362
.. code-block:: console
13631363
1364-
$ shpc update redis --dryrun --filter alpine
1364+
$ shpc update redis --dry-run --filter alpine
13651365
13661366
Since no tags are deleted, this will add the latest set found with the term "alpine." You can also use this
13671367
strategy to add a specific tag:
13681368

13691369

13701370
.. code-block:: console
13711371
1372-
$ shpc update redis --dryrun --filter 6.0-rc-alpine
1372+
$ shpc update redis --dry-run --filter 6.0-rc-alpine
13731373
13741374
The current implementation just supports updating from a Docker / oras registry (others can come after if requested).
13751375
As of version 0.0.58, there is support to ask to update all recipes - just leave out the name!
@@ -1383,7 +1383,7 @@ If you are using an earlier release than 0.0.58 you can accomplish the same as f
13831383
.. code-block:: console
13841384
13851385
$ for name in $(shpc show); do
1386-
shpc update ${name} --dryun
1386+
shpc update ${name} --dry-run
13871387
done
13881388
13891389

0 commit comments

Comments
 (0)