Contribution¶
All contributions are welcome!
Outside Collaborators
Please open a support request in your #cloud-platform-<workload> channel to be added as a collaborator to this repository.
Fork-based pull requests are not recommended at this time.
Modify directly on GitHub¶
This documentation is designed to be easily modified without needing to setup a local development environment. For small fixes, adjustments, or additions, feel free to modify directly on GitHub and submitting a pull request.
Work locally¶
For larger changes, it is recommended to work locally, which requires git to be installed.
Clone the repository¶
First, clone the project repository:
git clone https://example.com/platform-eng/cloud-platform-docs.git
cd cloud-platform-docs
Directory structure¶
To reduce confusion and friction, the structure of the mkdocs site is automatically generated based on the folder structure within docs. There are various scripts and pre-commit hooks that streamline the process of creating new documents and inserting them into the nav. These are the rules:
- All markdown files must be named
index.md - All
index.mdfiles must be contained in a directory that matches a snake case version of the title (i.e.<h1>) of the document. For example, if the title isAmazing Document, the directory must be namedamazing_document. - One, and only one markdown file may exist in a directory, and it must be
index.md - All images and attachments used by
index.mdmust live in the same directory and at the same level (note:gitde-duplicates file contents). - Any document that is the child of another document must adhere to these rules.
Local development environment¶
There are two supported paths for setting up a local development environment. Both paths have additional tooling prerequisites.
Option 1: VSCode + DevContainer (recommended)¶
Prerequisites
- VScode
- VSCode DevContainer Extension
- A suitable Docker container runtime (e.g. Rancher Desktop) providing both
dockeranddocker compose
- Open project in VSCode
- Click button when prompt surfaces to Re-Open in DevContainer (You may also use the command pallet to perform this action)
Option 2: Minimal installation of Python, Mkdocs, and Pre-Commit¶
Prerequisites
- Python 3.10+
- Python virtualenv module
-
Install Dependencies:
python3 -m venv .venv source .venv/bin/activate pip install -r requirements.txt -c constraints.txt -
Install Pre-Commit Hooks:
pre-commit install
Prepare changes¶
-
Create a branch (avoid working directly on the
mainbranch):git checkout -b "<my_branch_name>" -
To create a new document that conforms to the directory structure, run
./scripts/create_new_page.sh "New Doc" docsThis will create the following folder structure
docs/new_doc/index.mdwhereindex.htmlhas the content# New Doc. -
Launch Mkdocs:
This step starts Mkdocs in strict mode with
mkdocs serveand hydrates thenavsection of themkdocs.yml:./scripts/start_mkdocs.shBy default, Mkdocs hot-reloads whenever content under
docsis changed. When adding new content, you must re-run the above command to ensure new pages are added to thenav. -
Make changes to the documentation by adding new files, updating existing files, or deleting files.
Info
Please review the Standards for how to best contribute to the documentation.
-
(Optional) It may be useful to run the
pre-commithooks against all files to find potential problems before committing../scripts/pre_commit.sh -
Commit changes:
git add <file1> [...] git commit [-m <message>]The
pre-commithooks should run automatically. If a hook modifies any files or fails, the commit aborts, in which case, you must fix the issues and commit again.Info
In the rare event you must bypass
pre-commithooks, you may do so by adding the--no-verifyflag:git commit --no-verify [-m <message>] -
Push changes on your branch to GitHub
git push origin "<my_branch_name>" -
When satisfied the changes on your branch are ready for review, open a pull request
Preview changes¶
GitHub Actions posts a comment on the pull request with a link to your changes, using the following format: https://cp-docs-dev.company.com/branch-<branch-name>
Publish changes to production¶
GitHub automatically requests review from an appropriate maintainer based on the CODEOWNERS file.
To merge the pull request, the following must occur:
- The
pre-commitquality checks in GitHub Actions must pass - A code owner must approve the pull request
When the pull request is merged, GitHub automatically publishes the changes to https://cp-docs.company.com.
Additional resources