|
| 1 | +# Creating in an OCA Bundle Pull Request |
| 2 | + |
| 3 | +## Introduction |
| 4 | + |
| 5 | +This document explains how to turn your completed Overlays Capture Architecture (OCA) Bundle materials (Excel file, images, identifiers, etc.) into a Pull Request (PR) for the Aries OCA Bundles repository. |
| 6 | + |
| 7 | +### Who Should Use This Guide? |
| 8 | + |
| 9 | +- Non-Developers: You only need to gather the required files (Excel, branding, images, etc.) and create a GitHub Issue requesting an OCA Bundle be created. The repository maintainers will handle the technical steps. |
| 10 | +- The maintainers of the [Aries OCA Bundles] repository, and other developers comfortable with Git, Rust, jq, and bash can follow the instructions below to create their own PR. |
| 11 | + |
| 12 | +Given that intended audience, the instructions in this document are relatively terse, assuming readers won't need each step detailed. |
| 13 | + |
| 14 | +Below is an overview of the process: |
| 15 | + |
| 16 | +- Gather Input Data |
| 17 | +- Create or Update Folder Structure |
| 18 | +- Set Up the README.md |
| 19 | +- Add Watermarks (Optional) |
| 20 | +- Generate the OCA JSON |
| 21 | +- Open the Pull Request |
| 22 | + |
| 23 | +For questions or assistance, raise an [issue on GitHub](https://github.com/bcgov/aries-oca-bundles/issues) and we'll try to help. |
| 24 | + |
| 25 | +## Getting Started |
| 26 | + |
| 27 | +Do the steps you normally do when preparing to create a PR into a GitHub repo. Note that the [Aries OCA Bundles] repository has a DevContainer configuration that you may want to use. |
| 28 | + |
| 29 | +[Aries OCA Bundles]: https://github.com/bcgov/aries-oca-bundles |
| 30 | + |
| 31 | +The steps might include: |
| 32 | + |
| 33 | +- Forking the [Aries OCA Bundles] repository. |
| 34 | +- Create a local clone. |
| 35 | +- Create a dev branch on the local clone to prepare the PR. |
| 36 | + |
| 37 | +## Input Data |
| 38 | + |
| 39 | +To start the process, we'll assume you have all the data collected using the [OCA Bundle Creation] process. Notably: |
| 40 | + |
| 41 | +[OCA Bundle Creation]: ./OCABundleCreation.md |
| 42 | + |
| 43 | +- The OCA Excel file completed for the Issuer and credential in question. |
| 44 | +- The completed `branding.json` file, with an associated images. |
| 45 | +- A list of people (names, emails) that are authorized to update the OCA Bundle. |
| 46 | +- A list of the identifiers (usually `credDefId`s, but possibly `schemaId`s), their location (e.g. `CANdy Dev`, etc.). |
| 47 | +- As needed for each identifier, the watermark text (ideally, in the multiple languages defined in the Excel file) to display when viewing credentials associated with those identifiers. |
| 48 | +- The location (path to folder) of the OCA Bundle. |
| 49 | + |
| 50 | +If you want, you **MAY** include a file `testdata.csv` that is a comma separated values file containing credential test data that may be used by tools like OCA Explorer. It's a big help to have such a file. The file: |
| 51 | + |
| 52 | +- Must have a list of the credential attributes on the first line of the file. |
| 53 | +- Have at least one line of sample data. |
| 54 | + |
| 55 | +## Create The Folder For Your OCA Bundle |
| 56 | + |
| 57 | +Once you have forked the [Aries OCA Bundles] repository, create |
| 58 | +the folder for your new OCA Bundle within the `OCABundles` folder. Your |
| 59 | +folder can be placed arbitrarily deep, with some rules for the first |
| 60 | +few levels. |
| 61 | + |
| 62 | +`schema` is the (current) name for where credential OCA Bundles are to be |
| 63 | +placed. That name may soon change (`credential` is a better name...), and in the |
| 64 | +future, a parallel folder might be added for presentation request OCA Bundles. |
| 65 | + |
| 66 | +Below `schema` is a list of top level credential issuers (e.g., BC Gov), and |
| 67 | +within each, the sub-issuers (to any depth). As you add your OCA Bundle, feel |
| 68 | +free to add as many layers of (sub-)issuers as appropriate. For example, you might include: |
| 69 | + |
| 70 | +- the issuing sub-organization, |
| 71 | +- the type of credential, |
| 72 | +- different versions (e.g., 1.0, 1.1, 2.0, etc.) of the type of credential, |
| 73 | +- development, staging, and production versions of the credential. |
| 74 | + |
| 75 | +We'll soon be eliminating the need for different dev, staging and production versions of an OCA Bundle -- unless you really want them to be different. |
| 76 | + |
| 77 | +For each layer, you **MUST** add a `README.md` file in which the top level |
| 78 | +markdown header (first line, `# `) **MUST** be the name of the (sub-)issuer. The `README.md` file |
| 79 | +may optionally contain additional information about the (sub-)issuer. The |
| 80 | +requirement for the `README.md` and the markdown header is that when generating |
| 81 | +the GitHub Pages registry site, the required markdown header is extracted used |
| 82 | +for the site navigation. |
| 83 | + |
| 84 | +This hierarchy can be seen in the "OCA Bundles" tab of this registry. |
| 85 | + |
| 86 | +At the appropriate level, create the folder for the OCA Bundle. At this time, |
| 87 | +there **MUST** be a folder for each different `watermark` setting. As such, you |
| 88 | +**MAY** have to create multiple OCA Folders, each with (initially) the same |
| 89 | +data. We expect to fix this very soon! |
| 90 | + |
| 91 | +Once you have created the OCA Bundle folders, populate each with the following data: |
| 92 | + |
| 93 | +- The Excel file. There **MUST** be exactly one Excel file per Bundle, and it **SHOULD** be named `OCA.xlsx`. |
| 94 | +- The `branding.json` file. |
| 95 | +- The images, if any associated with the `branding.json` file. |
| 96 | +- The sample credential data file, if any. |
| 97 | + |
| 98 | +## Create the README.md File for the OCA Bundle |
| 99 | + |
| 100 | +A README.md file for **each** OCA Bundle folder **MUST** be present and **MUST** include |
| 101 | +the information shown and described below. The hard and fast formatting |
| 102 | +requirements are in place because the file is processed by a script that |
| 103 | +generates two lists of all of the identifiers (`schemaId`s and `credDefId`s) and |
| 104 | +the OCA Bundles to which they are associated with. The lists are in the files |
| 105 | +[ocabundles.json] and [ocabundleslist.json] in the root of the (GitHub Pages) |
| 106 | +registry website and (for now) the root folder of the [Aries OCA Bundles] GitHub |
| 107 | +repository. These are the files loaded by wallets and the OCA Explorer tool so |
| 108 | +that they know what OCA Bundles are available. |
| 109 | + |
| 110 | +[ocabundles.json]: /ocabundles.json |
| 111 | +[ocabundleslist.json]: /ocabundleslist.json |
| 112 | + |
| 113 | +```text |
| 114 | +# <TITLE> |
| 115 | +
|
| 116 | +<DESCRIPTION> |
| 117 | +
|
| 118 | +- Publishing Organization: <ORGANIZATION> |
| 119 | +- Primary Contact Email Address: <CONTACT EMAIL ADDRESS> |
| 120 | +
|
| 121 | +## Identifiers |
| 122 | +
|
| 123 | +| Identifier | Location | URL | |
| 124 | +| ------------------------------------------ | --------- | ----------- | |
| 125 | +| <SCHEMA ID or CRED DEF ID> | <LEDGER> | <URL> | |
| 126 | +
|
| 127 | +## Authorization |
| 128 | +
|
| 129 | +The following are the GitHub IDs of those authorized to make substantive updates to the OCA Bundle. |
| 130 | +
|
| 131 | +| OCA Bundle Contributors | GitHub ID | Email Address | |
| 132 | +| ----------------------- | ----------- | ------------------------ | |
| 133 | +| <NAME> | <GITHUB ID> | <EMAIL ADDRESS> | |
| 134 | +
|
| 135 | +``` |
| 136 | + |
| 137 | +Everything not in `<>`s must be exactly as specified above (with one |
| 138 | +exception--see below). Everything in `<>`s **MUST** be populated as described |
| 139 | +below. |
| 140 | + |
| 141 | +The two markdown tables **MAY** have multiple lines. Multiple lines in the |
| 142 | +`Identifiers` table indicates that the same OCA Bundle is used for each of the |
| 143 | +objects identified in the first column. Multiple lines in the `Authorization` |
| 144 | +table is recommended so that multiple members of the submitters team may update |
| 145 | +the OCA Bundle. |
| 146 | + |
| 147 | +- `<TITLE>` **MUST** be the name of the credential type. No other line in the |
| 148 | + file can have a single `#` prefix. |
| 149 | +- `<DESCRIPTION>` is extracted for display by tools for processing this |
| 150 | +repository (such as the [OCA Explorer]) and should describe the type of |
| 151 | +credential to which the OCA Bundle applies. |
| 152 | +- `<ORGANIZATION>` is extracted for display by tools for processing this |
| 153 | +repository (such as the [OCA Explorer]) and is the name of the organization |
| 154 | +that submitted the OCA Bundle. |
| 155 | +- `<CONTACT EMAIL ADDRESS>` is an email address for the primary contact |
| 156 | +for the OCA Bundle. The address may for a person, or better, a group |
| 157 | +contact withing the `<ORGANIZATION>`. |
| 158 | +- `<SCHEMA ID or CRED DEF ID>` are identifiers for objects to which the |
| 159 | +OCA Bundles applies. There can be multiple lines in the table, each with |
| 160 | +a different identifier. Each **MUST** use exactly the same OCA Bundle, including |
| 161 | +the watermark (present or not), |
| 162 | +- `<LEDGER>` is optional. It identifies the ledger on which the object |
| 163 | +identified by the object resides. It should be in the form |
| 164 | +`<network>[:<instance>]` as defined in the [did-indy specification for |
| 165 | +`namespace`](https://hyperledger.github.io/indy-did-method/#indy-did-method-identifiers) |
| 166 | +-- e.g., `candy:dev` or `sovrin`. The value is useful when the `<SCHEMA ID or |
| 167 | +CRED DEF ID>` is unqualified (such as with legacy Indy identifiers) such that |
| 168 | +the precise location of the object is not known. |
| 169 | +- `<URL>` is optional and is a plain (non-Markdown) link to a ledger browser |
| 170 | + instance of the object, such as to a transaction on |
| 171 | + [https://indyscan.io](https://indyscan.io), |
| 172 | + [http://test.bcovrin.vonx.io:3707](http://test.bcovrin.vonx.io:3707) or |
| 173 | + [https://candyscan.idlab.org/](https://candyscan.idlab.org/) |
| 174 | +- `<NAME>` is the name of a person authorized to update the OCA Bundle and |
| 175 | +related data. There may be multiple rows in the markdown table to name multiple |
| 176 | +people. |
| 177 | +- `<GITHUB ID>` is the GitHub ID of the named person. |
| 178 | +- `<EMAIL ADDRESS>` is the email address of the named person |
| 179 | + |
| 180 | +[OCA Explorer]: https://bcgov.github.io/aries-oca-explorer/ |
| 181 | + |
| 182 | +The `<CONTACT EMAIL ADDRESS>` and the Authorization table are to ensure that |
| 183 | +once the OCA Bundle is submitted, there are contacts available to answer |
| 184 | +questions about, and to submit updates to, the OCA Bundle. |
| 185 | + |
| 186 | +The contents of the `Authorization` section (following the `## Authorization` line) may be replaced |
| 187 | +with the following to avoid repeating the same contents in every OCA Bundle `README.md` file: |
| 188 | + |
| 189 | +`The Authorization table for this OCA Bundle is in [this file](<path-to-another-OCABundle-folder/README.md).` |
| 190 | + |
| 191 | +## Adjusting the `branding.json` File |
| 192 | + |
| 193 | +The `branding.json` file(s) may need some adjustments in the paths to the images that are included in the OCA Bundles folder. We hope to automate this step soon, but for now it is a manual step. |
| 194 | + |
| 195 | +If the `branding.json` files contain the URL for the image that is in the OCA Bundle folder, edit the URL to be the correct path to that image in the current folder. Specifically, set the image path value to the following, a three part string defined below. |
| 196 | + |
| 197 | +`https://raw.githubusercontent.com/bcgov/aries-oca-bundles/main/<path-to-OCA-Folder>/<image-file-name>` |
| 198 | + |
| 199 | +- The first part (up to `main/`) is the standard GitHub hard coded path to a `raw` file on the `main` branch of the repository. |
| 200 | +- The second is the path to the folder in the repository, starting with `OCABundles` and ending with this OCA Folder name (e.g., `OCABundles/schema/bcgov-digital-trust/LCRB/selling-it-right`). |
| 201 | +- The third part is the image file name (e.g., `bc-logo.jpg`) |
| 202 | + |
| 203 | +## Adding the Watermarks |
| 204 | + |
| 205 | +While we plan to soon move the injection of the `watermark` value into the generation process, it is currently a manual step requiring the editing of the Excel file. For each OCA Bundle where a watermark is required: |
| 206 | + |
| 207 | +- Edit the Excel file |
| 208 | +- On each language tab (e.g. `en` and `fr`), add the value `watermark` in the first empty row in Column A, and put the language-specific watermark file in the same row, Column B. |
| 209 | + - If there is no watermark associated with an identifier, do not edit the Excel file. The default is no watermark. |
| 210 | +- Save the Excel file. |
| 211 | + |
| 212 | +## Generating the OCA Bundle JSON File from Source |
| 213 | + |
| 214 | +A bash script `genBundle.sh` can be found in the `scripts` folder of the [Aries |
| 215 | +OCA Bundles] GitHub repository that generates the OCA Bundle JSON file. To use |
| 216 | +it, you will need to install a few prerequisites--`jq` and the OCA Excel Parser |
| 217 | +(a Rust binary). |
| 218 | + |
| 219 | +### Prerequisites |
| 220 | + |
| 221 | +Developers will likely have the `jq` (JSON Query) command line utility already installed. If not, follow the |
| 222 | +[JQ installation instructions]. Once installed, make sure `jq` is on your path. |
| 223 | + |
| 224 | +[JQ installation instructions]: https://stedolan.github.io/jq/download/ |
| 225 | +[Rust Installation Instructions]: https://www.rust-lang.org/tools/install |
| 226 | + |
| 227 | +Installing the OCA Excel Parser is a little (OK, a lot) more involved, as you need Rust (and more) installed on your machine. Here are the steps: |
| 228 | + |
| 229 | +- Clone a local copy of the OCA Excel Parser repository. |
| 230 | +- If you don't have Rust installed on your machine, following the [Rust Installation Instructions], including installing all necessary dependencies. |
| 231 | +- Follow the instructions in the repository README.md to build the parser. Currently it is just to execute `cargo build`. |
| 232 | +- Copy the resulting executable to a directory on your PATH, e.g., `cp target/debug/parser ~/bin/` |
| 233 | + |
| 234 | +### Running the Generator Script |
| 235 | + |
| 236 | +Assuming you are in an OCABundles folder you can run the script with a relative path, such as: |
| 237 | + |
| 238 | +`../../../scripts/genBundle.sh` |
| 239 | + |
| 240 | +We recommend you create a symbolic link to that script in a directory on your PATH to make it easier to use. |
| 241 | + |
| 242 | +The script checks to see that the pre-requisites (`jq` and `parser`) are |
| 243 | +available and executable, erroring off it not, and, if run without arguments, prints a usage message. |
| 244 | +Currently the `-x <excel file>` is required, and you can supply zero or more |
| 245 | +JSON files to be added to the OCA Bundle produced from processing the Excel |
| 246 | +file. The typical command line is: |
| 247 | + |
| 248 | +`genBundle.sh -x OCA.xlsx branding.json` |
| 249 | + |
| 250 | +If all goes well, an `OCABundle.json` file will be created. |
| 251 | + |
| 252 | +Repeat the generation process for each OCA Bundle you are creating (e.g., per unique watermark value). |
| 253 | + |
| 254 | +## Creating the PR |
| 255 | + |
| 256 | +Once you have successfully generated the OCA Bundle JSON files, you are ready to submit the PR. |
| 257 | + |
| 258 | +- Review the files you will be adding to the repository -- make sure there is nothing beyond the OCA Folders and contents you intend to add. |
| 259 | +- Add the files to your local clone and commit them with an appropriate comment. |
| 260 | +- Push the development branch and create the PR. |
| 261 | + |
| 262 | +The PR **MUST** be reviewed by an OCA Maintainer, and **SHOULD** be approved by whomever requested the PR in the first place. |
| 263 | + |
| 264 | +Assuming all goes well, your PR will be approved and merged. Updates to the OCA Bundle(s) would follow a similar path, save the creation of the OCA Folders. |
0 commit comments