From 3a2a135d0af50a9360870e0a7f362c3820543e40 Mon Sep 17 00:00:00 2001 From: Jon Date: Sun, 21 May 2023 16:56:36 +0930 Subject: [PATCH] refactor(docs): markdown linting errors fix !25 --- .templates/README.md | 8 +++++++ pages/projects/gitlab-ci/ansible_roles.md | 10 ++++++++ .../gitlab-ci/conventional_commits.md | 24 ++++++++++++++++++- pages/projects/gitlab-ci/docker_container.md | 3 +++ pages/projects/gitlab-ci/git_mirror.md | 9 +++++++ pages/projects/gitlab-ci/gitlab_release.md | 24 +++++++++++++++---- pages/projects/gitlab-ci/mkdocs-build.md | 4 ++++ pages/projects/gitlab-ci/python.md | 8 +++++++ pages/projects/gitlab-ci/yaml_lint.md | 10 +++++++- 9 files changed, 93 insertions(+), 7 deletions(-) diff --git a/.templates/README.md b/.templates/README.md index 1445d4b..156681d 100644 --- a/.templates/README.md +++ b/.templates/README.md @@ -1,18 +1,23 @@ # {CI Job Name} + Summary of job here This job provides the following badge: {A badge here} + ## Dependencies - {dependent job name} + ## your .gitlab-ci.yml changes + To use this job add the following to your `.gitlab-ci.yml` file ``` yaml + variables: VARNAME: "a var value" @@ -21,8 +26,10 @@ stages: include: - local: CI/{job name}/.gitlab-ci.yml + ``` + ## CI/CD Variables required | var name | Description | @@ -37,4 +44,5 @@ include: ## License + To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) diff --git a/pages/projects/gitlab-ci/ansible_roles.md b/pages/projects/gitlab-ci/ansible_roles.md index 861d98e..021a8f9 100644 --- a/pages/projects/gitlab-ci/ansible_roles.md +++ b/pages/projects/gitlab-ci/ansible_roles.md @@ -13,14 +13,18 @@ This job provides the following badge: - None + ## Dependencies - None + ## your .gitlab-ci.yml changes + To use this job add the following to your `.gitlab-ci.yml` file ``` yaml + stages: - validation @@ -33,9 +37,12 @@ Ansible Lint (python 3.6): extends: - .ansible_linter_defaults image: python:3.6-slim + ``` + > You can use any python version you wish. + ## CI/CD Variables required | var name | Description | @@ -47,11 +54,14 @@ Ansible Lint (python 3.6): - This job will lint any yml file in the specified directory using ansible rules. + ## Artifacts - `$CI_PROJECT_DIR/artifacts` - Root artifact directory - `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-ansible-lint.junit.xml` - JUnit Test report - `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-ansible-lint.log` - Linter log + ## License + To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) diff --git a/pages/projects/gitlab-ci/conventional_commits.md b/pages/projects/gitlab-ci/conventional_commits.md index 0b9ba1b..73f079c 100644 --- a/pages/projects/gitlab-ci/conventional_commits.md +++ b/pages/projects/gitlab-ci/conventional_commits.md @@ -7,21 +7,27 @@ about: https://gitlab.com/nofusscomputing/projects/gitlab-ci --- ## User Manual + Commitizen is used to validate the format of commit messages. we use [Conventional Commit Messages](https://www.conventionalcommits.org/en/v1.0.0/) format for our validation jobs. This repository may have two CI jobs to do with commitizen: + - **MR Title** *Checks the Merge Request Title* + - **Commit Messages** *Checks all commit messages* These CI Jobs output a test report that can be viewed inside of the merge request and contain the error(s), if any. To fix an error please refer to the titled sections below. + ### MR Title + Ensure that the merge request title is in the [conventional message](https://www.conventionalcommits.org/en/v1.0.0/) format. NOTE: the title is case sensitive. ### Commit Messages + All commit messages that form part of your merge request must be in [conventional message](https://www.conventionalcommits.org/en/v1.0.0/) format. To fix them go back and edit your commit messages. @@ -31,23 +37,30 @@ To fix them go back and edit your commit messages. If only the last commit is the commit with an error just use `git commit --amend` and edit your commit message to be in the correct format and save. now push your changes. - You will require the following information if the commit message with the error is further down the commit tree: + - Commit message SHA1 of your first commit message to the branch `{original_commit}` + - Commit message SHA1 prior to your first commit `{source_commit}` Run these commands once you have the information above. + ``` bash + git format-patch {original_commit}..HEAD -o diff-patches git reset {source_commit} --hard + ``` Now, navigate to the `diff-patches` folder, open up the offending patch (commit) and edit the `subject` or message body as appropriate and save. Once all the edits have been done, re-apply the patches to your tree with: ``` bash + git am diff-patches/*.patch + ``` + Now push your changes upstream. | :notebook_with_decorative_cover: Note | @@ -60,20 +73,25 @@ Now push your changes upstream. ## Conventional Commits Admin Manual Manual + This job checks commit messages on a branch and the merge request title for validity against the [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/) This job provides the following badge: - None + ### Dependencies - None + ### your .gitlab-ci.yml changes + To use this job add the following to your `.gitlab-ci.yml` file ``` yaml + variables: GIT_SUBMODULE_STRATEGY: recursive MY_PROJECT_ID: "{yourproject id number}" @@ -83,8 +101,10 @@ stages: include: - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/conventional_commits/.gitlab-ci.yml + ``` + ## CI/CD Variables required | var name | Description | @@ -93,6 +113,7 @@ include: In addition to the required variables above, the commitizen config file `.cz.yaml` must exist for the job to run. + ### Job Workflow @@ -100,4 +121,5 @@ In addition to the required variables above, the commitizen config file `.cz.yam ### License + To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) diff --git a/pages/projects/gitlab-ci/docker_container.md b/pages/projects/gitlab-ci/docker_container.md index 2af5db4..cf043e2 100644 --- a/pages/projects/gitlab-ci/docker_container.md +++ b/pages/projects/gitlab-ci/docker_container.md @@ -7,12 +7,14 @@ about: https://gitlab.com/nofusscomputing/projects/gitlab-ci --- - available tags `dev` for latest dev build + - latest matches latest git tag - notate available platforms can be viewed in the job ``` yaml + # Available platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6 # DOCKER_IMAGE_BUILD_TARGET_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7" DOCKER_IMAGE_BUILD_NAME: $CI_PROJECT_NAME @@ -26,4 +28,5 @@ about: https://gitlab.com/nofusscomputing/projects/gitlab-ci # JOB_STOP_GIT_PUSH_MIRROR: 'any_value' # GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/config.git" # Must be defined for job to run # JOB_STOP_GITLAB_RELEASE: 'any value' + ``` \ No newline at end of file diff --git a/pages/projects/gitlab-ci/git_mirror.md b/pages/projects/gitlab-ci/git_mirror.md index 1661600..874a8ea 100644 --- a/pages/projects/gitlab-ci/git_mirror.md +++ b/pages/projects/gitlab-ci/git_mirror.md @@ -17,10 +17,13 @@ This job provides the following badge: - None + ## your .gitlab-ci.yml changes + To use this job add the following to your `.gitlab-ci.yml` file ``` yaml + stages: - sync @@ -35,6 +38,7 @@ Github (Push --mirror): ``` + ## CI/CD Variables required | var name | Description | @@ -47,6 +51,7 @@ Github (Push --mirror): - This job is designed to run on successful completion of the validation tasks and only on the `development` and `master` branches. You can safely override the `rules` when creating the job with your own. i.e. ``` yaml + Github (Push --mirror): variables: GIT_SYNC_URL: "https://${username variable}:${pasword variable}@github.com/NoFussComputing/gitlab-ci.git" @@ -57,12 +62,16 @@ Github (Push --mirror): when: never - if: '$CI_COMMIT_BRANCH == "development"' when: always + ``` + This will cause the job to only run on the `development` branch. + ## Artifacts - None ## License + To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) diff --git a/pages/projects/gitlab-ci/gitlab_release.md b/pages/projects/gitlab-ci/gitlab_release.md index 40c1484..2bb09b4 100644 --- a/pages/projects/gitlab-ci/gitlab_release.md +++ b/pages/projects/gitlab-ci/gitlab_release.md @@ -8,8 +8,8 @@ about: https://gitlab.com/nofusscomputing/projects/gitlab-ci # User Manual -All commit messages must be in [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/) and have a footer with a gitlab reference. The reference **must** be either a merge request or a gitlab issue. (format i.e. `!1` or `#2` *using the correct reference number*). +All commit messages must be in [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/) and have a footer with a gitlab reference. The reference **must** be either a merge request or a gitlab issue. (format i.e. `!1` or `#2` *using the correct reference number*). ## fixing commit messages (suggestion) @@ -18,21 +18,29 @@ If only the last commit is the commit with an error just use `git commit --amend You will require the following information if the commit message with the error is further down the commit tree: + - Commit message SHA1 of your first commit message to the branch `{original_commit}` + - Commit message SHA1 prior to your first commit `{source_commit}` Run these commands once you have the information above. + ``` bash + git format-patch {original_commit}..HEAD -o diff-patches git reset {source_commit} --hard + ``` Now, navigate to the `diff-patches` folder, open up the offending patch (commit) and edit the `subject` or message body as appropriate and save. Once all the edits have been done, re-apply the patches to your tree with: ``` bash + git am diff-patches/*.patch + ``` + Now push your changes upstream. | :notebook_with_decorative_cover: Note | @@ -44,11 +52,8 @@ Now push your changes upstream. | *Ensure that all of your commits were exported prior to reseting the branch and when re-applying, that all of your commits were applied correctly* | - - - - # Gitlab Release - Developer Manual + This job bumps the version, updates the changelog, creates a git tag and creates a gitlab release. The git tag and release title use [semantic versioning](https://semver.org/). for this job to function correctly a `.cz.yaml` is required in the root of the repository. this file contains the [commitizen](https://github.com/commitizen-tools/commitizen) config and the version details. This job has the following workflow: @@ -73,11 +78,13 @@ This job provides the following badge: - None ## your .gitlab-ci.yml changes + To use this job add the following to your `.gitlab-ci.yml` file CI Job `ci commit footer` is automatically set to run on all branches except `development` and `master`. This job checks the commits on the users branch that they contain a footer with gitlab references. i.e. `#1` for issue one or `!1` for merge request one. ``` yaml + stages: - validate - release @@ -90,7 +97,9 @@ Gitlab Release: MY_COMMAND: "{your command here}" extends: - .gitlab_release + ``` + > if you wish to run any commands you can add them to variable `MY_COMMAND`. The custom command will run under shell `/bin/sh`. This command is set to run before the version bump commit is conducted so any changes you wish to add as part of the version bump, you can do here as long as you `git add {changed file name}`. @@ -107,9 +116,13 @@ Gitlab Release: This CI job's workflow is: 1. updates the changelog from the commits + 1. commit the changelog to git + 1. adds a `git tag` to the changelog commit. + 1. pushes the change back to the repo + 1. creates a git release from the `git tag` | :octagonal_sign: **NOTE** | @@ -126,5 +139,6 @@ This CI job's workflow is: > None ## License + To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) diff --git a/pages/projects/gitlab-ci/mkdocs-build.md b/pages/projects/gitlab-ci/mkdocs-build.md index 44ed621..7bb1d2b 100644 --- a/pages/projects/gitlab-ci/mkdocs-build.md +++ b/pages/projects/gitlab-ci/mkdocs-build.md @@ -1,4 +1,5 @@ # MKDocs Static Site Build + Build a MKDocs site from the config specified in `mkdocs.yml`. _Only runs if `mkdocs.yml` exists in the repository root directory._ This job is designated to run on all branchs so that you can use the artifacts for deployment to `staging` and/or `production` as required. This job provides the following badge: @@ -10,9 +11,11 @@ This job provides the following badge: - **Mandatory** file `mkdocs.yml` in the repository root directory with your MKDocs configuration ## your .gitlab-ci.yml changes + To use this job add the following to your `.gitlab-ci.yml` file ``` yaml + stages: - build @@ -55,4 +58,5 @@ MKDocs build: - files in `"$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME"` ## License + To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) diff --git a/pages/projects/gitlab-ci/python.md b/pages/projects/gitlab-ci/python.md index e09a4e9..4eb1a61 100644 --- a/pages/projects/gitlab-ci/python.md +++ b/pages/projects/gitlab-ci/python.md @@ -15,7 +15,9 @@ These jobs provides the following badge: - `PyLint` - code quality [![PyLint Score](https://img.shields.io/badge/dynamic/json?&style=plastic&logo=python&label=PyLint%20Score&query=%24.PyLintScore&url=https%3A%2F%2Fgitlab.com%2Fnofusscomputing%2Fprojects%2Fgitlab-ci%2F-%2Fjobs%2Fartifacts%2Fdevelopment%2Fraw%2Fartifacts%2Fvalidation%2FPyLint%2Fbadge_pylint.json%3Fjob%3DPyLint)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/jobs/artifacts/development/file/artifacts/validation/tests/gl-code-quality-report.html?job=PyLint) Use the following MD to add a badge adjusting the variables and ensuring everything is on one line. + ``` md + [![PyLint Score](https://img.shields.io/badge/dynamic/json?&style=plastic&logo=python&label=PyLint%20Score&query=%24.PyLintScore&url=https%3A%2F%2Fgitlab.com%2F {project path} @@ -44,7 +46,9 @@ artifacts/validation/tests/gl-code-quality-report.html {Job Name} ) + ``` + | Variable | Description | |:----|:----| | `{project path}` | *project path, what's after gitlab.com/* | @@ -60,6 +64,7 @@ artifacts/validation/tests/gl-code-quality-report.html To add the `PyLint` job, add the following to your `.gitlab-ci.yml` file ``` yaml + stages: - validation @@ -73,6 +78,7 @@ PyLint: extends: - .PyLint image: python:3.6-slim + ``` @@ -88,6 +94,7 @@ PyLint: - This job will lint any yaml file in the specified directory using the specified rules. + ## Artifacts - `$CI_PROJECT_DIR/artifacts` - Root artifact directory @@ -95,4 +102,5 @@ PyLint: - `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html` - html code quality report ## License + To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) diff --git a/pages/projects/gitlab-ci/yaml_lint.md b/pages/projects/gitlab-ci/yaml_lint.md index cc6f98a..acc8524 100644 --- a/pages/projects/gitlab-ci/yaml_lint.md +++ b/pages/projects/gitlab-ci/yaml_lint.md @@ -8,7 +8,6 @@ about: https://gitlab.com/nofusscomputing/projects/gitlab-ci This job does yaml linting when any commit is pushed to any branch. - This job provides the following badge: - None @@ -17,10 +16,13 @@ This job provides the following badge: - None + ## your .gitlab-ci.yml changes + To use this job add the following to your `.gitlab-ci.yml` file ``` yaml + stages: - validation @@ -34,9 +36,12 @@ Yaml Lint (python 3.6): extends: - .yaml_linter_defaults image: python:3.6-slim + ``` + > You can use any python version you wish. + ## CI/CD Variables required | var name | Description | @@ -49,11 +54,14 @@ Yaml Lint (python 3.6): - This job will lint any yaml file in the specified directory using the specified rules. + ## Artifacts - `$CI_PROJECT_DIR/artifacts` - Root artifact directory - `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-yaml-lint.junit.xml` - JUnit Test report - `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-yaml-lint.log` - Linter log + ## License + To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)