This is documentation for CDOC2 system, including analysis, protocol and format specification and architecture documentation.
Please follow these conventions:
- Approximately one chapter per one
.mdfile. If needed, split larger files at section level. All files with.mdextension will be automatically included. Also see mkdocs user guide. - Use numbers in beginning of filenames for sorting
.mdfiles. - Divide material under analysis/spec/architecture topics (subfolders
docs/01_use_case_model,docs/02_protocol_and_cryptography_spec,docs/03_system_architecture). When needed, create additional topics. - Put common acronyms and terms into
docs/includes/abbreviations.md - Put image files into the
docs/imgfolder, so that they could be re-used from multiple.mdfiles and refer to them with paths like../img/SID_MID_full.png - Follow Python-Markdown conventions and MkDocs Material features
markdownlint-cli2 "cdoc2-system-docs/**/*.md"It is possible to build the documentation using Python utilities mike and mkdocs. mike is used for creating persistent versions of the documentation which will not be changed once the documentation has changed. Those versions are created under a special gh-pages branch. Only use this locally, CI already uses mike, see GitLab instructions below.
-
Visual Studio Code (https://code.visualstudio.com)
-
Python with
pippackage manager -
Install smaller Python packages and other requirements:
pip3 install -r ../mkdocs_requirements.txt
-
Test the
mkdocsutilitymkdocs --version
-
Test the
mikeutilitymike --version
-
Build a version of the documentation using
mike, where1.1is an arbitrary version. Any other version name can be used. Then usemike serveto serve all built versions of the documentation under different URL-s.cd cdoc2-system-docs mike deploy 1.1 mike serveIf a default version number is not configured, then the documentation will be served at http://localhost:8000/v1/ , where
v1is the name of the version that was used with thedeploycommand. -
Alternatively
mkdocscan be used directly to build the documentation under the same git branch into the/sitefolder and served from there.cd cdoc2-system-docs mkdocs build mike serveThe documentation should be served at http://127.0.0.1:8000/
- Create RM ticket, if not already there, and corresponding GIT branch from master
- Switch to new GIT branch in your working directory
- Edit source code files with VSCode in
docs/folder, resolve linter errors, check with VSCode "Markdown: Open Preview" command - Run
mkdocs serveand check the local website http://127.0.0.1:8000 within your browser - Commit and push to the branch
- When the ticket is completed or feedback is needed, create GitLab MR (Merge Request)
- After feedback and fixing problems, finish MR and merge changes to master branch
- Check the published website https://cdoc2.pages.ext.cyber.ee/cdoc2-documentation/
-
Add open-eid remote (if not done already)
git remote add github.com/open-eid git@github.com:open-eid/CDOC2.git git remote -v
-
Add your SSH public key to your GitHub account (if not done already)
-
Publish to GitHub Pages
mike deploy -F cdoc2-system-docs/mkdocs.yml --remote github.com/open-eid --deploy-prefix docs --branch gh-pages --push 1.1 mike set-default -F cdoc2-system-docs/mkdocs.yml --remote github.com/open-eid --deploy-prefix docs --branch gh-pages --push 1.1
where
1.1is an arbitrary versionUpdated site is available at http://open-eid.github.io/CDOC2
miketool will generate mkdocs HTML site usingmkdocstool under directorydocsand push it togh-pagesbranch.Generated site files can be viewed https://github.com/open-eid/CDOC2/tree/gh-pages or by running
git checkout gh-pagesCDOC2 Pages configuration is configured to serve generated documentation from
gh-pagesbranch anddocsdirectory. More info from GitHub Pages
Publish to GitLab Pages (https://cdoc2.pages.ext.cyber.ee/cdoc2-documentation)
GitLab-CI handles publishing GitLab Pages.
To trigger the pipeline, a tag has to be added to the commit, and it has to start with letter v, for example v2.0.
Tags are related to specific commits. It is important to know if tag already exists locally and in remote. Then, it should be removed from both first before adding it to a new commit.
To change a commit, remove it locally first:
git tag -d <tagname>
Then remove it from remote using UI
To create the tag and add it to a commit, use the following command:
git tag <tagname> <new-commit-hash>
If the desired commit is the last one, the commit hash can be skipped:
git tag <tagname> e.g., git tag v2.0
Important! Tag names have to start with v, for example v2.0. They can be also longer and include additional data, e.g., v2.0.0-rc.0.
Finally, push the local tag to remote:
git push origin <tagname>
When user navigates to the documentation URL, they are automatically redirected to a specific version of the docs.
Default version is managed by CI/CD variable DOC_DEFAULT_VERSION. To change the default version please change DOC_DEFAULT_VERSION variable before publishing a new tag under CI settings. It has to start with a number and not letter v, for example 2.0!