@@ -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
964973speed 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,
978988the .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
9941034push 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
10201064Manually 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 ``.
10371136Remember that any container, once it goes into the registry, will have tags
10381137and digests automatically updated via the "Update Containers" action workflow.
10391138
10401139Creating 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
10441145entries from a cache. You can read more about the algorithm we use to derive aliases
10451146in the `shpc-registry-cache <https://github.com/singularityhub/shpc-registry-cache >`_
10461147repository, 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
11031204knowing the paths and executables within a container is useful for other applied and
11041205research projects too!
11051206
1106-
11071207Updating a Registry from a Cache
11081208--------------------------------
11091209
0 commit comments