Skip to content
Snippets Groups Projects
Commit bf5a6a23 authored by Martin Schroschk's avatar Martin Schroschk
Browse files

WIP: Restructure Contribution guide

parent a86b76c2
No related branches found
No related tags found
3 merge requests!322Merge preview into main,!319Merge preview into main,!5Issue#6
# Contribution Guide
In the following, it is outlined how to contribute to the HPC documentation of TU Dresden and which
rules should be followed when adding to this project.
In the following, it is outlined how to contribute to the HPC documentation of
[TU Dresden/ZIH](https://tu-dresden.de/zih/) and which rules should be followed when adding to this
project. Although, this document might seem very long describing complex steps, contributing is
quite easy - trust us.
Steps:
* Synchronize local clone of the repository
* Edit files, make changes
* Run checks locally
* Commit changes to foreign remote and branch BXZ
* Create merge request
* CD/CI pipline starts:
* Run checks
* Build documentation
* If CD/CI succeeds, ZIH staff will review the changes and push them to main branch
## Contribute via Issue
Users can contribute to the documentation via the
[issue tracking system](https://gitlab.hrz.tu-chemnitz.de/zih/hpc-compendium/hpc-compendium/-/issues).
Open an issue to report typos and missing documentation or request for more precise wording etc.
ZIH staff will get in touch we you to resolve the issue and improve the documentation.
**Reminder:** Non-documentation issues and requests need to be send as ticket to
[hpcsupport@zih.tu-dresden.de](mailto:hpcsupport@zih.tu-dresden.de).
## Preparation
Contributions can be done via editing the repository through GitLab's web interface or following the
"clone, edit, commit and push" workflow. Both ways are described in the following.
### Fork and Clone Repository
All contributing starts with forking the repository to either
[gitlab.hrz.tu-chemnitz.de](https://gitlab.hrz.tu-chemnitz.de) or any other
git service, e.g., [gitlab.com]()https://www.gitlab.com), [github.com](https://www.github.com) or
your personal preference.
Now, create a local clone of your fork
```Shell Session
# SSH based method
git@gitlab.hrz.tu-chemnitz.de:LOGIN/hpc-compendium.git
# HTTP based method
https://gitlab.hrz.tu-chemnitz.de/LOGIN/hpc-compendium.git
```
#### Install Dependencies
TODO: Describtion
```Shell Session
cd hpc-compendium/doc.zih.tu-dresden.de
pip install -r requirements.txt
```
TODO: virtual environment
TODO: What we need for markdownlinter and co checks?
<!--- All branches are protected, i.e., only ZIH staff can create branches and push to them --->
## Contribute via Web IDE
GitLab offers a rich and versatile web interface to work with repositories. To fix typos and edit
source files, just select the file of interest and click the `Edit` button. A text and commit
editor are invoked: Do your changes, add a meaningful commit message and commit the changes.
The more sophisticated integrated Web IDE is reached from the top level menu of the repository or
by selecting any source file.
Other git services might have an aquivivalent web interface to interact with the repository. Please
refer to the corresponding documentation for further information.
<!--This option of contributing is only available for users of-->
<!--[gitlab.hrz.tu-chemnitz.de](https://gitlab.hrz.tu-chemnitz.de). Furthermore, -->
## Contribute via Local Clone
We highly recommend running the checks before committing and posing a merge request.
### mkdocs rocks
As mentioned, this documentation bases on markdown files which are translated into static html files
using the tool [mkdocs](https://www.mkdocs.org/). All markdown source files are located in the
`docs` subfolder. The file `mkdocs.yml` is the single configuration file for the project from layout
up to document structure and extensions.
The navigation section `nav` in `mkdocs.yml` specifies the order, titles and nesting of the
documentation pages.
## Setup
todo
In principle, `mkdocs` is not mandatory on the local system to contribute to the project. But it
also provides a builtin development server that allows to serve the documentation, i.e. it can
preview the updated documentation locally before committing the changes to the repository.
To make use of `mkdocs`, it is necessary to have two commands in mind
```
mkdocs new [dir-name] - Create a new project.
mkdocs serve - Start the live-reloading docs server.
mkdocs build - Build the documentation site.
mkdocs help - Print this help message.
```
Two? Yes, the `new` command can be ignored, because the project is already started. Furthermore,
`--help` is a de-facto standard switch for a command line tool to provide help.
#### Preview using mkdocs
Invoke`mkdocs serve`to build and preview the documentation. The documentation is automatically
rerenderd and reloaded if the system detects updates (great!). By default, the builtin web server
hosts the documentation at `http://127.0.0.1:8000`.
```Shell Session
~ cd /PATH/TO/hpc-compendium/doc.zih.tu-dresden.de
~ mkdocs serve
INFO - Building documentation...
INFO - Cleaning site directory
INFO - Documentation built in 0.08 seconds
[I 210127 13:33:30 server:335] Serving on http://127.0.0.1:8000
INFO - Serving on http://127.0.0.1:8000
[I 210127 13:33:30 handlers:62] Start watching changes
INFO - Start watching changes
```
Open `http://127.0.0.1:8000` with a web browser to preview the local copy of the documentation.
#### Build Static Documentation
To build the documentation, invoke `mkdocs build`. This will create a new directory named `public`
which holds the generated static html/jss/css files. This command is used to build the documentation
within the CI/CD pipeline. Thus, it should exit without error.
```Shell Session
~ cd /PATH/TO/hpc-compendium/doc.zih.tu-dresden.de
~ mkdocs build
INFO - Cleaning site directory
INFO - Building documentation to directory: /PATH/to/hpc-compendium.git/doc.zih.tu-dresden.de/public
INFO - Documentation built in 0.09 seconds
```
## Git Workflow
todo
It's important to keep your main branch in sync with upstream when you are working on documentation locally. To get started you will need to do the following:
Add a remote upstream to point to upstream repository
git remote add upstream git@gitlab.com:NERSC/nersc.gitlab.io.git
You should see two remote endpoints, origin points to your fork and upstream at main repo.
$ git remote -v
origin git@gitlab.com:<username>/nersc.gitlab.io.git (fetch)
origin git@gitlab.com:<username>/nersc.gitlab.io.git (push)
upstream git@gitlab.com:NERSC/nersc.gitlab.io.git (fetch)
upstream git@gitlab.com:NERSC/nersc.gitlab.io.git (push)
Checkout main and sync main branch locally from upstream endpoint
git checkout main
git pull upstream main
To push your sync changes to your fork you can do the following:
git push origin main
!!! note Please don't use your main branch to make any changes, this branch is used to sync changes from upstream because all merge requests get pushed to main branch. Instead, create a feature branch from main as follows:
Typical workflow
The user workflow can be described in the following steps assuming you are using upstream repo. Please make sure you sync your main branch prior to creating a branch from main.
git checkout main
git checkout -b <BRANCH>
git add <file1> <file2>
git commit -m <COMMIT MESSAGE>
git push origin <BRANCH>
Next create a merge request to the main branch with your newly created branch. Please make sure the markdownlint check and continuous integration checks have passed for your merge request.
* It is possible the GitLab shared runners will fail for an opaque
reason (e.g. issues with the cloud provider where they are hosted).
Hitting the **Retry** button may resolve this problem.
##
If you are totally sure about your commit (e.g., fix a typo), it is only the following steps:
## Content Rules
1. Synchronize branches
1. Edit the markdown file of interest
1. Commit change
1. Push commit to your fork and probaly new branch
1. Pose Merge Request
### Checks
Several checks are invoked to ensure for a consistent and high quality documentation:
* Markdown linter
* Links
* Code and command examples
TODO: Describe
### Markdown
todo
### Markdown Linter
......@@ -71,6 +261,34 @@ ERROR: 1 dead links found!
[✖] google.de → Status: 400
```
## Content Rules
### Add a New Page
All `mkdocs` project follow this structure:
```Bash
mkdocs.yml # The configuration file.
docs/
index.md # The documentation homepage.
... # Other markdown pages, images and other files.
```
To add a new page to the documentation follow these two steps:
1. Create new markdown file under `docs/SUBDIR/NEW.md` and put the documentation inside
1. Add `SUBDIR/NEW.md` to the configuration file `mkdocs.yml` by updating the navigation section
Make sure that the new page is not floating, i.e., it can be reached directly from the documentation
structure.
### Markdown
TODO: What dialect we are using?
### Writing Style
### Spelling and Technical Wording
......@@ -109,3 +327,11 @@ drwxr-xr-x 3 zwulf p_zwulf 4096 Feb 12 2020 data
### Code Blocks
All code blocks should be runnable from a login node.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment