@@ -949,34 +949,49 @@ to quickly see it. It should look like this:
949
949
950
950
.. code-block :: yaml
951
951
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.
952
955
# Please preserve the flat list format for the yaml loader
953
956
registry : [/tmp/my-registry]
954
957
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:
956
959
957
960
.. code-block :: console
958
961
959
962
$ shpc config get registry
960
963
registry ['/tmp/my-registry']
961
964
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
964
973
speed up the subsequent operation.
965
974
966
975
.. code-block :: console
967
976
968
977
$ rm -rf quay.io/biocontainers
969
978
$ shpc remove # answer yes to confirmation
970
979
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.
972
982
973
983
.. code-block :: console
974
984
975
985
$ git commit -a -s -m 'emptying template registry'
976
986
977
987
After this you will have only a skeleton set of files, and most importantly,
978
988
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.
980
995
981
996
.. code-block :: console
982
997
@@ -989,21 +1004,47 @@ At this point you can edit the ``.git/config`` to be your new remote.
989
1004
# Update the remote to be your new repository
990
1005
vim .git/config
991
1006
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
994
1034
push before gh-pages so "main" becomes the primary branch.
995
1035
996
1036
.. code-block :: console
997
1037
998
1038
$ git push origin main
999
1039
1000
1040
Then you can checkout the gh-pages branch to do the same cleanup and push.
1041
+ Here is the checkout:
1001
1042
1002
1043
.. code-block :: console
1003
1044
1004
1045
$ git checkout gh-pages
1005
1046
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 ``.
1007
1048
1008
1049
.. code-block :: console
1009
1050
@@ -1016,31 +1057,91 @@ And then commit and push to gh-pages.
1016
1057
$ git commit -a -s -m 'emptying template registry gh-pages'
1017
1058
$ git push origin gh-pages
1018
1059
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.
1019
1063
1020
1064
Manually Adding Registry Entries
1021
1065
--------------------------------
1022
1066
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:
1025
1069
1026
1070
.. code-block :: console
1027
1071
1028
1072
$ git checkout main
1029
1073
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:
1036
1090
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 ``.
1037
1136
Remember that any container, once it goes into the registry, will have tags
1038
1137
and digests automatically updated via the "Update Containers" action workflow.
1039
1138
1040
1139
Creating a Cache
1041
1140
----------------
1042
1141
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
1044
1145
entries from a cache. You can read more about the algorithm we use to derive aliases
1045
1146
in the `shpc-registry-cache <https://github.com/singularityhub/shpc-registry-cache >`_
1046
1147
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
1103
1204
knowing the paths and executables within a container is useful for other applied and
1104
1205
research projects too!
1105
1206
1106
-
1107
1207
Updating a Registry from a Cache
1108
1208
--------------------------------
1109
1209
0 commit comments