diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index a31cd288..f46b8199 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -1,14 +1,19 @@ -# --- -# name: 'Python' +--- +name: 'CI' -# on: -# push: +on: + push: + branches: + - '**' + tags: + - '*' -# jobs: -# collection: -# name: 'Ansible Collection' -# uses: nofusscomputing/action_ansible_collection/.github/workflows/reusable_ansible_collection.yaml@genesis -# # secrets: -# # WORKFLOW_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} +jobs: + + mkdocs: + name: 'MKDocs' + uses: nofusscomputing/action_mkdocs/.github/workflows/reusable_mkdocs.yaml@genesis + # secrets: + # WORKFLOW_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} diff --git a/docs/.gitkeep b/docs/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/docs/articles/index.md b/docs/articles/index.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/contact.md b/docs/contact.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/index.md b/docs/index.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/operations/index.md b/docs/operations/index.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/projects/ansible/collection/centurion/index.md b/docs/projects/ansible/collection/centurion/index.md new file mode 100644 index 00000000..dd55e7db --- /dev/null +++ b/docs/projects/ansible/collection/centurion/index.md @@ -0,0 +1,119 @@ +--- +title: Centurion +description: No Fuss Computings Companion Ansible Collection Centurion for Centurion ERP. +date: 2024-07-30 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/ansible/collections/kubernetes +--- + +# L1 should fail + + + +![Project Status - Active](https://img.shields.io/badge/Project%20Status-Active-green?logo=github&style=plastic) + + +![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/nofusscomputing/ansible_collection_centurion/ci.yaml?branch=master&style=plastic&logo=github&label=Build&color=%23000) ![GitHub Release](https://img.shields.io/github/v/release/nofusscomputing/ansible_collection_centurion?sort=date&style=plastic&logo=github&label=Release&color=000) + +[![Downloads](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgalaxy.ansible.com%2Fapi%2Fv3%2Fplugin%2Fansible%2Fcontent%2Fpublished%2Fcollections%2Findex%2Fnofusscomputing%2Fcenturion%2F&query=%24.download_count&style=plastic&logo=ansible&logoColor=white&label=Galaxy%20Downloads&labelColor=black&color=cyan)](https://galaxy.ansible.com/ui/repo/published/nofusscomputing/centurion/) + + + + + +This Ansible Collection is intended to compliement [Centurion ERP](../../../centurion_erp/index.md). + +## Features + +- [Inventory plugin](./plugins/inventory.md) + + +## Ansible Automation Platform / AWX + +This collection can be directly added to AAP/AWX. To do so conduct the following: + +1. Add the collection as a Project + + `Projects -> Add` + + - name: _Collection/No Fuss Computing/Centurion_ + + - Source Control Type: _Git_ + + - Source Control URL: _https://gitlab.com/nofusscomputing/projects/ansible/collections/centurion_erp_collection.git_ + + - Source Control Branch/Tag/Commit: _set to a branch, tag or commit_ + + - `Save` + +1. Add a Credential type for the invneotries use + + `Credential Types -> Add` + + - name: _Collection/No Fuss Computing/Centurion_ + + - Input configuration: + + ``` yaml + + fields: + - id: CENTURION_API + type: string + label: Centurion Host URL + - id: CENTURION_TOKEN + type: string + label: Centurion API Token + secret: true + - id: VALIDATE_CENTURION_CERTS + type: boolean + label: Validate Centurion SSL Certificate + required: + - CENTURION_API + - CENTURION_TOKEN + + ``` + + - Injector configuration: + + ``` yaml + + env: + CENTURION_API: '{{ CENTURION_API }}' + CENTURION_TOKEN: '{{ CENTURION_TOKEN }}' + VALIDATE_CENTURION_CERTS: '{{ VALIDATE_CENTURION_CERTS | default(true) }}' + + ``` + +1. Create a Credential + + `Credentials -> Add` + + - name: _Centurion_ + + - Credential Type: _Collection/No Fuss Computing/Centurion_ + +1. Add an inventory + + `Inventoryies -> Add` and complete the fields + + - name: _Centurion_ + + - `Save` + +1. Add a source to the inventory + + `Inventoryies -> -> Sources -> Add` + + - name: _Centurion ERP_ + + - Source: _Sourced from Project_ + + - Credential: _Centurion_ + + - Project: _Collection/No Fuss Computing/Centurion_ + + - Inventory File: _inventory/inventory.yaml_ + + - `Save` + +1. a diff --git a/docs/projects/ansible/collection/centurion/plugins/index.md b/docs/projects/ansible/collection/centurion/plugins/index.md new file mode 100644 index 00000000..ff592be8 --- /dev/null +++ b/docs/projects/ansible/collection/centurion/plugins/index.md @@ -0,0 +1,11 @@ +--- +title: Plugins +description: No Fuss Computings Companion Ansible Collection Centurion Plugins. +date: 2024-07-31 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/ansible/collections/kubernetes +--- + +Available plugins include: + +- [Inventory](./inventory.md) diff --git a/docs/projects/ansible/collection/centurion/plugins/inventory.md b/docs/projects/ansible/collection/centurion/plugins/inventory.md new file mode 100644 index 00000000..e4a49834 --- /dev/null +++ b/docs/projects/ansible/collection/centurion/plugins/inventory.md @@ -0,0 +1,11 @@ +--- +title: Inventory +description: No Fuss Computings Companion Ansible Collection Centurion Inventory Plugin. +date: 2024-07-31 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/ansible/collections/kubernetes +--- + +This inventory plugin obtains the data required from [Centurion ERP](../../../../centurion_erp/index.md) to build up an ansible inventory for all devices. + +## random \ No newline at end of file diff --git a/docs/projects/ansible/collection/index.md b/docs/projects/ansible/collection/index.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/projects/ansible/index.md b/docs/projects/ansible/index.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/projects/centurion_erp/index.md b/docs/projects/centurion_erp/index.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/projects/index.md b/docs/projects/index.md new file mode 100644 index 00000000..e69de29b diff --git a/docs/tags.md b/docs/tags.md new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/.cz.yaml b/gitlab-ci/.cz.yaml new file mode 100644 index 00000000..fd445ea6 --- /dev/null +++ b/gitlab-ci/.cz.yaml @@ -0,0 +1,7 @@ +commitizen: + bump_message: "build(version): bump version $current_version \u2192 $new_version" + changelog_incremental: false + name: cz_conventional_commits + tag_format: $major.$minor.$patch$prerelease + update_changelog_on_bump: true + version: 0.7.0rc0 diff --git a/gitlab-ci/.gitignore b/gitlab-ci/.gitignore new file mode 100644 index 00000000..a5e24abd --- /dev/null +++ b/gitlab-ci/.gitignore @@ -0,0 +1,17 @@ + +# Log files +*.log + +# Python environments +env/ +dev_env/ + +# ignore junit reports +*.junit.xml + +# ignore gitlab-ci artifacts +artifacts/ + + +__pycache__ +*.egg-info diff --git a/gitlab-ci/.gitlab-ci.yml b/gitlab-ci/.gitlab-ci.yml new file mode 100644 index 00000000..b27f1ec7 --- /dev/null +++ b/gitlab-ci/.gitlab-ci.yml @@ -0,0 +1,149 @@ + +stages: + - chores + - validation + - build + - prepare + - test + - release + - sync + - deploy + - publish + +include: + - local: $JOB_ROOT_DIR/lint/yaml.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/template/automagic.gitlab-ci.yaml + + - local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/lint/markdown.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/python/.gitlab-ci.yml + # - local: $JOB_ROOT_DIR/test/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/ansible/collection/ci-test.gitlab-ci.yml + - template: Security/Dependency-Scanning.gitlab-ci.yml + #- template: Security/License-Scanning.gitlab-ci.yml + + +variables: + JOB_ROOT_DIR: '.' + SECURE_LOG_LEVEL: debug + GIT_SUBMODULE_STRATEGY: normal + GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/gitlab-ci.git" + MY_PROJECT_ID: "28543717" + LICENSE_FINDER_CLI_OPTS: '--recursive' + MDLINT_PATHS: "**/*.md **/**/*.md **/**/**/*.md **/**/**/**/*.md **/**/**/**/**/**/*.md #**CHANGELOG.md #CHANGELOG.md #website-template/** #.gitlab/**" + PAGES_ENVIRONMENT_PATH: projects/gitlab-ci/ + +# Scanner doesn't Pickup multiple pip files. Disable and specify jobs with pip file. +gemnasium-python-dependency_scanning: + rules: + - when: never + +# source: https://gitlab.com/gitlab-org/gitlab/-/blob/2f33a8cb4dcea7b875e360d4cd9e016e027d2973/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml +.gemnasium-python-dependency_scanning: + extends: .ds-analyzer + image: + name: "$DS_ANALYZER_IMAGE" + variables: + # Python 3.7 not available +# DS_PYTHON_VERSION: "3.7" + # DS_ANALYZER_IMAGE is an undocumented variable used internally to allow QA to + # override the analyzer image with a custom value. This may be subject to change or + # breakage across GitLab releases. + DS_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/gemnasium-python:$DS_MAJOR_VERSION" + # Stop reporting Pipenv and Setuptools as "pip". + # See https://gitlab.com/gitlab-org/gitlab/-/issues/338252 + DS_REPORT_PACKAGE_MANAGER_PIP_WHEN_PYTHON: "false" + # Can't find pillow 9.0, check python version. 3.6 only available, 3.7 not. + before_script: + - python --version + # Bug reported at gitlab-org/gitlab#350949. + # workaround, delete all other pip files except the one to be scanned + # Delete all existing pipfiles except the one to be scanned. + - for found_file in $(find . -type f -name 'requirements.txt'); do if [ $found_file != "./$PIP_REQUIREMENTS_FILE" ]; then echo "[DEBUG] Removing '$found_file' due to bug reported at gitlab-org/gitlab#350949"; rm -f $found_file; fi done; + rules: + - if: $DEPENDENCY_SCANNING_DISABLED + when: never + # Support passing of $PIP_REQUIREMENTS_FILE + # See https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#configuring-specific-analyzers-used-by-dependency-scanning + - if: $CI_COMMIT_BRANCH && + $GITLAB_FEATURES =~ /\bdependency_scanning\b/ && + $DS_DEFAULT_ANALYZERS =~ /gemnasium-python/ && + $PIP_REQUIREMENTS_FILE && + ( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline") + +Ansible Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: ansible/requirements.txt + + +conventional_commits Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: conventional_commits/requirements.txt + + +gitlab_release Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: gitlab_release/requirements.txt + + +mkdocs Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: mkdocs/requirements.txt + + +python Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: python/requirements.txt + + +yaml_lint Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: lint/requirements.txt + + +PyLint: + extends: + - .PyLint + image: python:3.6-slim + + +gilab-ci.yml Lint (python 3.11): + extends: + - .Gitlab_CI.Lint.YAML + image: python:3.11-slim + + +Update Sub Repo: + extends: .submodule_update_trigger + parallel: + matrix: + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/ops + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/configuration-management/itil_runbooks + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/website + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_playbooks + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible-roles + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_docker_os + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_test + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/ci-test + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/firewall + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/kubernetes + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/phpipam_scan_agent + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/common + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/docker_management + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/execution_environment + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/git_configuration + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/homeassistant + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/nfc_glpi + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-bind + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-mail + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-buildx-qemu + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-glpi + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/kubernetes_monitoring diff --git a/gitlab-ci/.gitlab-ci_common.yaml b/gitlab-ci/.gitlab-ci_common.yaml new file mode 100644 index 00000000..82d8311e --- /dev/null +++ b/gitlab-ci/.gitlab-ci_common.yaml @@ -0,0 +1,16 @@ +variables: + JOB_ROOT_DIR: 'gitlab-ci' + GIT_SUBMODULE_STRATEGY: normal + #PIPELINE_RUN_TRIGGER: 'false' + PIPELINE_RUN_SCHEDULE: 'true' + +stages: + - chores + - validation + - build + - prepare + - test + - release + - sync + - deploy + - publish diff --git a/gitlab-ci/.gitlab/.gitkeep b/gitlab-ci/.gitlab/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/.gitlab/issue_templates/.gitkeep b/gitlab-ci/.gitlab/issue_templates/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/.gitlab/issue_templates/new_job.md b/gitlab-ci/.gitlab/issue_templates/new_job.md new file mode 100644 index 00000000..d95b30cc --- /dev/null +++ b/gitlab-ci/.gitlab/issue_templates/new_job.md @@ -0,0 +1,84 @@ +## :new: Ansible Role - {new ansible role name} + + +
+:clipboard: template filename.extension + +``` yaml +your yaml playbook here +``` +
+ + +### Playbook usage + + + + +
+:clipboard: example playbook + +``` yaml +your yaml playbook here +``` + +
+ + +### :ledger: Documentation + + + +
+:clipboard: contribution - Documentation + + + +
+ +## :link: Links + + + - link 1 + + - issue #number + + +## :ballot_box_with_check: Tasks + + + - [ ] ~Documentation Added + + - [ ] (dev) Merge request opened and linked to this issue + + + + + + +/label ~"workflow::not started" + +/label ~"category::feature" diff --git a/gitlab-ci/.gitlab/merge_request_templates/.gitkeep b/gitlab-ci/.gitlab/merge_request_templates/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/.gitlab/merge_request_templates/default.md b/gitlab-ci/.gitlab/merge_request_templates/default.md new file mode 100644 index 00000000..8f81fc63 --- /dev/null +++ b/gitlab-ci/.gitlab/merge_request_templates/default.md @@ -0,0 +1,34 @@ +## :books: Summary + + + + +----- + +| :link: **Related Issue(s)** | :link: **Related Merge Request(s)** | +|:----:|:----:| +| | | + + +### :construction_worker: Tasks + + + - [ ] merging to correct branch? + + - [ ] issue linked to this MR? + + - related issues: + + - [ ] closed in a commit message + + - [ ] Manually closed + + - [ ] All related issues tasks complete? + + + + + +/label ~"workflow::not started" + +/label ~"category::feature" diff --git a/gitlab-ci/.gitmodules b/gitlab-ci/.gitmodules new file mode 100644 index 00000000..b8db7a84 --- /dev/null +++ b/gitlab-ci/.gitmodules @@ -0,0 +1,4 @@ +[submodule "website-template"] + path = website-template + url = https://gitlab.com/nofusscomputing/infrastructure/website-template.git + branch=development diff --git a/gitlab-ci/.templates/README.md b/gitlab-ci/.templates/README.md new file mode 100644 index 00000000..156681df --- /dev/null +++ b/gitlab-ci/.templates/README.md @@ -0,0 +1,48 @@ +# {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" + +stages: + - {new stage name} + +include: + - local: CI/{job name}/.gitlab-ci.yml + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| NEW VAR | this var does this and bka | + + +## Job Workflow + + +## Artifacts + + +## License + +To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) diff --git a/gitlab-ci/.vscode/extensions.json b/gitlab-ci/.vscode/extensions.json new file mode 100644 index 00000000..d5e2ce37 --- /dev/null +++ b/gitlab-ci/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "gitlab.gitlab-workflow", + "jebbs.markdown-extended", + "redhat.vscode-yaml", + "streetsidesoftware.code-spell-checker", + "streetsidesoftware.code-spell-checker-australian-english" + ] +} \ No newline at end of file diff --git a/gitlab-ci/.vscode/settings.json b/gitlab-ci/.vscode/settings.json new file mode 100644 index 00000000..b83abeec --- /dev/null +++ b/gitlab-ci/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "gitlab.aiAssistedCodeSuggestions.enabled": false, + "gitlab.duoChat.enabled": false, + "cSpell.language": "en-AU,en" +} \ No newline at end of file diff --git a/gitlab-ci/CHANGELOG.md b/gitlab-ci/CHANGELOG.md new file mode 100644 index 00000000..bb03693e --- /dev/null +++ b/gitlab-ci/CHANGELOG.md @@ -0,0 +1,506 @@ +## 0.7.0rc0 (2024-02-02) + +### Bug Fixes + +- **mkdocs**: [3fa71fe9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3fa71fe91ad1e874b76fab7323e02496ac757f5d) - correct mkdocs image name [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) ] +- **commit_footer_refs**: [0f6e06c5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0f6e06c50f7cae602cdc2ca00bbce7fe1fd72c32) - enable automated jobs without MR to succeed. [ [#44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/44) [!72](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/72) ] +- **commit_footer_refs**: [b8199586](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b8199586b4fe4c9f93efe68a908eaa8582f064c3) - dont update git submodules [ [!71](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/71) [#42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/42) [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) ] + +### Code Refactor + +- **mkdocs**: [955ce375](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/955ce3752050e78085c2037fe66714db41114c9e) - set env name to gitlab pages [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) [#43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/43) ] + +### Features + +- **sub_module_update**: [fc9f3761](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fc9f37617cd26b3e44326161ba10183eb13444dd) - wbsite-template [ [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ] +- **mkdocs**: [3fbd4317](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3fbd4317c0388fb8e406eb78614e3943375496ed) - update requirements.txt to current versions [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ] +- **mkdocs**: [c4087c70](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c4087c7069524df573a43db29c399940600ddba7) - update python to 3.11.2 [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ] + +## 0.6.1 (2023-11-06) + +### Bug Fixes + +- **docker**: [359c664d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/359c664d97c516bd3b35fb46961288c74f6bd940) - always build on tag [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) [#37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/37) ] +- **build**: [799de6c9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/799de6c98c0925ef4a85cf246512041fc89534db) - adjust to enforce [ [!66](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/66) ] +- **docker**: [4ea999ce](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4ea999cec96824c2670c5d448dff8c06b1582adc) - ensure on any changes to directory path, build occurs [ [!64](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/64) [#38](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/38) [!76](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/76) ] +- **template**: [4da44b77](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4da44b77dfbc015d28fda34fcfe54d70a6542943) - issue comment patch remove setting role path [ [!62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/62) ] + +### Code Refactor + +- **ansible**: [d21692f7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d21692f7886986db1808befb00b045c1a9a65a8f) - move submodule/issue patch to mr pipeline [ [!67](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/67) ] + +### Continious Integration + +- **deploy**: [f35d99dc](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f35d99dc436d1e9ab200a8b94052de2fa23608fc) - added docker management repo [ [!63](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/63) ] + +### Documentaton / Guides + +- [535d0b42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/535d0b42938fc66f94fd57018dd81e2111ad3abe) - update docker tag build [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) [#37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/37) ] +- [d9b303ed](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d9b303edc1f61f1d7a4785b5b5396625cc98a179) - expand [ [!59](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/59) ] + +### Features + +- **conventional_commits**: [3918686e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3918686e483f6fabb6c487be6f2d7105da08d11a) - do not run on master branch [ [!70](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/70) [#40](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/40) ] +- **sub_module_update**: [8eb57c58](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8eb57c580973fa49bd3ffb12553cc24e39c5afac) - enable passing commit type and category [ [!69](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/69) [#39](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/39) [!122](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/122) [#39](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/39) [!96](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/96) [!28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/28) ] +- **deploy**: [86a0292f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/86a0292fafa0fb139f068106dacfa2ee6917f4d4) - add new nfc repos [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) ] +- **release**: [837311c0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/837311c0221820b93072e9bfcba2191a8b96b9ea) - annotate git tag with changelog [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) ] +- **build**: [e8758c4c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e8758c4ccecdbf0c22a5e67bf086762c68c6b915) - no docs/docker build on master push, only tag [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) ] +- **docker**: [0d797415](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0d7974152c26200c8beaa3a1ddecf504f4406ee3) - add debugging to publish [ [#36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/36) [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) [#36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/36) [#11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/11) ] +- **deploy**: [1a168593](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1a168593eb0fd234885982a16bc216804e76d293) - added ansible.docker.os repo [ [!67](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/67) ] +- **docker_publish**: [9489c99f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9489c99fe489c9b9b9e29fc2013d5ff6a990094a) - on merge to dev always publish [ [!65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/65) ] +- **template**: [da40e027](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/da40e027376c163ca4915f3edcf322b6e0b0c278) - added auto job mr from issue comment patch [ [!61](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/61) ] + +## 0.6.1rc8 (2023-06-08) + +### Bug Fixes + +- **lint**: [4462ec04](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4462ec04268c5b967f0672828d1cd7b3995894d9) - all lint to immediatly start job [ [!57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/57) ] +- **ci**: [9b00af99](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9b00af996ff96f58a26b83066004e5a9e94ac155) - correct dockerhub tag [ [!57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/57) ] +- **ci**: [6af454be](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6af454be4d2b658e0c362392ff502b3fb3da2cbf) - remove spaces from regex exists and changes [ [!56](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/56) ] +- **ansible_lint**: [46d85bcf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46d85bcf49ea73545a5af4324c28af51a17acd3c) - enable first level dir paths [ [!55](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/55) ] +- **docker_build**: [11b62099](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/11b6209992294e45a051e26963d772d75014e516) - on success push container to docker hub [ [!53](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/53) ] +- **docker_build**: [e90b938b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e90b938bba092bdaecbc1a43758218da0058427b) - init submodule submodules [ [!53](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/53) ] + +### Documentaton / Guides + +- [469255f4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/469255f450e946a712d379415e45a74eb8c07995) - added notes [ [!58](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/58) ] + +### Features + +- **ci**: [0ec520f0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0ec520f02328b69642f929a19e8517c7d475a988) - add resource groups [ [!55](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/55) [#33](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/33) ] +- **sync**: [e75464c7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e75464c7c409fd17864624d48c9fec8e6e3544e9) - immediatee git sync [ [!55](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/55) ] +- **latest_artifacts**: [755fcac0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/755fcac06e9f265789b02a88eb90df35ab1dbf07) - ensure artifats for jobs are always avail on branches [ [!54](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/54) [#34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/34) [#331232](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/331232) ] +- **latest_artifacts**: [22dd4985](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/22dd4985be315be95be55b2b4edff5ae4ba1eeb4) - ensure artifats for jobs are always avail on branches [ [!52](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/52) [#34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/34) [#331232](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/331232) ] + +## 0.6.1rc7 (2023-06-05) + +### Bug Fixes + +- **mkdocs**: [5ffc68d7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5ffc68d7241bb0c729a990b4a5b060bd6488ea8c) - adjust rules to match lint [ [!51](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/51) ] +- **docker**: [097725c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/097725c1be5d155cebada0cf2cbb17ddbd041e6e) - detect canges in include path corrected [ [!50](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/50) ] +- **ci**: [9e098245](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9e098245d7a6272fd51aee0a479af3a233fdb30e) - typo in docker build [ [!49](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/49) [!20](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/20) ] +- **ansible_playbook**: [13ee3bf5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/13ee3bf535dadf7cada645ddec74e2e29872ac2c) - No4 enable parent pipelines [ [!47](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/47) ] +- **ansible_playbook**: [3c0543f7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3c0543f7ad0673bcb6600e6ff20693be5f784f23) - No3 enable parent pipelines [ [!45](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/45) ] +- **ansible_playbook**: [f3fa9c5a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f3fa9c5a416295cb2a0362a31f05995336ea9155) - enable parent pipelines [ [!45](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/45) ] +- **ansible_playbook**: [3ee48daa](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3ee48daa10eee6dd80b79ed076c4ad4d1ff9bb57) - enable parent pipelines [ [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ] + +### Features + +- **ansible_lint**: [6a149f6e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6a149f6ed6d514c42d67b6b04cea114aa32067b8) - added inventory & playbooks directories [ [!50](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/50) [#22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/22) [!27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/27) ] +- **ci**: [1dcb3ed5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1dcb3ed521538de47745ed00148bb4123708d90d) - dont git submodule recurse [ [!50](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/50) ] +- **commit_footer_refs**: [f3256c58](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f3256c5858e1b5b2b6444f9d8ae63f556f4acb30) - only run on changes [ [!50](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/50) ] +- **ci**: [d8a6d5f7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d8a6d5f7ec1f73d5ae506301666383aac843708d) - git gubmodule update trigger moved to api call via curl [ [!48](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/48) [!62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/62) ] +- **ci**: [35cfa92c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/35cfa92cd900e7ed7008695bf0b65aaf147bb0ec) - git submodule job moved to own definition [ [!48](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/48) [!62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/62) ] +- **ansible_playbook**: [a86d17ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a86d17eff267750c3713968852d5013ef00ee226) - rules set to never 'ONLY' [ [!48](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/48) [!62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/62) ] + +## 0.6.1rc6 (2023-06-02) + +### Bug Fixes + +- **md_lint**: [ba43bb9c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ba43bb9c8de87d723abcd0b4b7519c88d8c3b162) - lint on git tag [ [!43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/43) ] + +## 0.6.1rc5 (2023-06-02) + +### Bug Fixes + +- **gitlab_yaml_lint**: [efa62710](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/efa62710571e48872d700a8a8802a526fb86b1f6) - adjust logic to detect changes [ [!42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/42) ] +- **commit_footer_check**: [6accd863](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6accd8633ca0579de084d9762f610711ae1e5715) - run on non master/dev branches only [ [!42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/42) ] + +### Code Refactor + +- **ci**: [9d767282](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9d767282ffa86c48077bd08b605cf50be76a9b07) - update ansible-role repo path [ [!40](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/40) [#74](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/74) ] + +### Features + +- **submodule_update_trigger**: [86b05338](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/86b05338854f94997cb5cf09fad0561c09f86461) - only update own submodule [ [!41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/41) [#16](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/16) [!60](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/60) ] +- **mkdocs_build**: [ff8c43c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ff8c43c1ea2126cabf0ad2f400a784a9f90ec1ac) - always build on git tag [ [!41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/41) ] +- **ci_rules**: [04e7e928](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/04e7e928e0f4f2212078fd08fd87b2e024dd5257) - add exists and changes for rules [ [!41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/41) [#32](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/32) ] +- **yaml_anchors**: [862176f9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/862176f9dca8cf8ee998456db0cc12f7084f7fc0) - initial conditional checks [ [!41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/41) [#32](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/32) ] +- **ci**: [6f810f80](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6f810f8084e54f0afc9ebb47bfcc855536046a08) - add more repos to update [ [!39](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/39) ] + +## 0.6.1rc4 (2023-05-31) + +### Bug Fixes + +- **ansible_playbook**: [73ea66e6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/73ea66e60d9cdb235aebda839e0a734212c997bc) - always pull image [ [!37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/37) ] +- **mkdocs_build**: [c47be421](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c47be42184c96855f0702c0258931da9730df517) - ensure config file exists when run on branch [ [!36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/36) ] +- **automagic**: [8ced1720](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8ced1720e00f984e75c51bf8985e45d07aac8c09) - fix git submodule so it runs on schedule [ [!35](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/35) [#31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/31) ] +- **docs_environment**: [b68f6cb4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b68f6cb4b4a571dee52cb765ddb6a5a70c78b364) - don't define empty env path [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **doc_pages**: [91ac4476](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/91ac4476fbefd2476d1c147c1681a1a53cc40201) - use updated job name [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) [#30](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/30) ] +- **ansible_lint**: [75968b14](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/75968b140ca0b2734d6af14e78e7c598b6221600) - only run if tasks/main.yaml exists [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **mkdocs_build_website**: [0bc72554](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0bc72554534488d147356d148d635d490b8a1007) - renamed and normalized [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) [#30](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/30) ] +- **sub_folder_changelog**: [203a9990](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/203a99903c28201f74304ca8689fae25a7a28aa0) - dont create changelog for docs [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **jobs**: [a010f7ba](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a010f7bab19fc89f71c8bc5a81a3d1944f4bdc05) - jobs that occur on push should also run on 'trigger' [ [!33](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/33) [#26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/26) ] +- **docker_publish**: [79855cdb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/79855cdb99762fd444bedddb6be59cb4ba41fe50) - job only run on dockerfile exists [ [!32](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/32) [#28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/28) ] +- **docker**: [502f12c2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/502f12c21689f86675a000e51ca415019fcad184) - job only run on dockerfile exists [ [!31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/31) [#28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/28) ] + +### Code Refactor + +- [e79b5545](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e79b554550dbabe5df429d6c57fe15cb2b144432) - rename website to documentation [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **ci**: [681b8f1a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/681b8f1a0293986a0b67ba13c72bf8dd92ca692a) - update deploy job name [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **docker_hub**: [7b4b01bd](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7b4b01bdab2c4299e892071ef3c19b324bf3768c) - move needs to template [ [!31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/31) ] + +### Documentaton / Guides + +- [87165450](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/871654508cd183afc1240c9c5de16e9f762c89ee) - refine [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **automagic**: [95bc6a5b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/95bc6a5b036d809ef4bce8af6f70568c595785eb) - added initial autmagic docs [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **ansible_playbook**: [39881505](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/398815055e013059afc6c4d99fa97bdeeb003909) - document ci job definition [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) [#26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/26) [#27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/27) ] + +### Features + +- **ci**: [7018440d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7018440dcbd09c2eb406817eab7df3e24e19687d) - on push to dev, update git sub modules on specified [ [!38](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/38) ] +- **mkdocs_build_docs**: [5e491285](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5e4912857aea43678b2ef61230df3817f193d684) - keyword needs does not belong in definition [ [!36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/36) ] +- **lint_markdown_docs**: [9ebd0a27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9ebd0a27f65b36b289b3e7c0647e839b5f7a2798) - ensure also detects website [ [!36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/36) ] +- **ci**: [44076553](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/440765537dcc4370d6558ec5d41fe7f87a5f7f4d) - use automagic ci template [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **automagic**: [18bc18c2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18bc18c29b4ae08963d4c744e9479622b2cd921c) - add ansible template [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **ansible_play**: [fff7d314](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fff7d31498d486b1c39f1672df9b283ad02c21d8) - force output colour in job logs [ [!33](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/33) ] + +## 0.6.1rc3 (2023-05-28) + +### Bug Fixes + +- **scheduled_pipelines**: [bade89c5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - if scheduled pipeline only run schedualable jobs [ [!30](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/30) [#29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/29) ] + +### Code Refactor + +- **ansible_playbook**: [f9af921e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f9af921e6b6ec10f9f77ec6a016c6cbb9559d1bf) - final logic adjustment for job [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [#25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/25) ] +- **automation**: [1f6ee9ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1f6ee9ea27824df1c82bf85e1e239f57f2145bdf) - final logic changes [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [#25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/25) ] + +### Features + +- **auto_jobs**: [c5d27e83](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c5d27e832e100156cb99c5ca580fd5a8eb600e0f) - created initial template to auto-create jobs [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [#26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/26) ] +- **variables**: [158cc94d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/158cc94d1a817f89b6603e9bac7678196b21d1d5) - added pipeline trigger and schedule [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [#26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/26) ] +- **automation**: [0d3eaa6a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0d3eaa6ac2dc448505b18c6aecd4a72e28ffde83) - job to run ansible playbooks [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [!8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/8) [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) [#5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/5) ] + +## 0.6.1rc2 (2023-05-24) + +### Bug Fixes + +- **sub_folder_changelog**: [0482c014](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0482c0144ede393996449a22f1f7742c2e512ac2) - dont create in git submodules [ [!28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/28) [#23](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/23) ] +- **md_linting**: [e26f590e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e26f590ebcf284be949be4e1d337e1f587755446) - must lint on git tag [ [!27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/27) [!3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/3) ] +- **mkdocs**: [7a9aca3a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7a9aca3a54b1faacb7e286bade84aff0ff4fd2e5) - default to docs directory as root [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- **template**: [0b9e7375](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0b9e7375c911d65e06b0d801755449ab31cb45ea) - use correct path for build artifact [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **markdown_lint**: [18af7f83](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18af7f831ad2399a6ae9809c51e87f19450db1a7) - use new lint path [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **markdown_lint**: [12d3a412](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/12d3a412ac73baff16b77488db143efd7311b542) - typo in config variable [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs**: [f42b0ecf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f42b0ecf60def9d0f8d366d09ab91006b6fe32c6) - add placeholder pages [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **docker**: [f604c6e2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f604c6e27d2e7704491f4c78979db40cf89764c0) - ensure qemu binfmt is loaded [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) [!1861](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/1861) ] +- **docker_hub**: [8e0f16c5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8e0f16c585978ded46164c80559b402c0cb2edf2) - push correct image [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **lint**: [a754aa81](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a754aa81edf1570b4e8e2e7d4a23025c8b99f314) - use correct path for requirements.txt [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **gitlab_release**: [18a28087](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18a280878799fe077efa0ed5b11bceedd53eb5c8) - allow skip on dev branch [ [!17](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/17) ] + +### Code Refactor + +- **docs**: [7c385b75](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7c385b7552945699eb87ec3ec43169df0cb77297) - pages dir renamed to docs [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- **template_website**: [1b59d623](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1b59d62348465cc9cc069d5ee23e759316fa9b3c) - adjust names of jobs [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **markdown_lint**: [bce7396d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bce7396d8bbf5ec6600a3a34a05198a87c4fcc70) - move md linting to lint folder [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **docs**: [3a2a135d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3a2a135d0af50a9360870e0a7f362c3820543e40) - markdown linting errors fix [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs**: [dacb9f22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/dacb9f22dd9aee1ff741c7ac8078912d9a2b0dbf) - use locked version from website repo [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **docker**: [a90ccb81](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a90ccb81772e295cebe89d7a9c32ab700e19884d) - move docker jobs to their own file [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- [c34e382a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c34e382a22cd39874abd8fb5116e831e888db8af) - use name that makes sense [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- [539e40e3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/539e40e3008e24411f62f439d394db4b5e69a066) - move ansible and yaml lint job to linting folder [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] + +### Continious Integration + +- **pages**: [bcb80358](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bcb80358d9adb6b3a89fab1003f4434fb2949bdc) - add pages slug [ [!27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/27) ] + +### Documentaton / Guides + +- [28c04fb2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/28c04fb2e854521167367161d13b09650829d17d) - add job definitions to page [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- [657df7a5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/657df7a5ceb59798c7bb072aed5bf7ef82aef9b6) - add job definition to page [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- [0bc3451b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0bc3451bc20e7705a32d89e9f601af363523d946) - added edit url [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- [4fb85408](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4fb85408b8f4e8b87eb97a43db50c86399d8e350) - move readme to project pages index [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- [b66abc19](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b66abc1947676a624d32b4895a9a05000105f36a) - notate under development [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- [61200e52](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/61200e526efcb71bcec9f27ac4bd7c6f02fc23a6) - update structure [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **template**: [e40310fc](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e40310fc21b6af684f6db7858196e8180b6e03df) - add index and website [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- [55061ad5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/55061ad5efd303cf5a53c4672409f7d159113c62) - use project template [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs**: [1ec2666e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ec2666e8565d5206aefaf5462f0f83f74fbbcb7) - moved to pages folder [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **conventional_commits**: [70dfb826](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/70dfb826d100432265e3f3b08948bb808855e0aa) - added config file requirement [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] + +### Features + +- **template_website**: [bef76847](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bef76847ec686fcff92229d7b9be0bcfc7b267da) - enable specifying the url slug [ [!27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/27) ] +- **docs**: [a8f675c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a8f675c102d0027f23b4490aa3620b504d0193cc) - temp adding of requirements [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- **mkdocs**: [71a335c2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/71a335c2667505c199bd67446327cd8794de5f52) - install website-template requirements [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) [!7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/7) ] +- **pages**: [480502a7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/480502a7638f346be8334d3c03d5b00ec18f0c2f) - don't include projects in nav [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **template**: [8e2a2338](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8e2a233814bd76ebff3dd8ed5a79afe307a84755) - always deploy to pages on dev manual other [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs_build**: [a0b6d05a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a0b6d05a0f3f0fa84c825007f6ec9f28c945f3ef) - always build [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs_build**: [6d2e50e9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d2e50e947839576f098bd7700e00b9d6ab4be1e) - add manual build [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **template**: [4fa90d4c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4fa90d4c4249ed8929e7dde2e7bd0e8581d0d8a7) - use md lint config from website-template [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **markdown_lint**: [38d46900](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/38d469007a388312c71a61916275d6a12aad8bbd) - enable specifying the lint config path [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **pages**: [15750124](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/157501245d7c347670055352f9263917a2c3f445) - use repo name [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **website**: [16d47d5e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/16d47d5e350e1c78f72c97780ed1732a43927fcc) - add pages job for website [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **template**: [91a50eb1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/91a50eb15bd92ca65481a73c6f095681281941fe) - created website job template [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs**: [5556a57e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5556a57ea5588d4f0cd1434bfdde5cd77e3b4f5c) - only run on success [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **conventional_commits**: [088c9fb0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/088c9fb04c80961f4de8d2b129955ae8cd0b9529) - ensure .cz.yaml exists [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **docker_build**: [6765894c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6765894cebc958df92fd3f42d93bd205101d1966) - enable spcifying the dockerfile to use [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **template**: [67f39d96](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/67f39d9694b80ad0d2d08800d4faadf594fb6623) - added a ansible-role job template [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **gitlab_release**: [d89941df](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d89941df05bfed4b0ad1277e715b224d232e7949) - dont automagic run on dev [ [!4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/4) [#21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/21) [!23](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/23) [#21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/21) [!4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/4) ] + +## 0.6.1rc1 (2023-05-15) + +### Bug Fixes + +- **ci**: [b0024c99](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b0024c99b0cd06e12f95882749b3668a639cf24c) - v no longer suffix to tag [ [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) ] +- **docker**: [72f52898](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/72f52898869fe23174e649f0bf8327732fd52147) - setup ROOT_DIR [ [!3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/3) [!1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/1) [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) [!3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/3) [!1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/1) ] +- **conventional_commits**: [76db5b17](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/76db5b17578d8585ed31e0728dbfb37ea2fae153) - never run on git tag [ [!7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/7) [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) [!7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/7) ] +- **markdown_lint**: [8581981a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8581981a43c31d6903865f067fa3f77adae949e5) - fix search paths [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [a04b272c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a04b272c167dae27940211b7c77a4adcb33b2086) - remove extra var creation [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [3b686a46](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3b686a461be22b682642eb1143f2bd2ea2d3ef17) - ensure config is within double quote [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [52c6ceda](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/52c6ceda83b04e1e18eaa9c32b1a41733dc26497) - scan all [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [0d59871a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0d59871a1a73178c248b2189dfae2cd93f21c469) - enable specifying additional config [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **markdown_lint**: [cf10e289](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/cf10e289d21a5cc529bbe7effb189aab65875510) - enable job for md in sub folders [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) [#19](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/19) [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) ] +- [d389d141](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d389d14192e1e483fbd48fa9b5c5bee25db14a20) - validation jobs on all except merge [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [a745ceac](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a745ceac5ebce458b46593311e5285f40dcba349) - fixed rule to match nfc_bot [ [!20](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/20) [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) [!20](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/20) ] +- **gitlab_release**: [e76378dd](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e76378dd068e200a1198f1811efb9d3bec7878f5) - only run on master on_success [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) [#16](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/16) ] +- **ci**: [934a401a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/934a401a9620891b09a5fe9c9b0e50a97b43fa9b) - specify the commitizen version [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **markdown_lint**: [8391bf65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8391bf659bf5dd39edf31205a68c699851e78be3) - remove quotes from search path variable. [ [#18](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/18) ] + +### Code Refactor + +- **ci**: [02e9e5f4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/02e9e5f4f4cc0b93ae92c7ba3a2cfb38305af64c) - inconsistant tabs [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- [adc720bb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/adc720bbfa0dd8ff66f70fe56678b5f388ce8d0c) - cleanup non-needed dir [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [1fa7fec3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1fa7fec38a54b7ddf460b1394a7024ef161fab24) - show debug before command [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- [408e4eab](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - move docs as part of restructure [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- [9a7ae710](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9a7ae7106e80a038b31cdc9fc172bb1f974ecb94) - set correct commit details for nfc_bot [ [!20](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/20) ] + +### Continious Integration + +- [1233d6ad](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1233d6ad90032f3a6c5a3a6ff0c92510d0ef298a) - disable licence scanning until fixed [ [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) ] +- **yaml_lint**: [ca60625b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ca60625bf171924e91ea6eea5aa3decc51b7f0dc) - update to python 11 +- **markdown_linting**: [47e39849](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/47e3984916bf671e6dbc39e05160a2409fc78b6b) - exclude .gitlab and changelog [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- [49282457](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/492824572b963f048af993fc36d8696f9b0fe41e) - dont lint git submodule website-template [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **docs**: [72f8eb72](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/72f8eb720d5266b7aa83b5e2974da075a1c06875) - added mkdocs config [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] + +### Documentaton / Guides + +- **yaml_lint**: [a925db14](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a925db14641e709572b832278f43aabe48d153f7) - update docs for new variables [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] + +### Features + +- **conventional**: [93931cb9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/93931cb9076e0db238f4e297abe3d8f37bd71b80) - job not to run when bot pushes change [ [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) ] +- **ci**: [7ed3f92d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7ed3f92dd75397ad4623ada8469633dc8b0caf5f) - exclude website-template from yaml lint [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **ci**: [bbbf9e35](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bbbf9e35e2ad5d0fdf1c4c697f127dfe68d5e0da) - set correct search path [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [0b4e85c3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0b4e85c3134ff9f126056113383383559cdfb227) - added var to prevent job from runnng [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [e06ffef6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e06ffef66c4a0ba1f48f109c175239560909e698) - run on merge to development [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [199ea1f2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/199ea1f23c6a3df2b40ae3d9a5668719301500d9) - never run on merge or git tag [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **git_push_mirror**: [1db2209d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1db2209dfb36fbdda28d68388aec9f62f85b57bc) - always sync git tag [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **template**: [8b9a0356](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8b9a0356dec7d99a63c4ed744b78ae707155e9f3) - added new template for ci pipeline for docker containers [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **common**: [9670fc47](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9670fc47401630ef6c407bd7eaccd3db64195543) - created a common ci file for inclusion [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **commit_footer_refs**: [8d512a9a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8d512a9a4bd7f4895645436f057c4bab3efb864e) - ability to disable job with variable [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [a37acbfc](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a37acbfc7d3ea20ece7cb76e15a14858b26f8508) - ability to disable job with variable [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **git_push_mirror**: [81445c06](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/81445c06e43bce10761e3a7fbad7df97f82d6bc2) - ability to disable job with variable [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **conventional_commits**: [9e7d357b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9e7d357bab2b92704d37ad5621df9fe8d1e31a26) - ability to disable job with variable [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **markdown_lint**: [d75e9599](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d75e95998b4a195cfcc36683ffa6f058bf7b05be) - artifact locations to be hard set [ [!19](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/19) ] + +## v0.6.1rc0 (2022-01-25) + +### Bug Fixes + +- **lint_markdown**: [e0402ecf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e0402ecfb2ab662a74bb70df7937b02576d5e41b) - ensure the correct path for the job directory is used [ [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) [!18](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/18) ] + +## v0.6.0 (2022-01-24) + +### Bug Fixes + +- **ansible**: [0df60b12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0df60b12dbfff983ca3a671b90ab1be126597e52) - remove duplicate lines that last code review didn't remove. +- **ansible**: [484d9879](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/484d98792a27c9d967331e9d3cd1afdca435bdd6) - fix typo in job pip file +- **dependency_scanning**: [e1894ec0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e1894ec0c4fe7504901682f008c2ff0db7e351fe) - upgraded versions from vulnerability scan. + +### Code Refactor + +- [6668c2fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6668c2fb8d7545b4f9052ad3065e58f00d11be62) - test specifying must equal. + +### Continious Integration + +- **markdown_lint**: [3096d7ee](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3096d7ee0a86d104de04e77b4b734ec0d266020d) - Added Linting of Markdown for files in this repository. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **mkdcos**: [a2d705de](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a2d705deb1f3898b6d5fa4d55bd995b1a7ad4b68) - mkdocs requirements.txt had a '\n' in the filename. renamed. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [39a76a08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/39a76a08691dbdf487405f7c5e6b717eb862d80f) - delete all python 'requirements.txt' files that are not the specified one to be scanned. [ [#350949](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/350949) [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [4e1da5e8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4e1da5e87281284e021791a4b600a1bff53b8431) - python 3.7 not available for dependecy scanning. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [a6afa766](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a6afa76600e07d40e8b94fa2d8385ad78634e3b0) - increase python version to 3.7 [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [7153f9b4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7153f9b42591e177112d279d2134fc0db1f5a14d) - check python version as pillow 9.0 reported as not found. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [996ee64a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/996ee64ab43f926ca52ab3154ab43e20b6d48fcb) - scanner set to use python 3.6 [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- [725bfaf8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/725bfaf829069002e3b2cb944556d2ce5facb426) - debug logging for dep scanning +- **python_dependency_scan**: [2fffa866](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2fffa866d84f460893c8d9711bc21a74908edb3e) - disabled main job and manual setup for all ci jobs. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **licence_finder**: [83cce72a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/83cce72af22b09bd8a245af99e9134d3be129eac) - set to recursive scan so all licence's can be detected. +- **scanners**: [fc816192](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fc816192be680f64ee1b4b96cccd0d605c529b86) - Added dependency and licence scanners +- [5c872f16](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c872f163e4de5834efd74a78e3e948d242916ec) - Added a test stage for gitlab specific tests. +- **artifacts**: [e0d8885d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e0d8885d52319a6188c779e80c2064b773721184) - markdown lint and mkdocs build artifacts to expire after 24 hours + +### Documentaton / Guides + +- **markdown_lint**: [b6dcb47b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b6dcb47b1d1831784d36f482fd99c0ce5e56f088) - removed no longer needed requirement. +- **markdown_lint**: [fd48316a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fd48316ae763282fc106b7da184c05b35d9ae052) - updated docs on how to use and view rules. +- **mkdocs_build**: [347597e3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/347597e3c1cb20eaa32d1e1cbb2d9d13661a663a) - include mandatory vars in template ci file. +- **mkdocs**: [1ef0e224](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef0e2245facffb760ba2ad9a57af1d6178a2d1a) - Completed the mkdocs build readme [ [#15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/15) [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **markdown_lint**: [6363ea37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6363ea377cd008bbc839e6f4ee4fca337b77bc19) - completed the job docs. [ [#12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/12) ] +- **mkdocs**: [5c05ed76](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c05ed7605ddbecb1a3c7046716afa07829c264f) - initial adding of mkdocs build readme. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) [#5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/5) ] +- **markdown_lint**: [6383cde3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6383cde3bf9985b2cb43908bc2486d1dc67b7026) - initial adding of the docs [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) [#12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/12) ] + +### Features + +- **markdown_lint**: [9ab336fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9ab336fbddd6cba1d29c5a001ab52772ed4554b6) - include junit configuration file '.markdownlint-cli2.jsonc' in ci job. +- **mkdocs_build**: [906f09e2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/906f09e2d3285681bd982d65eda3f56cf5a5169e) - use a pip file for job so that licence scanning can function. +- **mkdocs_build**: [5a41962a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5a41962a994a54d99a3e7ab1bc0d7379ea14c1c2) - move ci job dependencies to a pip file so that the ci dependency job can check versions. +- **build**: [50b5e854](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/50b5e8542b827e6b6cf70f3f4c26b4c1737fe0c1) - initial add of mkdocs build job [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) [#15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/15) ] +- **validation**: [954aa28d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/954aa28dbf1073be05a3dd6d13da818a0bc7cb4e) - Added a Markdown linting validation job. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) [#12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/12) ] + +## v0.5.0 (2022-01-16) + +### Bug Fixes + +- **commit.py**: [73918f2f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/73918f2f5e19440d0e300da3a20712739c316d88) - filter merge request search to 'opened' and on current branch. [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] + +### Continious Integration + +- **MR_Title**: [31517b4b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/31517b4bf00c1f177ef925d09b1a6714577f62c5) - save the merge request title as a variable and debug output in job log. [ [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] + +### Documentaton / Guides + +- **README.md**: [f4670844](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f4670844cc0961bf38fbf760f8eee505a54ab495) - Added project header template [ [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] + +### Features + +- **.yaml_lint_defaults**: [140985c3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/140985c3a4ea07cf30f7fe8c970fb07cc61b776d) - Always run on all branches as this denotes quality. [ [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] +- **commit_footer_refs**: [82c6c9f5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/82c6c9f5d53594544cea9a7bc59a10ab1e9ebedd) - never run on development or master. [ [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] + +## v0.4.0 (2022-01-15) + +### Bug Fixes + +- **commit.py**: [99bdc2a0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/99bdc2a0929d4e7036e50e8ce22ce9b0f90f0736) - fix typo that caused exception [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **conventional_commits**: [d03d9fef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d03d9fefc916dd6730d9ffa778c11d48d621318e) - fetch all branches prior to check for parent branch [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **ci**: [d5782d95](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d5782d95e825d406ea805c425cfefd6752fb6e35) - added variable 'GIT_SUBMODULE_STRATEGY' to be 'recursive' [ [#10](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/10) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **conventional_commits**: [42ad02ee](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/42ad02ee5db65c3c6c33ad14fe0371c9916897bf) - use git show-branch to find origin branch [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/11) ] + +### Features + +- **commit.py**: [e5531fc7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e5531fc77b5bdb1ccc0741e388df2d8d25ba6ade) - throw an error if no token was supplied. i.e. empty variable. [ [#11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/11) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **commit.py**: [6b7ad95f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6b7ad95fc0ccccf79ff645bad3f86660f5096a4e) - confirm a merge request was found, if not output 'ci: No Merge Request found' [ [#11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/11) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **commit.py**: [c543c47a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c543c47af8c7c386ae57f5a7a50904d396758c3a) - try to us `CI_JOB_TOKEN` before the specified token, if any. [ [#11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/11) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **commit.py**: [b01550e0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b01550e09f273edc8a57f4ad4b41ee2d67705d41) - removed ability to fetch first commit or target branch [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] + +## v0.3.1 (2022-01-11) + +### Bug Fixes + +- **pylint**: [4b6cc317](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4b6cc3176fc4acc3b7dbb954162802af9cbb4c68) - install the required packages for files being checked [ [#7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/7) ] +- **pylint**: [936299ae](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/936299aefc6eadf9cbfec3152b352b321969cfab) - fix bug introduced in code quality commit [ [#7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/7) ] +- **commit_footer**: [2ac22c0e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2ac22c0e914016a8944ff9b94640f3e87f409069) - fix bug introduced in code quality commit [ [#7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/7) ] + +### Documentaton / Guides + +- **readme**: [8ac36de8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8ac36de8e0f113ce17d54dfce1345a0adab41bc8) - Updated with an example .gitlab-ci.yml example [ [#2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/2) [!10](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/10) ] + +## v0.3.0 (2021-08-12) + +### BREAKING CHANGE + +- !2 + +### Bug Fixes + +- **commit_message**: [3360a15f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3360a15fde12682edfd9044d2541dc819615b838) - fixed commit message check if there is only one commit to the branch [ [!7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/7) ] +- **commit_footer_refs**: [63af1efb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/63af1efb4fd92a9f8755f766728a18d8f390b805) - Use the current git branch for comparison. [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [f76cabee](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f76cabeeb04b028a231dc1c232862db5fcad4345) - Adjust release workflow [ [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) ] + +### Code Refactor + +- **gitlab_release**: [eb0bf4c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb0bf4c1740dbd7a47ceb031c0d1c854899a1e40) - file link to be in local repository for helping fix commit footer ref check failures [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] +- **gitlab_release**: [81776223](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/81776223c5cb392c12c7ca63488a1df10290e9d1) - use a name for failed test to denote the issue [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] + +### Continious Integration + +- **gitlab_release**: [7cb676eb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7cb676eb98a7de30d47a6b49a87067116684cfd2) - Add a validation job to check if commit messages contain a gitlab reference in the footer [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] + +### Documentaton / Guides + +- **readme**: [0653766c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0653766c935cb117082bfe1481ae83e4a1b2bb5c) - Updated badges and intro [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) ] +- **gitlab_templates**: [9f7a24c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9f7a24c1ebc0bdb5a153977dcb1c53d7ec2fb140) - added issue and merge request templates [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **template**: [da8eb5c3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/da8eb5c3381379f6e405c3ebe14d9a883c52f41a) - added template readme for CI job folders [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **readme**: [ace7a034](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ace7a03456861d59e2f904405f45409c53e831ab) - explain sync and using github to link gitlab-ci [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **readme**: [8790917e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8790917e7d959aa7b8305912bb443ba6b72200c6) - explain repo layout and versioning [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) ] +- **readme**: [19900945](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/19900945e763249b6ef7a9e2e2cbcf11748b1eea) - added how to update gitlab-ci [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) ] +- **readme**: [8a988ebf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8a988ebf09015211f8f6566acc0ba71c1f00bee1) - Added how to use this repository [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) ] +- **gitlab_release**: [dc13d4f2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/dc13d4f2841038c085dcf29dfb0b0c5d2f00f099) - Added user docs to fix errors from ci job 'commit footer refs' [ [#3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/3) [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] +- **changelog**: [35edb7cf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/35edb7cfc59e2d147bdb5cb5d03710ec747073ae) - Updated changelog to new layout [ [!3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/3) [#3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/3) ] +- **gitlab_release**: [5f273ce2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5f273ce23a331eaf11623207ec4aba8b856c14f0) - Updated docs with new instructions on version incrementing [ [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) ] + +### Features + +- **python_linting**: [d6105624](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d61056243804728e059b99fce1644a8cc37230bb) - added ci job, python linting, code quality and scoring [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **yaml_lint**: [d20a56fa](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d20a56fa0ca492e3fc2ad7c548fc891cc8ffc8ec) - Added job yaml lint for checking yaml files [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [22136f7d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/22136f7dd22b9487d362a7ed63ca1b76e52b9cc7) - Toggle var added to enable switching changelog references. [ [#3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/3) ] +- **gitlab_release**: [756b9406](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/756b9406dde8cf0bf0030ac72855a054ece3a883) - be able to toggle commit footer check job [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] +- **gitlab_release**: [11e15661](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/11e156619d0d820e534897bafd5f39e6f9defcbf) - python module to check if a commit message has gitlab references in the footer [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] +- **gitlab_release**: [8699c412](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8699c41219d70e6f41f42dc7f2c1bcf542b3f723) - Add commit footer to changelog [ [!1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/1) [#3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/3) ] + +## v0.3.0rc1 (2021-08-04) + +### Documentaton / Guides + +- **changelog**: [cb78ab82](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/cb78ab82182a9edcd568a8b4c315490041539149) - regenerated so that all entries use the new url format [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +## v0.3.0rc0 (2021-08-04) + +### Code Refactor + +- **gitlab_release**: [cc3fabda](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/cc3fabdaa28f97c3e1600e4a0d95a05bb547e772) - Use Short commit SHA1 in main changelog link to gitlab [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Features + +- **gitlab_release**: [3e8c3ce7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3e8c3ce7cd64a6e9110818d32c15c3602fefb76c) - On the development brnach, releases to be 'rc' to denote considered non-stable [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +## v0.2.1 (2021-08-04) + +### Bug Fixes + +- **gitlab_release**: [588698df](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/588698df2668853a97fe60901ab324310f34f279) - Correctly fetch the CI_PROJECT_URL for the environment + +## v0.2.0 (2021-08-04) + +### Code Refactor + +- **gitlab_release**: [7a69685b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7a69685b53cbe5bd7341a176bf63fd17d36bc7f0) - Dont conduct any release, git push or tag delete if the version was not bumped +- **gitlab_release**: [72e8b6c8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/72e8b6c84defdb903c5741e3469651987769713f) - build gitlab commit url for changelog so that there is a weblink to the changes [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Documentaton / Guides + +- **gitlab_release**: [eebe8e30](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eebe8e30dcb11cd239f35fcb98216b2ae4d20ece) - Include custom command instructions [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Features + +- **gitlab_release**: [287b4c95](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/287b4c954dddfaaf0a66af387676ea438cc80e61) - Include code refactor as part of the changelog [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +## v0.1.0 (2021-08-04) + +### Bug Fixes + +- **gitlab_release**: [80ca3618](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/80ca3618ee56d0f2a2c012416cb6206599a4f3f6) - A 'feat' commit must do a MINOR bump to version [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [ed5be7fd](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ed5be7fd3c16e86d48e179a2cded53a38f79e1d9) - ci image is alpine, use '/bin/sh' and add the changlogs to git cache for commiting [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [7706085b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7706085b09f3cd9b7c09f7f93b182fd425f6525a) - All tasks run as part of script including user custom script [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [1446c28e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1446c28ed2bfe2efec99bc2fc83b111717bcb2af) - Use a user token to access the git repo for pushing commits back [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **ansible**: [2a3266fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2a3266fb537e22dddf47708d0af101945027128f) - Ensure the default ci directory is populated [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Code Refactor + +- **gitlab_release**: [2035ed27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2035ed27af7fc1f3f5b2c42aa5874219fc5fe323) - use 'git log' to get current commit hash [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Continious Integration + +- **git_push_mirror**: [b5935056](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b593505698b3d3359569f29f97c90e17e211f304) - Push repo to github NoFussComputing/gitlab-gi [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **conventional_commits**: [a2174104](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a2174104d1eb05d329bacd44700bf81ac709dcac) - Add conventional commits job to check commits and MR titles [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Documentaton / Guides + +- **README.md**: [247264e3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/247264e36bc0b6c86d2f06f8dae09ff7447fc156) - Added readme for the repo [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **git_push_mirror**: [7ffb2041](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7ffb20418cfa8e6fa20cca60e42155171961d1ce) - Update workflow and typos [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Features + +- **job_changelog**: [1ecd857c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ecd857c0bf8ef009ad2482ad1d52604adadc0ed) - Create a changelog per job folder [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **git_release**: [6678a3db](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6678a3dbab2763addc185e766cbaffbc074a6e98) - Migrated from ansible-roles [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **ansible**: [2413daef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2413daefb1e7e5a9e7a3cbb2d8cff2214f4a98ae) - Added ansible validation job for linting [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **git_push_mirror**: [9b28ae59](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9b28ae5952adfb3d61e660814074ad3c7b42ff61) - Added a job that syncs to a remote git repo [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **conventional_commits**: [392a200f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/392a200fd469c4161dbab5f2b59031a7a64f20a2) - Added conventional commit job [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +## v0.0.1 (2021-08-03) diff --git a/gitlab-ci/LICENSE b/gitlab-ci/LICENSE new file mode 100644 index 00000000..08f796d7 --- /dev/null +++ b/gitlab-ci/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2021 No Fuss Computing + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/gitlab-ci/README.md b/gitlab-ci/README.md new file mode 100644 index 00000000..5cbadf39 --- /dev/null +++ b/gitlab-ci/README.md @@ -0,0 +1,73 @@ +
+ +# No Fuss Computing - Gitlab-CI + +
+ +![Project Status - Active](https://img.shields.io/badge/Project%20Status-Active-green?logo=gitlab&style=plastic) + +
+ +![Gitlab forks count](https://img.shields.io/badge/dynamic/json?label=Forks&query=%24.forks_count&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2F&color=ff782e&logo=gitlab&style=plastic) ![Gitlab stars](https://img.shields.io/badge/dynamic/json?label=Stars&query=%24.star_count&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2F&color=ff782e&logo=gitlab&style=plastic) [![Open Issues](https://img.shields.io/badge/dynamic/json?color=ff782e&logo=gitlab&style=plastic&label=Open%20Issues&query=%24.statistics.counts.opened&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2Fissues_statistics)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues) + +![GitHub forks](https://img.shields.io/github/forks/NoFussComputing/gitlab-ci?logo=github&style=plastic&color=000000&labell=Forks) ![GitHub stars](https://img.shields.io/github/stars/NoFussComputing/gitlab-ci?color=000000&logo=github&style=plastic) ![Github Watchers](https://img.shields.io/github/watchers/NoFussComputing/gitlab-ci?color=000000&label=Watchers&logo=github&style=plastic) + +
+ +This project is hosted on [Gitlab](https://gitlab.com/nofusscomputing/projects/gitlab-ci) and has a read-only copy hosted on [Github](https://github.com/NoFussComputing/gitlab-ci). + + +---- + +**Stable Branch** + +![Gitlab build status - stable](https://img.shields.io/badge/dynamic/json?color=ff782e&label=Build&query=0.status&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2Fpipelines%3Fref%3Dmaster&logo=gitlab&style=plastic) ![branch release version](https://img.shields.io/badge/dynamic/yaml?color=ff782e&logo=gitlab&style=plastic&label=Release&query=%24.commitizen.version&url=https%3A%2F%2Fgitlab.com%2Fnofusscomputing%2Fprojects%2Fgitlab-ci%2F-%2Fraw%2Fmaster%2F.cz.yaml) [![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%2Fmaster%2Fraw%2Fartifacts%2Fvalidation%2FPyLint%2Fbadge_pylint.json%3Fjob%3DPyLint)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/jobs/artifacts/master/file/artifacts/validation/tests/gl-code-quality-report.html?job=PyLint) + +---- + +**Development Branch** + +![Gitlab build status - development](https://img.shields.io/badge/dynamic/json?color=ff782e&label=Build&query=0.status&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2Fpipelines%3Fref%3Ddevelopment&logo=gitlab&style=plastic) ![branch release version](https://img.shields.io/badge/dynamic/yaml?color=ff782e&logo=gitlab&style=plastic&label=Release&query=%24.commitizen.version&url=https%3A%2F%2Fgitlab.com%2Fnofusscomputing%2Fprojects%2Fgitlab-ci%2F-%2Fraw%2Fdevelopment%2F.cz.yaml) [![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) + +---- + +
+ +
+ +links: + +- [Issues](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues) + +- [Merge Requests (Pull Requests)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests) + + +## Using this repository for your Gitlab CI/CD Jobs. + +This repository has been designed as a central point for your repositories CI/CD jobs. By simply linking this repository to your repository and configuring, your CI/CD jobs will run as part of the build process, whilst keeping any CI/CD commits limited within your git history. + +Each CI/CD job is contained within its own sub-folder. Each sub-folder has a readme specific to the job, which includes the details on how to implement, use etc. + +For further details on using these templates with your Gitlab CI/CD jobs, pleaase view the [documentation](https://nofusscomputing.com/projects/gitlab-ci). + + +### gitlab-ci repository layout + +We use the following branches *(these jobs assume you do as well)*: + - `master` - Considered as the stable branch + - `development` considered as unstable + +We also tag each branch to denote the version of release. We use our own repo to do the version increment automagically in line with [semantic versioning](https://semver.org/). + + +## Contributing + +All contributions for this project must conducted from [Gitlab](https://gitlab.com/nofusscomputing/projects/gitlab-ci). + +For further details on contributing please refer to the [contribution guide](CONTRIBUTING.md). + + +## Other + +This repo is release under this [license](LICENSE) + diff --git a/gitlab-ci/anchors/conditions.yaml b/gitlab-ci/anchors/conditions.yaml new file mode 100644 index 00000000..824cfb39 --- /dev/null +++ b/gitlab-ci/anchors/conditions.yaml @@ -0,0 +1,70 @@ +--- + +.condition_dev_branch_push: &condition_dev_branch_push # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + +.condition_master_branch_push: &condition_master_branch_push # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + +.condition_not_master_or_dev_push: &condition_not_master_and_dev_push # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + +.condition_master_or_dev_push: &condition_master_or_dev_push # condition_master_or_dev_push + ( + $CI_COMMIT_BRANCH == "master" || + $CI_COMMIT_BRANCH == "development" + )&& + $CI_PIPELINE_SOURCE == "push" + +.condition_git_tag: &condition_git_tag # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + +.condition_any_branch_push: &condition_any_branch_push # condition_any_branch_push + $CI_COMMIT_BRANCH != null && + $CI_COMMIT_TAG == null && + $CI_PIPELINE_SOURCE == "push" + + + + + + + + +.rules_commit_develop_branch: &when_commit_develop_branch + - if: # on dev branch + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + changes: + paths: + <<: *repository_change_files + compare_to: 'master' + exists: + <<: *repository_exists_files + when: always + + - if: # not on master or dev + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + changes: + paths: + <<: *repository_change_files + compare_to: 'development' + exists: + - dockerfile + - dockerfile.j2 + when: always + + - if: # tagged pipeline + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - dockerfile + - dockerfile.j2 + when: on_success diff --git a/gitlab-ci/ansible/collection/.gitlab-ci.yml b/gitlab-ci/ansible/collection/.gitlab-ci.yml new file mode 100644 index 00000000..510792f2 --- /dev/null +++ b/gitlab-ci/ansible/collection/.gitlab-ci.yml @@ -0,0 +1,662 @@ +--- + +variables: + ANSIBLE_GALAXY_UPLOAD_TOKEN: "" # Mandatory, String. The token to upload to ansible galaxy. DONT SET HERE, USE PIPELINE VARIABLES. + ANSIBLE_GALAXY_SERVER_URL: https://galaxy.ansible.com # Optional, default=(as displayed)String. URL to the Galaxy server for uploads + ANSIBLE_GALAXY_NAMESPACE: "" # Mandatory, String. The ansible galaxy upload namespace + ANSIBLE_GALAXY_PACKAGE_NAME: "" # Mandatory, String. The Ansible Galaxy package name + + +.ansible_collection_merge: + stage: chores + image: python:3.11-bookworm + before_script: + - | # Create artifact directory + mkdir -p artifacts + + - | # Install Pre-req packages + apt update; + + apt install -y --no-install-recommends \ + curl \ + git; + + # ToDo: Install python deps + - | + pip install \ + commitizen==3.14.1 + + - | # setup git user + git config --global user.email "helpdesk@nofusscomputing.com"; + git config --global user.name "nfc_bot"; + + - | # Update origin using gitlab token + echo "Current git origin"; + + git remote -v; + + git remote remove origin; + + echo "Removed origin"; + + git remote add origin https://gitlab-ci-token:$GIT_COMMIT_TOKEN@gitlab.com/$CI_PROJECT_PATH.git; + + echo "Add origin with auth"; + + git remote -v; + + - | # fetch repo details + git fetch -fpv; + + - | # switch to dev branch + git switch development; + + - | # pull dev branch + git pull origin development --rebase + + - | # Init git sub-modules + git submodule update --init + + + script: + + + - | # Store old version number + export OLD_VERSION=$(cz version --project); + echo "Trace - OLD_VERSION[$OLD_VERSION]" + + # rc codes https://commitizen-tools.github.io/commitizen/exit_codes/ + - | # Bump the version + + if [ "0${VERSION_BUMP_INCREMENT}" != '0' ]; then + + export BUMP_INCREMENT="--increment ${VERSION_BUMP_INCREMENT}"; + + fi; + + if [ $CI_COMMIT_BRANCH == "development" ]; then + + cz bump \ + --files-only \ + --yes \ + ${BUMP_INCREMENT} \ + --prerelease alpha \ + + + export VERSION_BUMPED=$? + + elif [ $CI_COMMIT_BRANCH == "master" ]; then + + cz bump \ + --files-only \ + ${BUMP_INCREMENT} \ + --yes + + export VERSION_BUMPED=$? + + else + + echo "Something went wrong with creating the release"; + exit 1; + + fi; + + echo "Trace - VERSION_BUMPED[$VERSION_BUMPED]" + + - | # Store new version number + if [ "0$VERSION_BUMPED" == "00" ]; then + + export NEW_VERSION=$(cz version --project) + + echo "Trace - NEW_VERSION[$NEW_VERSION]" + + fi; + + - | # git stage .cz.yaml + if [ "0$VERSION_BUMPED" == "00" ]; then + + git add .cz.yaml; + + echo "git staged .cz.yaml"; + + git status; + + fi; + + - | # Update version in galaxy file + if [ "0$VERSION_BUMPED" == "00" ]; then + + sed -E "s/version: (.+)/version: ${NEW_VERSION}/g" -i galaxy.yml + + fi; + + - | # git stage galaxy.yml + if [ "0$VERSION_BUMPED" == "00" ]; then + + git add galaxy.yml + + echo "git staged galaxy.yml"; + + git status; + + fi; + + - | # changelog since last version - for development branch + echo "changelog since last version - for development branch"; + + if [ "0$VERSION_BUMPED" == "00" ]; then + + cz changelog --incremental --dry-run --unreleased-version "${NEW_VERSION}" > artifacts/incremental_changelog.txt + + ls -lR artifacts/ + + fi; + + - | # store incremental changelog since last version + echo "store incremental changelog since last version"; + + if [ "0$VERSION_BUMPED" == "00" ]; then + + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/incremental_changelog.txt \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/incremental_changelog.txt" + + fi; + + - | # complete changelog since last normal release - for master branch + echo "complete changelog since last normal release - for master branch"; + + if [ "0$VERSION_BUMPED" == "00" ]; then + + cz changelog --merge-prerelease --dry-run --unreleased-version "${NEW_VERSION}" > artifacts/full_changelog.txt + + fi; + + - | # store full changelog (merge-prerelease) + if [ "0$VERSION_BUMPED" == "00" ]; then + + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/full_changelog.txt \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/full_changelog.txt" + + fi; + + - | # Update CHANGELOG.md + if [ "0$VERSION_BUMPED" == "00" ]; then + + if [ $CI_COMMIT_BRANCH == "development" ]; then + + cz changelog --incremental --unreleased-version "${NEW_VERSION}"; + + elif [ $CI_COMMIT_BRANCH == "master" ]; then + + cz changelog --merge-prerelease --unreleased-version "${NEW_VERSION}"; + + else + + echo "This job should only run on 'development' and 'master' branches"; + exit 1; + + fi; + + fi; + + - | # Create release notes + if [ "0$VERSION_BUMPED" == "00" ]; then + + if [ $CI_COMMIT_BRANCH == "development" ]; then + + cp artifacts/incremental_changelog.txt artifacts/release_notes.md + + elif [ $CI_COMMIT_BRANCH == "master" ]; then + + cp artifacts/full_changelog.txt artifacts/release_notes.md + + else + + echo "This job should only run on 'development' and 'master' branches"; + exit 1; + + fi; + + fi; + + - | # Store Release notes + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/release_notes.md \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/release_notes.md"; + + - | # git stage CHANGELOG.md + if [ "0$VERSION_BUMPED" == "00" ]; then + + git add CHANGELOG.md; + + echo "git staged CHANGELOG.md"; + + git status; + + fi; + + - | # Custom commands from RELEASE_ADDITIONAL_ACTIONS_BUMP + if [ -f ${RELEASE_ADDITIONAL_ACTIONS_BUMP} ]; then + + echo "Custom commands found in variable RELEASE_ADDITIONAL_ACTIONS_BUMP"; + + chmod +x ${RELEASE_ADDITIONAL_ACTIONS_BUMP}; + + echo '------------------------------ TRACE SoF ------------------------------'; + + echo "File: RELEASE_ADDITIONAL_ACTIONS_BUMP[${RELEASE_ADDITIONAL_ACTIONS_BUMP}]"; + + echo '------ contents ------'; + + echo ""; + + cat ${RELEASE_ADDITIONAL_ACTIONS_BUMP}; + + echo ""; + + echo '------ contents ------'; + + echo ""; + + ${RELEASE_ADDITIONAL_ACTIONS_BUMP}; + + echo ""; + + echo "git reset edited file: ${RELEASE_ADDITIONAL_ACTIONS_BUMP}"; + + git restore ${RELEASE_ADDITIONAL_ACTIONS_BUMP}; + + git status + + echo '------------------------------ TRACE EoF ------------------------------' + fi; + + # - | # Find merge request ID + # echo "Trace CI_OPEN_MERGE_REQUESTS[${CI_OPEN_MERGE_REQUESTS}]"; + + # if grep -q "," <<< "$CI_OPEN_MERGE_REQUESTS"; then + + # export MERGE_REQUEST_FOUND=$(echo "${CI_OPEN_MERGE_REQUESTS}" | cut -d "," -f 1 | cut -d '!' -f 2); + + # else + + # export MERGE_REQUEST_FOUND=$(echo "${CI_OPEN_MERGE_REQUESTS}" | cut -d '!' -f 2); + + # fi + + # echo "Trace MERGE_REQUEST_FOUND[${MERGE_REQUEST_FOUND}]"; + + # if [ "$CI_MERGE_REQUEST_IID" ]; then + + # export MERGE_REQUEST_FOUND=${CI_MERGE_REQUEST_IID} + + # echo "Using CI_MERGE_REQUEST_IID[${CI_MERGE_REQUEST_IID}] as value for MERGE_REQUEST_FOUND"; + + # fi + + - | # Find merge request ID + echo "Trace CI_OPEN_MERGE_REQUESTS[${CI_OPEN_MERGE_REQUESTS}]"; + + echo "Trace CI_MERGE_REQUEST_IID[${CI_MERGE_REQUEST_IID}]"; + + export MERGE_REQUEST_FOUND=$(git log -1 | grep -E '\!(.+)' | cut -d '!' -f 2); + + echo "Trace MERGE_REQUEST_FOUND[${MERGE_REQUEST_FOUND}]"; + + - | # commit any changes + if [ "0$VERSION_BUMPED" == "00" ]; then + + git status; + + echo "commit changes to repo" + + cat < ${NEW_VERSION} + + !${MERGE_REQUEST_FOUND} + EOF + + fi; + + - | # Store the changes commit for the tag + export CHANGE_COMMIT=$(git log -n1 --format=format:"%H") + + echo "Trace - CHANGE_COMMIT[$CHANGE_COMMIT]" + + if [ "${CI_COMMIT_SHA}" == "${CHANGE_COMMIT}" ]; then + + echo "No changes appear to have been commited!" + + exit 1; + + fi; + + git log -3; + + + - | # create git tag, if changed + if [ "0$VERSION_BUMPED" == "00" ]; then + + git tag -m "$(cat artifacts/incremental_changelog.txt)" ${NEW_VERSION} ${CHANGE_COMMIT}; + + fi; + + - | # push development to origin + if [ "0$VERSION_BUMPED" == "00" ]; then + + git push --set-upstream origin development + + fi; + + - | # merge bump changes to master + if [ "0$VERSION_BUMPED" == "00" ]; then + + if [ $CI_COMMIT_BRANCH == "master" ]; then + + echo "Trace Checkout master branch"; + git checkout master; + + echo "Trace merge changes from development branch"; + git merge --no-ff development; + + echo "Trace push changes to origin"; + git push origin master; + + fi; + + fi; + + - | # store metadata for use in later stages + if [ "0$VERSION_BUMPED" == "00" ]; then + + cat < artifacts/metadata.env + + export CHANGE_COMMIT=${CHANGE_COMMIT} + + export MERGE_REQUEST_FOUND=${MERGE_REQUEST_FOUND} + + export NEW_VERSION=${NEW_VERSION} + + export OLD_VERSION=${CURRENT_VERSION} + + export VERSION_BUMPED=${VERSION_BUMPED} + + EOF + + chmod +x artifacts/metadata.env; + + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/metadata.env \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/metadata.env"; + + fi; + + - | # Create Version Label + if [ "$CREATE_VERSION_LABEL" != "false" ]; then + + curl \ + --data "name=v${NEW_VERSION}&color=#eee600&description=Version%20that%20is%20affected" \ + --header "PRIVATE-TOKEN: $GIT_COMMIT_TOKEN" \ + "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/labels" + + fi; + + - | # push git tag to origin + if [ "0$VERSION_BUMPED" == "00" ]; then + + git push --tags + + fi; + + artifacts: + untracked: false + when: always + expire_in: "3 days" + paths: + - "artifacts/*" + rules: + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "development" + && + $CI_PIPELINE_SOURCE == "push" + allow_failure: true + when: manual + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "master" + && + ( + $CI_PIPELINE_SOURCE == "push" + || + $CI_PIPELINE_SOURCE == "web" + ) + when: always + + - when: never + + +# Feature Branch / git tag +.ansible_collection_build: + stage: build + image: python:3.11-bookworm + before_script: + - | # Exit if mandatory variables not defined. On the first job in the pipeline for release. + if [ "$CI_COMMIT_TAG" ]; then + + if [ "0$ANSIBLE_GALAXY_UPLOAD_TOKEN" == "0" ]; then + + echo variable ANSIBLE_GALAXY_UPLOAD_TOKEN must be set; + exit 1; + + fi; + + if [ "0$ANSIBLE_GALAXY_NAMESPACE" == "0" ]; then + + echo variable ANSIBLE_GALAXY_NAMESPACE must be set; + exit 1; + + fi; + + if [ "0$ANSIBLE_GALAXY_PACKAGE_NAME" == "0" ]; then + + echo variable ANSIBLE_GALAXY_PACKAGE_NAME must be set; + exit 1; + + fi; + + fi + + - | # Install python deps + pip install \ + ansible==9.2.0 + + - | # Setup git to be on the tagged commit + if [ "${CI_COMMIT_TAG}" ]; then + + echo "setting up git to be on revision ${CI_COMMIT_TAG}"; + + git log -2; + + git fetch -fpvt; + + git pull origin development --rebase; + + git checkout tags/${CI_COMMIT_TAG} -b development; + + git log -2; + + fi; + + script: + + - | # Build the collection + ansible-galaxy collection build . --verbose --force --output-path artifacts/galaxy/ + + artifacts: + untracked: false + when: on_success + expire_in: "3 days" + paths: + - "artifacts/*" + rules: + + - if: $CI_COMMIT_TAG + when: on_success + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "development" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - if: + $CI_COMMIT_BRANCH != "development" + && + $CI_COMMIT_BRANCH != "master" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + + - when: never + + +# store built package in generic package registry +.ansible_collection_stage_package: + stage: prepare + image: curlimages/curl:latest + variables: + GIT_STRATEGY: none + environment: + name: Gitlab Package Registry + url: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/ + script: + - | # Store collection + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/galaxy/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz" + + - | # Fetch Release Notes + mkdir -p artifacts; + + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + -o artifacts/release_notes.md \ + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/release_notes.md + + echo "Release notes fetched"; + + ls -lR artifacts/ + + artifacts: + untracked: false + when: on_success + expire_in: "3 days" + paths: + - "artifacts/*" + rules: + + - if: $CI_COMMIT_TAG + when: on_success + + - when: never + + +# Only on git tag +.ansible_collection_release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + variables: + GIT_STRATEGY: none + script: + + - ls -lR artifacts/ + + release: + tag_name: $CI_COMMIT_TAG + description: ./artifacts/release_notes.md + name: $CI_COMMIT_TAG + assets: + links: + - name: 'Ansible Galaxy' + url: https://galaxy.ansible.com/ui/repo/published/${ANSIBLE_GALAXY_NAMESPACE}/${ANSIBLE_GALAXY_PACKAGE_NAME}/?version=${CI_COMMIT_TAG} + + - name: ${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz + url: https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz + link_type: package + + - name: 'Docker Image: ${DOCKER_IMAGE_PUBLISH_REGISTRY}/${DOCKER_IMAGE_PUBLISH_NAME}:${CI_COMMIT_TAG}' + url: ${DOCKER_IMAGE_PUBLISH_URL} + link_type: package + + - name: Documentation + url: https://nofusscomputing.com/${PAGES_ENVIRONMENT_PATH} + milestones: + - $CI_MERGE_REQUEST_MILESTONE + rules: + + - if: $CI_COMMIT_TAG + when: on_success + + - when: never + + +# Only on git tag +.ansible_collection_publish_galaxy: + stage: publish + image: python:3.11-bookworm + variables: + GIT_STRATEGY: none + ANSIBLE_GALAXY_SERVER_URL: https://galaxy.ansible.com + environment: + name: Ansible Galaxy + url: https://galaxy.ansible.com/ui/repo/published/${ANSIBLE_GALAXY_NAMESPACE}/${ANSIBLE_GALAXY_PACKAGE_NAME}/ + before_script: + + - | # Install python deps + pip install \ + ansible + + pip list; + + - | # Prepare filename for package + # mkdir -p artifacts/galaxy; + + # mv collection.tar.gz artifacts/galaxy/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz + + # echo "Prepare filename to be in the correct format"; + + ls -lR artifacts; + + script: + - | # Publish package to Ansible Galaxy + ansible-galaxy collection publish \ + --server ${ANSIBLE_GALAXY_SERVER_URL} \ + --token ${ANSIBLE_GALAXY_UPLOAD_TOKEN} \ + --verbose artifacts/galaxy/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz + artifacts: + untracked: false + when: on_success + expire_in: "3 days" + paths: + - "artifacts/*" + rules: + + - if: $CI_COMMIT_TAG + when: on_success + + - when: never \ No newline at end of file diff --git a/gitlab-ci/ansible/collection/ci-test.gitlab-ci.yml b/gitlab-ci/ansible/collection/ci-test.gitlab-ci.yml new file mode 100644 index 00000000..aa2e8599 --- /dev/null +++ b/gitlab-ci/ansible/collection/ci-test.gitlab-ci.yml @@ -0,0 +1,63 @@ +# Ansible Collection Unit Test: # what would the unit tests be?? + +# stage: test +# before_script: + +# - echo. #install deps + +# script: + +# - echo. # what???? + + +Ansible Collection Functional Test: + + stage: test + + # ToDo: refactor lint jobs to be individual so that pipeline linking can occur + # needs: + # - Ansible Collection CI Lint + + parallel: + matrix: + - NFC_CI_FUNCTIONAL_TEST: "push" + NFC_CI_FUNCTIONAL_TEST_BRANCH: feature + - NFC_CI_FUNCTIONAL_TEST: "merge" + NFC_CI_FUNCTIONAL_TEST_BRANCH: development + - NFC_CI_FUNCTIONAL_TEST: "release" + NFC_CI_FUNCTIONAL_TEST_BRANCH: development + - NFC_CI_FUNCTIONAL_TEST: "push" + NFC_CI_FUNCTIONAL_TEST_BRANCH: development + - NFC_CI_FUNCTIONAL_TEST: "merge" + NFC_CI_FUNCTIONAL_TEST_BRANCH: master + + script: + + - echo "to be created"; + + # ToDo: run ansible playbook to setup, run and wait for each stage + + # ToDo: create build artifact for use with creating a badge for tests, per branch + + artifacts: + untracked: true + when: on_success + expire_in: "90 days" + resource_group: ansible_collection_functional_test + rules: + # turn off until created + - when: never + + - if: # development/feature branch + $CI_COMMIT_BRANCH != "master" && + $CI_PIPELINE_SOURCE == "push" + changes: + paths: + - 'ansible/collection/*.yml' + compare_to: 'development' + when: always + + - if: # master branch + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + when: always diff --git a/gitlab-ci/automation/.gitlab-ci-ansible.yaml b/gitlab-ci/automation/.gitlab-ci-ansible.yaml new file mode 100644 index 00000000..11e2770d --- /dev/null +++ b/gitlab-ci/automation/.gitlab-ci-ansible.yaml @@ -0,0 +1,174 @@ +--- +# This yaml is intended to run ansible jobs using nfc's ansible-ee image + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + + +.ansible_playbook: + image: + name: nofusscomputing/ansible-ee:dev + pull_policy: always + stage: chores + variables: + ansible_inventory: '' + ansible_playbook: '' + ansible_tags: '' + ANSIBLE_FORCE_COLOR: 'true' + script: + - if [ "0$ansible_inventory" != '0' ]; then ansible_inventory=-i $ansible_inventory; fi + - if [ "0$ansible_tags" != '0' ]; then ansible_tags=$(echo -n "--tags $ansible_tags"); fi + - echo "[DEBUG] ansible_inventory=$ansible_inventory" + - echo "[DEBUG] ansible_playbook=$ansible_playbook" + - echo "[DEBUG] ansible_tags=$ansible_tags" + - ansible-playbook $ansible_inventory $ANSIBLE_PLAYBOOK_DIR/$ansible_playbook $ansible_tags --extra-vars "nfc_pb_host=localhost" -vvv + rules: + # ToDo: at some stage redefine these rules so that the job can run if specified. + # - if: '$NFC_AUTO_JOBS == "false"' + # when: never + + # - if: '$CI_PIPELINE_SOURCE == "schedule" && $PIPELINE_RUN_SCHEDULE == "true"' + # exists: + # - ".nfc_automation.yaml" + # when: always + + # - if: + # ( + # $CI_PIPELINE_SOURCE == "api" + # || + # $CI_PIPELINE_SOURCE == "pipeline" + # || + # $CI_PIPELINE_SOURCE == "trigger" + # || + # $CI_PIPELINE_SOURCE == "parent_pipeline" + # ) && + # $PIPELINE_RUN_TRIGGER == "true" + # exists: + # - ".nfc_automation.yaml" + # when: always + + + # - if: # condition_dev_branch_push + # $CI_COMMIT_BRANCH == "development" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - ".nfc_automation.yaml" + # when: always + + # # this if for testing only + # # - if: '$CI_PIPELINE_SOURCE == "push"' + # # when: always + # # exists: + # # - ".nfc_automation.yaml" + - when: never + + +.ansible_playbook_git_submodule: + extends: .ansible_playbook + variables: + ansible_playbook: 'git_configuration.yaml' + ansible_tags: 'submodule' + rules: + - if: '$NFC_AUTO_JOBS == "false"' + when: never + + - if: '$CI_PIPELINE_SOURCE == "schedule" && $PIPELINE_RUN_SCHEDULE == "true"' + exists: + - ".nfc_automation.yaml" + when: always + + - if: + ( + $CI_PIPELINE_SOURCE == "api" + || + $CI_PIPELINE_SOURCE == "pipeline" + || + $CI_PIPELINE_SOURCE == "trigger" + || + $CI_PIPELINE_SOURCE == "parent_pipeline" + ) && + $PIPELINE_RUN_TRIGGER == "true" + exists: + - ".nfc_automation.yaml" + when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_TAG == null && + $CI_COMMIT_BRANCH == "development" && + $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && + $CI_PIPELINE_SOURCE != "push" + exists: + - ".nfc_automation.yaml" + when: always + + # this if for testing only + # - if: '$CI_PIPELINE_SOURCE == "push"' + # when: always + # exists: + # - ".nfc_automation.yaml" + - when: never + + +.submodule_update_trigger: + stage: publish + # trigger: + # project: $SUBMODULE_UPDATE_TRIGGER_PROJECT + # branch: development + # inherit: + # variables: false + script: + # use script to trigger pipeline instead of trigger keyword. + # this is due to trigger keyword not allowing environment keyword. + - export TRIGGER_PROJECT_PATH=$(python3 -c "import urllib.parse, sys; print('$SUBMODULE_UPDATE_TRIGGER_PROJECT'.replace('/', '%2F'))") + - echo "[DEBUG] TRIGGER_PROJECT_PATH=$TRIGGER_PROJECT_PATH" + - | + curl \ + --request POST \ + --form "token=$CI_JOB_TOKEN" \ + --form ref=development \ + --form "variables[GIT_CONFIG_SUBMODULE_NAME]=$GIT_CONFIG_SUBMODULE_NAME" \ + --form "variables[PIPELINE_RUN_TRIGGER]=$PIPELINE_RUN_TRIGGER" \ + --form "variables[GIT_COMMIT_TYPE]=$GIT_COMMIT_TYPE" \ + --form "variables[GIT_COMMIT_TYPE_CATEGORY]=$GIT_COMMIT_TYPE_CATEGORY" \ + "https://gitlab.com/api/v4/projects/$TRIGGER_PROJECT_PATH/trigger/pipeline" + environment: + name: $SUBMODULE_UPDATE_TRIGGER_PROJECT + url: https://gitlab.com/$SUBMODULE_UPDATE_TRIGGER_PROJECT + variables: + PIPELINE_RUN_TRIGGER: 'true' + GIT_CONFIG_SUBMODULE_NAME: $CI_PROJECT_NAME + rules: + - if: # condition_master_or_dev_push + ( + $CI_COMMIT_BRANCH == "master" || + $CI_COMMIT_BRANCH == "development" + ) && + $CI_PIPELINE_SOURCE == "push" && + $CI_COMMIT_TAG == null + when: on_success + + - when: never + + +.ansible_playbook_mr_from_issue_comment_patch: + extends: .ansible_playbook + variables: + ansible_playbook: 'git_configuration.yaml' + ansible_tags: 'gitlab_issue_patches' + PIPELINE_RUN_TRIGGER: 'false' + PIPELINE_RUN_SCHEDULE: 'false' + needs: [] + rules: + - if: '$NFC_AUTO_JOBS == "false"' + when: never + - if: + $CI_COMMIT_TAG == null && + $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && + $CI_PIPELINE_SOURCE != "push" && + $CI_COMMIT_BRANCH != 'master' && + $CI_COMMIT_BRANCH != 'automated-tasks' && + $CI_COMMIT_BRANCH == 'development' + exists: + - ".nfc_automation.yaml" + when: always + - when: never diff --git a/gitlab-ci/automation/CHANGELOG.md b/gitlab-ci/automation/CHANGELOG.md new file mode 100644 index 00000000..57b5de2c --- /dev/null +++ b/gitlab-ci/automation/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +2023-05-27 15:20:40 +0930 [f9af921](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f9af921e6b6ec10f9f77ec6a016c6cbb9559d1bf) - refactor(ansible_playbook): final logic adjustment for job +2023-05-27 14:04:10 +0930 [1f6ee9e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1f6ee9ea27824df1c82bf85e1e239f57f2145bdf) - refactor(automation): final logic changes +2023-05-26 16:29:23 +0930 [0d3eaa6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0d3eaa6ac2dc448505b18c6aecd4a72e28ffde83) - feat(automation): job to run ansible playbooks diff --git a/gitlab-ci/conventional_commits/.gitlab-ci.yml b/gitlab-ci/conventional_commits/.gitlab-ci.yml new file mode 100644 index 00000000..77fd2dc4 --- /dev/null +++ b/gitlab-ci/conventional_commits/.gitlab-ci.yml @@ -0,0 +1,78 @@ + +.conventional_commit: + variables: + DEFAULT_ROOT_DIR: './gitlab-ci' + image: python:3.6-slim + stage: validation + before_script: + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - if [ "0$MR_ACCESS_TOKEN" == "0" ]; then MR_ACCESS_TOKEN=$CI_JOB_TOKEN; fi + - echo "[DEBUG] MR_ACCESS_TOKEN[$MR_ACCESS_TOKEN]" + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - if [ "0$MY_PROJECT_ID" == "0" ]; then PROJECT_ID=$CI_PROJECT_ID; else PROJECT_ID=$MY_PROJECT_ID ; fi + - echo "[DEBUG] PROJECT_ID[$PROJECT_ID]" + - export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'` + - apt update + - apt install --no-install-recommends -y git + - python3 -m venv env + - . env/bin/activate + - pip install --upgrade pip + - pip install -r $ROOT_DIR/conventional_commits/requirements.txt + - echo "[DEBUG] CI_PROJECT_ID[$CI_PROJECT_ID]" + - echo "[DEBUG] CI_COMMIT_BRANCH[$CI_COMMIT_BRANCH]" + - git fetch --all + - git checkout --track origin/$CI_COMMIT_BRANCH + - git show-branch -a + - target_branch=$(git show-branch -a | awk 'BEGIN { FS="\n\s+*" } { print $1 }' | awk '{print $2}' | grep '\[' | sed 's/.*\[origin\/\(.*\)\].*/\1/' | grep -v '\[' | grep -v $(git rev-parse --abbrev-ref HEAD) | grep -vi 'HEAD' | awk 'BEGIN{ RS = "" ; FS = "\n" }{print $1}') + - echo "[DEBUG] Target Branch[$target_branch]" + - if [ -d "gitlab-ci" ]; then ls -la gitlab-ci; fi + - first_sha1=$(git log origin/$target_branch..$CI_COMMIT_BRANCH --format=format:%H | tail -1) + - echo "[DEBUG] First Commit SHA[$first_sha1]" + - echo "[DEBUG] artifacts directory [$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME]" + after_script: + - ls -lR "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE" + - cd .. + - rm -Rf check + artifacts: + expire_in: 3 days + when: always + paths: + - "$CI_PROJECT_DIR/artifacts/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml" + rules: + - if: '$JOB_STOP_CONVENTIONAL_COMMITS' + when: never + + - if: # condition_any_branch_push + $CI_COMMIT_BRANCH != null && + $CI_COMMIT_TAG == null && + $CI_PIPELINE_SOURCE == "push" && + $CI_COMMIT_BRANCH != 'master' + exists: + - .cz.yaml + when: always + + - when: never + + +MR Title: + extends: + - .conventional_commit + script: + - MR_TITLE=$($ROOT_DIR/conventional_commits/scripts/commit.py --token "$MR_ACCESS_TOKEN" --project $PROJECT_ID --title --branch $CI_COMMIT_BRANCH) + - echo "[DEBUG] MR_TITLE[$MR_TITLE]" + - cz_exit=0 && cz check --message "$MR_TITLE" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$? + - . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml" + + +Commit Messages: + extends: + - .conventional_commit + script: + - if [ "$(git log $first_sha1..HEAD --format=format:%H | wc -l)" -eq 0 ]; then echo "[DEBUG] Single Commit"; cz_exit=0 && cz check -m "$(git log HEAD --format=format:%B -1)" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?; fi + - if [ "$(git log $first_sha1..HEAD --format=format:%H | wc -l)" -gt 0 ]; then echo "[DEBUG] Commit range"; cz_exit=0 && cz check --rev-range $first_sha1..HEAD > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?; fi + - . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml" diff --git a/gitlab-ci/conventional_commits/CHANGELOG.md b/gitlab-ci/conventional_commits/CHANGELOG.md new file mode 100644 index 00000000..b282b76e --- /dev/null +++ b/gitlab-ci/conventional_commits/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-21 01:48:53 +0930 [088c9fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/088c9fb04c80961f4de8d2b129955ae8cd0b9529) - feat(conventional_commits): ensure .cz.yaml exists +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2023-05-15 09:32:15 +0930 [93931cb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/93931cb9076e0db238f4e297abe3d8f37bd71b80) - feat(conventional): job not to run when bot pushes change +2023-05-15 09:23:02 +0930 [76db5b1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/76db5b17578d8585ed31e0728dbfb37ea2fae153) - fix(conventional_commits): never run on git tag +2023-05-14 14:10:06 +0930 [02e9e5f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/02e9e5f4f4cc0b93ae92c7ba3a2cfb38305af64c) - refactor(ci): inconsistant tabs +2023-05-14 12:11:42 +0930 [d389d14](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d389d14192e1e483fbd48fa9b5c5bee25db14a20) - fix: validation jobs on all except merge +2023-05-14 09:56:35 +0930 [934a401](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/934a401a9620891b09a5fe9c9b0e50a97b43fa9b) - fix(ci): specify the commitizen version +2023-05-13 15:35:28 +0930 [408e4ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - refactor: move docs as part of restructure +2023-05-13 11:47:21 +0930 [9e7d357](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9e7d357bab2b92704d37ad5621df9fe8d1e31a26) - feat(conventional_commits): ability to disable job with variable +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-16 00:09:42 +0000 [1ef6c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef6c41818c40183f8019ea5cde48b4278e4d694) - build(version): bump version 0.4.0 → 0.5.0 +2022-01-16 09:02:02 +0930 [31517b4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/31517b4bf00c1f177ef925d09b1a6714577f62c5) - ci(MR_Title): save the merge request title as a variable and debug output in job log. +2022-01-16 08:48:24 +0930 [73918f2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/73918f2f5e19440d0e300da3a20712739c316d88) - fix(commit.py): filter merge request search to 'opened' and on current branch. +2022-01-15 03:53:53 +0000 [5c9000a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c9000a74859504ed64bbefa1fd193f80a2b69c2) - build(version): bump version 0.3.1 → 0.4.0 +2022-01-15 13:14:58 +0930 [e5531fc](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e5531fc77b5bdb1ccc0741e388df2d8d25ba6ade) - feat(commit.py): throw an error if no token was supplied. i.e. empty variable. +2022-01-15 13:07:56 +0930 [6b7ad95](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6b7ad95fc0ccccf79ff645bad3f86660f5096a4e) - feat(commit.py): confirm a merge request was found, if not output 'ci: No Merge Request found' +2022-01-15 13:05:30 +0930 [c543c47](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c543c47af8c7c386ae57f5a7a50904d396758c3a) - feat(commit.py): try to us `CI_JOB_TOKEN` before the specified token, if any. +2022-01-15 12:29:23 +0930 [99bdc2a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/99bdc2a0929d4e7036e50e8ce22ce9b0f90f0736) - fix(commit.py): fix typo that caused exception +2022-01-15 12:23:54 +0930 [d03d9fe](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d03d9fefc916dd6730d9ffa778c11d48d621318e) - fix(conventional_commits): fetch all branches prior to check for parent branch +2022-01-15 12:18:15 +0930 [b01550e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b01550e09f273edc8a57f4ad4b41ee2d67705d41) - feat(commit.py): removed ability to fetch first commit or target branch +2022-01-15 12:04:07 +0930 [42ad02e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/42ad02ee5db65c3c6c33ad14fe0371c9916897bf) - fix(conventional_commits): use git show-branch to find origin branch +2022-01-11 07:03:09 +0000 [7751fd9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7751fd9494f610fff0ea16bd303bfe62d0034eec) - build(version): bump version 0.3.0 → 0.3.1 +2021-08-12 03:32:36 +0000 [389bc08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/389bc08d7686153fb374aa83d440c35c9b4eac90) - build(version): bump version 0.3.0rc1 → 0.3.0 +2021-08-12 12:47:23 +0930 [3360a15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3360a15fde12682edfd9044d2541dc819615b838) - fix(commit_message): fixed commit message check if there is only one commit to the branch +2021-08-11 13:47:34 +0930 [def31ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/def31ef562c0002713401652657d59320548ee85) - style(yaml_lint): fixed yaml lint errors +2021-08-04 03:23:08 +0000 [eb5cc8a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb5cc8a0e2885a9ed16a8d1a81611aec4d5a4d31) - build(version): bump version 0.3.0rc0 → 0.3.0rc1 +2021-08-04 03:13:54 +0000 [09dcb65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/09dcb65b090f59e9f8a6bea5eba4bb98bddbad3d) - build(version): bump version 0.2.1 → 0.3.0rc0 +2021-08-04 02:49:45 +0000 [4453b43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4453b433c8966a334f02af592a6ce8092f2ac9de) - build(version): bump version 0.2.0 → 0.2.1 +2021-08-04 02:24:12 +0000 [856f2e1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/856f2e1770d0bda823996122ee70916dc0fe455b) - build(version): bump version 0.1.0 → 0.2.0 +2021-08-04 01:33:47 +0000 [6d34977](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d349774269bcd7c6e406cfe72c78b99f246df7b) - build(version): bump version 0.0.1 → 0.1.0 +2021-08-03 13:26:05 +0930 [392a200](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/392a200fd469c4161dbab5f2b59031a7a64f20a2) - feat(conventional_commits): Added conventional commit job diff --git a/gitlab-ci/conventional_commits/requirements.txt b/gitlab-ci/conventional_commits/requirements.txt new file mode 100644 index 00000000..0e5f2a2c --- /dev/null +++ b/gitlab-ci/conventional_commits/requirements.txt @@ -0,0 +1,3 @@ +python-gitlab +requests +commitizen==2.21.0 diff --git a/gitlab-ci/conventional_commits/scripts/commit.py b/gitlab-ci/conventional_commits/scripts/commit.py new file mode 100755 index 00000000..1bc1f571 --- /dev/null +++ b/gitlab-ci/conventional_commits/scripts/commit.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- + + +#import gitlab +import os +import sys +import getopt +import json +import requests + +get_mr_title = False +project_id = '' + +try: + opts, args = getopt.getopt(sys.argv[1:],"hi:t:ti:p:b",["token=", "title", "project=", "branch="]) + +except getopt.GetoptError: + print('test.py [-c | --commit] [-t | --token {token}]') + sys.exit(2) + +for opt, arg in opts: + + #print('[DEBUG] {0} {1}'.format(opt, arg)) + if opt == '-h': + print('[commit.py] -i -o ') + sys.exit() + elif opt in ("-t", "--token"): + if arg is None: + raise ValueError('Token switch was specified, however no token was supplied.') + ci_job_token = arg + elif opt in ("-ti", "--title"): + get_mr_title = True + elif opt in ("-p", "--project"): + project_id = str(arg) + elif opt in ("-b", "--branch"): + git_branch = arg + + +# private token or personal token authentication +#gl = gitlab.Gitlab('https://gitlab.com', private_token=ci_job_token) + + +url = 'https://gitlab.com/api/v4/projects/' + project_id + '/merge_requests?state=opened&source_branch=' + git_branch + +merge_requests = "" + +try: + + if os.environ['CI_JOB_TOKEN'] is not None: + + headers = {'JOB_TOKEN': os.environ['CI_JOB_TOKEN']} + + if os.environ['CI_JOB_TOKEN'] == ci_job_token: + + headers = {'JOB_TOKEN': os.environ['CI_JOB_TOKEN']} + + merge_requests = requests.get(url, headers=headers, data='') + merge_requests = merge_requests.json() + +except: + pass + + +if not isinstance(merge_requests, list): + headers = {'PRIVATE-TOKEN': ci_job_token} + + merge_requests = requests.get(url, headers=headers, data='') + + merge_requests = merge_requests.json() + + +#print('\n\nmerge_requests=[-{0}-][]\n\n\n\n\n'.format(merge_requests)) + + +#project_mrs = project.mergerequests.list() +#mrs = gl.mergerequests.list() + + +mr_title = 'failed to fetch Merge Request title' +mr_first_commit = '' +target_branch = '' + +if isinstance(merge_requests, list): + + if len(merge_requests) > 0: + + for mr in merge_requests: + + if mr['source_branch'] == git_branch and str(mr['target_project_id']) == str(project_id) and str(mr['state']) == 'opened': + mr_title = mr['title'] + + if get_mr_title: + + print('{0}'.format(mr_title)) + + else: + + print('ci: No Merge Request found, MR count "0"') + diff --git a/gitlab-ci/conventional_commits/scripts/cz_junit.sh b/gitlab-ci/conventional_commits/scripts/cz_junit.sh new file mode 100755 index 00000000..0465fe2d --- /dev/null +++ b/gitlab-ci/conventional_commits/scripts/cz_junit.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# to use ensure cz_exit=0 is set prior to the cz command so that if the command is successfull, this script works +# this script must be run with '. {script-name}' so that vars set in cli are available + +cz_command=$(cat "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log") + + +if [ "f${cz_exit}" == "f" ]; then +echo "[DEBUG] environmental variable cz_exit must be set" +exit 255 +fi + +if [ "${cz_exit}" == "0" ]; then +error_count=0 +system_err='' + +cat < + + +EOF + +else +error_count=1 +system_err="ERROR: $cz_command" + + +cat < + + + + $cz_command + + + + + + + + + + + +EOF + +fi + +#echo boo; + +#echo "output:[$cz_command]" +#echo "[DEBUG] cz_exit[$cz_exit]" + + + + +exit $cz_exit diff --git a/gitlab-ci/docker/CHANGELOG.md b/gitlab-ci/docker/CHANGELOG.md new file mode 100644 index 00000000..5e179e61 --- /dev/null +++ b/gitlab-ci/docker/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-21 01:47:15 +0930 [f604c6e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f604c6e27d2e7704491f4c78979db40cf89764c0) - fix(docker): ensure qemu binfmt is loaded +2023-05-17 15:41:09 +0930 [a90ccb8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a90ccb81772e295cebe89d7a9c32ab700e19884d) - refactor(docker): move docker jobs to their own file diff --git a/gitlab-ci/docker/build.gitlab-ci.yaml b/gitlab-ci/docker/build.gitlab-ci.yaml new file mode 100644 index 00000000..a68123fd --- /dev/null +++ b/gitlab-ci/docker/build.gitlab-ci.yaml @@ -0,0 +1,133 @@ +--- + +variables: + # 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 + DOCKER_IMAGE_BUILD_REGISTRY: $CI_REGISTRY_IMAGE + DOCKER_IMAGE_BUILD_TAG: $CI_COMMIT_SHA + + # DOCKER_IMAGE_PUBLISH_NAME: $CI_PROJECT_NAME + # DOCKER_IMAGE_PUBLISH_REGISTRY: docker.io/nofusscomputing + # DOCKER_IMAGE_PUBLISH_URL: https://hub.docker.com/r/nofusscomputing/$DOCKER_IMAGE_PUBLISH_NAME + # JOB_STOP_CONVENTIONAL_COMMITS: 'any_value' + # 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' + + +.build_docker_container: + stage: build + image: + name: nofusscomputing/docker-buildx-qemu:dev + pull_policy: always + services: + - name: docker:23-dind + entrypoint: ["env", "-u", "DOCKER_HOST"] + command: ["dockerd-entrypoint.sh"] + variables: + DOCKER_HOST: tcp://docker:2375/ + DOCKER_DRIVER: overlay2 + DOCKER_DOCKERFILE: dockerfile + # See https://github.com/docker-library/docker/pull/166 + DOCKER_TLS_CERTDIR: "" + before_script: + - git submodule foreach git submodule update --init + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - docker info + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + #- pip3 install -r gitlab-ci/gitlab_release/requirements.txt + - pip3 install setuptools wheel + - pip install -r $ROOT_DIR/conventional_commits/requirements.txt + - pip3 install gitlab-ci/gitlab_release/python-module/cz_nfc/. + # see: https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/1861 + # on why this `docker run` is required. without it multiarch support doesnt work. + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - update-binfmts --display + - update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel + - docker buildx create --driver=docker-container --driver-opt image=moby/buildkit:v0.11.6 --use + - docker buildx inspect --bootstrap + + + # --label org.opencontainers.image.url="$CI_PROJECT_URL/-/releases/$(cz -n cz_nfc version --project)" \ + # --label org.opencontainers.image.version="$(cz -n cz_nfc version --project)" \ + script: + - update-binfmts --display + - | + + if [ "0$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS" != "0" ]; then + + echo "[DEBUG] building multiarch/specified arch image"; + + docker buildx build --platform=$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS . \ + --label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \ + --label org.opencontainers.image.documentation="$CI_PROJECT_URL" \ + --label org.opencontainers.image.source="$CI_PROJECT_URL" \ + --label org.opencontainers.image.revision="$CI_COMMIT_SHA" \ + --push \ + --build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --build-arg CI_PROJECT_ID=$CI_PROJECT_ID --build-arg CI_API_V4_URL=$CI_API_V4_URL \ + --file $DOCKER_DOCKERFILE \ + --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + # during docker multi platform build there are >=3 additional unknown images added to gitlab container registry. cleanup + + DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG" --format "{{ range .Manifest.Manifests }}{{ if ne (print .Platform) \"&{unknown unknown [] }\" }}$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG@{{ println .Digest }}{{end}} {{end}}"); + + docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + else + + echo "[DEBUG] building image"; + + docker build . \ + --label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \ + --label org.opencontainers.image.documentation="$CI_PROJECT_URL" \ + --label org.opencontainers.image.source="$CI_PROJECT_URL" \ + --label org.opencontainers.image.url="$CI_PROJECT_URL/-/releases/$(cz -n cz_nfc version --project)" \ + --label org.opencontainers.image.version="$(cz -n cz_nfc version --project)" \ + --label org.opencontainers.image.revision="$CI_COMMIT_SHA" \ + --build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --build-arg CI_PROJECT_ID=$CI_PROJECT_ID --build-arg CI_API_V4_URL=$CI_API_V4_URL \ + --file $DOCKER_DOCKERFILE \ + --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + docker push $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + fi + rules: + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{dockerfile,dockerfile.j2}' + when: on_success + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{dockerfile,dockerfile.j2}' + changes: + paths: + - '{dockerfile,dockerfile.j2,includes/**/*}' + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{dockerfile,dockerfile.j2}' + changes: + paths: + - '{dockerfile,dockerfile.j2,includes/**/*}' + compare_to: 'development' + when: always + + - when: never diff --git a/gitlab-ci/docker/publish.gitlab-ci.yaml b/gitlab-ci/docker/publish.gitlab-ci.yaml new file mode 100644 index 00000000..d5b1c77e --- /dev/null +++ b/gitlab-ci/docker/publish.gitlab-ci.yaml @@ -0,0 +1,130 @@ +--- +# variables: +# # 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 +# DOCKER_IMAGE_BUILD_REGISTRY: $CI_REGISTRY_IMAGE +# DOCKER_IMAGE_BUILD_TAG: $CI_COMMIT_SHA + + +.publish-docker-hub: + stage: publish + image: docker:23-dind + services: + - docker:23-dind + before_script: + - | + + docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD; + + if [ "0$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS" != "0" ]; then + + for i in ${DOCKER_IMAGE_BUILD_TARGET_PLATFORMS//,/ } + do + + docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + #DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG" --format "{{ range .Manifest.Manifests }}{{ if ne (print .Platform) \"&{unknown unknown [] }\" }}$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG@{{ println .Digest }}{{end}} {{end}}") + DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG" --format "{{ range .Manifest.Manifests }}$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG@{{ println .Digest }} {{end}}") + + + echo "[DEBUG] DOCKER_MULTI_ARCH_IMAGES=$DOCKER_MULTI_ARCH_IMAGES"; + + done; + + else + + docker pull $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + fi + + #docker logout $CI_REGISTRY; # commented out to test if for private repo remaining logged in works to allow pulling image + + script: + - docker login docker.io -u $NFC_DOCKERHUB_USERNAME -p $NFC_DOCKERHUB_TOKEN + - docker image ls + - | + DOCKER_HUB_TAG=dev + + echo "[DEBUG] default: DOCKER_HUB_TAG=$DOCKER_HUB_TAG"; + + if [ "0$CI_COMMIT_TAG" != "0" ]; then + + DOCKER_HUB_TAG=latest + + echo "[DEBUG] stable: DOCKER_HUB_TAG=$DOCKER_HUB_TAG"; + + if [[ "0$CI_COMMIT_TAG" == *"rc"* ]]; then + + DOCKER_HUB_TAG=dev + + echo "[DEBUG] dev: DOCKER_HUB_TAG=$DOCKER_HUB_TAG"; + + fi + + fi + + echo "[DEBUG] DOCKER_IMAGE_PUBLISH_NAME=$DOCKER_IMAGE_PUBLISH_NAME"; + echo "[DEBUG] final: DOCKER_HUB_TAG=$DOCKER_HUB_TAG"; + + if [ "0$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS" != "0" ]; then + + echo "[DEBUG] DOCKER_MULTI_ARCH_IMAGES=$DOCKER_MULTI_ARCH_IMAGES"; + + docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES --tag $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$DOCKER_HUB_TAG; + + if [ "0$CI_COMMIT_TAG" != "0" ]; then + + docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES --tag $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$CI_COMMIT_TAG; + + fi + + else + + docker image tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$DOCKER_HUB_TAG; + + docker push $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$DOCKER_HUB_TAG; + + if [ "0$CI_COMMIT_TAG" != "0" ]; then + + docker image tag $DOCKER_IMAGE_BUILD_NAME/$DOCKER_IMAGE_BUILD_REGISTRY:$DOCKER_IMAGE_BUILD_TAG $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$CI_COMMIT_TAG; + + docker push $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$CI_COMMIT_TAG; + + fi + + fi + + - docker logout docker.io + environment: + name: DockerHub + url: $DOCKER_IMAGE_PUBLISH_URL + rules: + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{dockerfile,dockerfile.j2}' + when: on_success + + # - if: # condition_master_branch_push + # $CI_COMMIT_BRANCH == "master" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - '{dockerfile,dockerfile.j2}' + # when: on_success + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{dockerfile,dockerfile.j2}' + changes: + paths: + - '{dockerfile,dockerfile.j2,includes/**/*}' + compare_to: 'master' + allow_failure: true + when: on_success + + - when: never diff --git a/gitlab-ci/docs/articles/index.md b/gitlab-ci/docs/articles/index.md new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/docs/contact.md b/gitlab-ci/docs/contact.md new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/docs/index.md b/gitlab-ci/docs/index.md new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/docs/operations/index.md b/gitlab-ci/docs/operations/index.md new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/docs/projects/gitlab-ci/ansible/collection.md b/gitlab-ci/docs/projects/gitlab-ci/ansible/collection.md new file mode 100644 index 00000000..265513db --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/ansible/collection.md @@ -0,0 +1,284 @@ +--- +title: Ansible Collection +description: How to use No Fuss Computings gitlab-ci job for running Ansible Collection CI/CD Pipelines +date: 2024-02-16 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This CI/CD template contains all of the CI jobs required for a pipeline for an Ansible Collection Project. + + +## Requirements + +The following requirements are needed to run these CI/CD jobs. As we use [commitizen](https://commitizen-tools.github.io/commitizen/) for the versioning system, your commits will be required to be in [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/). The configuration for commitizen is within a `.cz.yaml` file which you will need to add to your repository root directory. + + +### Gitlab Features + +| Feature | Setting | Notes | +|:---|:---:|:---| +| Package Registry | On | Storage of pipeline artifacts and the built package. | +| Releases | On | Gitlab releases are created as part of the pipeline. | + + +### Variables + +To be able to upload to Ansible Galaxy, you will be required to provide the jobs, the following Variables That should be set as CI/CD variables (` -> Settings -> CI/CD Settings -> Variables`). + +| Variable | Settings | Notes | +|:---|:---:|:---| +| `ANSIBLE_GALAXY_UPLOAD_TOKEN` | `masked`, `protected` | | +| `VERSION_BUMP_INCREMENT` | `major`, `minor`, `patch` | Used for manual run of the job. After setting the variable, that type of version bump will occur. | + +Within your `.gitlab-ci.yml` file there are varibales to be set, please see below. + + +### .gitlab-ci.yaml Changes + +To include these jobs in your CI/CD Project add our gitlab-ci project as a submodule to your project `git submodule add https://gitlab.com/nofusscomputing/projects/gitlab-ci/`. Then update your projects `.gitlab-ci.yml` file to include the following: + +``` yaml +variables: + ANSIBLE_GALAXY_SERVER_URL: https://galaxy.ansible.com # Optional, default=(as displayed)String. URL to the Galaxy server for uploads + ANSIBLE_GALAXY_NAMESPACE: "" # Mandatory, String. The ansible galaxy upload namespace + ANSIBLE_GALAXY_PACKAGE_NAME: "" # Mandatory, String. The Ansible Galaxy package name + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: # branch, git tag, commit etc + file: + - .gitlab-ci_common.yaml + - template/ansible-collection.gitlab-ci.yaml +``` + + +## CI/CD Jobs + +This template contains the following CI/CD Jobs + +- `Create Release` + +- `Ansible Lint` + +- `Ansible Lint (galaxy.yml)` + +- `Build Collection` + +- `Stage Collection` + +- `Gitlab Release` + +- `Ansible Galaxy` + +for a detail description of each job, please see below. + + +### Create Release + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `manual` + + - **merge to**: `manual` + +- **master branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **git tag**: `never` + +Create a release. It's only triggered on merge to the `development` and `master` branches. The last stage of this job is to create a git tag which matches the version to be released. The creation of the git tag, starts the remainder of the release cycle. On the `development` branch (when the job is triggered as it's a manual job) an `alpha` release is created and on the `master` branch, a full release is created. + + +### Ansible Lint + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `manual` + + - **merge to**: `manual` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `never` + +Lints the yaml files in directories `meta`, `playbooks` and `roles`. This job will not fail the pipeline. There are XUnit test reports created for thyis job so you can see any liniting errors. + + +### Ansible Lint (galaxy.yml) + +Triggered: + +- **Feature branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **development branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Lints the `galaxy.yml` file. This job is designed to fail the pipeline, as an incorrectly formated `galaxy.yml` file can prevent an upload of the collection to Ansible Galaxy. There is a XUnit test report created for thyis job so you can see any liniting errors. + + +### Build Collection + +Triggered: + +- **Feature branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **development branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Builds the collection. + +### Stage Collection + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Adds the collection to Gitlab Packages Regsitry as a generic package. This location is used to store the package. + + +### Gitlab Release + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Creates a Gitlab release. + + +### Ansible Galaxy + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Uploads the package to Ansible Galaxy. + + +## CI Tests + +Still to be developed + + +## Definition + +``` yaml title="template/ansible-collection.gitlab-ci.yaml" linenums="1" + +--8<-- "template/ansible-collection.gitlab-ci.yaml" + +``` + +---- + +``` yaml title=".gitlab-ci_common.yaml" linenums="1" + +--8<-- ".gitlab-ci_common.yaml" + +``` diff --git a/gitlab-ci/docs/projects/gitlab-ci/ansible_playbook.md b/gitlab-ci/docs/projects/gitlab-ci/ansible_playbook.md new file mode 100644 index 00000000..da2847b3 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/ansible_playbook.md @@ -0,0 +1,171 @@ +--- +title: Ansible Playbook +description: How to use No Fuss Computings gitlab-ci job for running Ansible Playbooks +date: 2023-05-29 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This job enables you to run an Ansible playbook within the Gitlab CI/CD environment. + + +There is also an additional job defined that enables you to specify a project to run an automated update of it's git submodules. This is useful if the project you create the job in, is used as a git submodule in another project. On pushing to the development branch, this job triggers the `Git.Submodules.Update.Chores` job that updates the specified projects git submodules. + + + +## your .gitlab-ci.yml changes + +- **Mandatory** In addition to the previous dependency, this requirement is for the project specified in the trigger job. The following must be added to the `.gitlab-ci.yml` file in that project. + +``` yaml +include: + - project: nofusscomputing/projects/gitlab-ci + ref: master + file: + - .gitlab-ci_common.yaml + - automation/template/automagic.gitlab-ci.yaml +``` + +To use the ansible playbook job add the following to your `.gitlab-ci.yml` file. + +``` yaml + +stages: + - chores + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: master + file: + - automation/.gitlab-ci-ansible.yaml + +Ansible Job: + extends: .ansible_playbook + variables: + ansible_playbook: 'git_configuration.yaml' + ansible_tags: 'submodule' + PIPELINE_RUN_TRIGGER: 'false' + PIPELINE_RUN_SCHEDULE: 'false' + +``` + +To run the trigger job to update another projects git submodules. add the following to your `.gitlab-ci.yml` file + +``` yaml + +stages: + - publish + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: master + file: + - automation/.gitlab-ci-ansible.yaml + +Docker_Mail.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-mail + +``` + +!!! Tip + In addition to the variables below, you can also specify any additional Environment variables for use by Ansible within the container. Refer to the [Ansible configuration documentation](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#common-options) for further details + + +## Job: `.ansible_playbook` + +This job runs an Ansible playbook using the `nofusscomputing/ansible-ee:dev` Docker image. + + +### Stage: Chores + +This job is responsible for executing an Ansible playbook. It can be customized by setting the following variables: + + +#### Variables + +- `ansible_inventory`: The Ansible inventory file. + +- `ansible_playbook`: The name of the Ansible playbook file. + +- `ansible_tags`: The tags to be applied during playbook execution. + + +### Rules + +- Rule 1: If the `NFC_AUTO_JOBS` variable is set to `"false"`, the job will never run. + +- Rule 2: If the pipeline is triggered by a schedule and `PIPELINE_RUN_SCHEDULE` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists. + +- Rule 3: If the pipeline is triggered by an API call, another pipeline, a trigger, or a parent pipeline, and `PIPELINE_RUN_TRIGGER` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists. + +- Rule 4: If the pipeline is triggered by a push to the `development` branch, the job will run only if the `.nfc_automation.yaml` file exists. see [Documentation](../git_configuration/submodule/) for file details. + +- Rule 5: This rule prevents the job from running under any circumstances. + + +## Job: `.ansible_playbook_git_submodule` + +This job extends the `.ansible_playbook` job and is specifically used for running the `git_configuration.yaml` playbook with the `submodule` tags. + + +### Stage: Chores + +This job is responsible for executing the `git_configuration.yaml` playbook with the `submodule` tags. + + +#### Variables + +- `ansible_playbook`: The name of the Ansible playbook file (`git_configuration.yaml`). + +- `ansible_tags`: The tags to be applied during playbook execution (`submodule`). + + +### Rules + +- Rule 1: If the `NFC_AUTO_JOBS` variable is set to `"false"`, the job will never run. + +- Rule 2: If the pipeline is triggered by a schedule and `PIPELINE_RUN_SCHEDULE` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists. + +- Rule 3: If the pipeline is triggered by an API call, another pipeline, a trigger, or a parent pipeline, and `PIPELINE_RUN_TRIGGER` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists. see [Documentation](../git_configuration/submodule/) for file details. + +- Rule 4: If the pipeline is triggered by a push to the `development` branch, the job will run only if the `.nfc_automation.yaml` file exists. + +- Rule 5: This rule prevents the job from running under any circumstances. + + +## Job: `.submodule_update_trigger` + +This job triggers a pipeline in another project. + + +### Stage: Publish + +This job is responsible for triggering a pipeline in another project. + + +#### Variables + +- `PIPELINE_RUN_TRIGGER`: The flag to indicate if the triggered pipeline should run (`true`). + + +### Rules + +- Rule 1: If the pipeline is triggered by a push to the `master` or `development` branch, and there is no associated tag, the job will run on successful completion. + +- Rule 2: This rule prevents the job from running under any other circumstances. + + +## Artifacts + +- None + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "automation/.gitlab-ci-ansible.yaml" + +``` diff --git a/gitlab-ci/docs/projects/gitlab-ci/conventional_commits.md b/gitlab-ci/docs/projects/gitlab-ci/conventional_commits.md new file mode 100644 index 00000000..741e5b34 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/conventional_commits.md @@ -0,0 +1,157 @@ +--- +title: Conventional Commits +description: How to use No Fuss Computings gitlab-ci job for Conventional Commits +date: 2021-08-03 +template: project.html +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. + + +#### fixing commit messages (suggestion) + +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 | +|:-----:| +| *As you have changed the commit SHA1(s), when you next push your changes upstream, you must force push. `git push --force`* | + +| :octagonal_sign: **WARNING** | +|:-----:| +| *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 CI Template - `.conventional_commit` + +This GitLab CI template, named `.conventional_commit`, is designed to validate conventional commits within a GitLab CI/CD pipeline. It follows predefined rules to ensure that commit message conventions are met. + + +### 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}" + +stages: + - validation + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/conventional_commits/.gitlab-ci.yml + +``` + + +### Job Description + +The `.conventional_commit` job performs various tasks related to validating conventional commits. It runs in the `validation` stage of the pipeline and uses the `python:3.6-slim` Docker image. + + +### Variables + +- `DEFAULT_ROOT_DIR`: The default root directory is set as `./gitlab-ci`. + +- `MR_ACCESS_TOKEN`: The access token for the merge request. If not defined, it falls back to `CI_JOB_TOKEN`. + +- `JOB_ROOT_DIR`: The root directory for the job. If not defined, it falls back to `DEFAULT_ROOT_DIR`. + +- `MY_PROJECT_ID`: The custom project ID. If not defined, it falls back to `CI_PROJECT_ID`. + + +### Stages + +- `validation`: The job is assigned to the `validation` stage. + + +### Script + +The script section contains the actions performed during the job execution. These actions include creating directories, setting up variables, preparing the Python environment, and executing commands related to validating conventional commits. + +The complete script can be found in the GitLab CI template file. + + +### Artifacts + +The job generates artifacts that are stored for a period of 3 days. The artifacts include the following paths: + +- `$CI_PROJECT_DIR/artifacts/*` + +- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml` + + +### Rules + +The job follows certain rules to determine when it should be executed: + +- If the variable `$JOB_STOP_CONVENTIONAL_COMMITS` is true, the job will not run. + +- If the branch is pushed and a commit is made, and there is no tag associated with the commit, and the pipeline source is "push", the job will run if `.cz.yaml` file exists. + +- In all other cases, the job will not run. + +This GitLab CI template provides a convenient way to validate conventional commits and enforce commit message conventions within your CI/CD pipelines. + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "conventional_commits/.gitlab-ci.yml" + +``` diff --git a/gitlab-ci/docs/projects/gitlab-ci/docker_build.md b/gitlab-ci/docs/projects/gitlab-ci/docker_build.md new file mode 100644 index 00000000..6e051573 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/docker_build.md @@ -0,0 +1,56 @@ +--- +title: docker build Gitlab CI/CD jobs Template +description: How to use No Fuss Computings gitlab-ci template for auto creation of CI/CD joobs. +date: 2023-06-10 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This documentation provides an overview and explanation of the GitLab CI/CD YAML template. The template defines a job named `.build_docker_container` that builds a Docker container using the specified configuration. + + +### Stage: build + +This job builds a Docker container using the `nofusscomputing/docker-buildx-qemu:dev` image and the `docker:23-dind` service. + + +#### Variables + +- `DOCKER_IMAGE_BUILD_NAME`: The name of the Docker image to be built (`$CI_PROJECT_NAME`). + +- `DOCKER_IMAGE_BUILD_REGISTRY`: The registry where the Docker image will be pushed (`$CI_REGISTRY_IMAGE`). + +- `DOCKER_IMAGE_BUILD_TAG`: The tag to be applied to the Docker image (`$CI_COMMIT_SHA`). + + +#### Rules + +- Rule 1: The job runs if the pipeline is triggered by a git tag and a `dockerfile` or `dockerfile.j2` file exists. + +- Rule 2: The job runs if the pipeline is triggered by a push to the `development` branch and a `dockerfile` or `dockerfile.j2` file exists. It also checks for changes in the `dockerfile`, `dockerfile.j2`, or `includes/` directory compared to the `master` branch. + +- Rule 3: The job runs if the pipeline is triggered by a push to a branch other than `master` or `development` and a `dockerfile` or `dockerfile.j2` file exists. It also checks for changes in the `dockerfile`, `dockerfile.j2`, or `includes/` directory compared to the `development` branch. + +- Rule 4: The job never runs. + + +#### Script + +The script performs the following steps: + +1. Updates the binary formats and enables execution of other binary formats in the kernel. + +2. Creates a Docker buildx builder and sets it as the active builder. + +3. Builds a multi-arch Docker image if the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is specified. It applies labels to the image and pushes it to the specified registry. It also inspects the image and performs cleanup by removing additional unknown images from the container registry. + +4. Builds a Docker image if the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is not specified. It applies labels to the image and pushes it to the specified registry. + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "docker/build.gitlab-ci.yaml" + +``` diff --git a/gitlab-ci/docs/projects/gitlab-ci/docker_publish.md b/gitlab-ci/docs/projects/gitlab-ci/docker_publish.md new file mode 100644 index 00000000..8353b3ac --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/docker_publish.md @@ -0,0 +1,102 @@ +--- +title: docker publish Gitlab CI/CD jobs Template +description: How to use No Fuss Computings gitlab-ci job template to publish a docker image to docker hub. +date: 2023-06-10 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This GitLab CI template is designed to publish Docker images to Docker Hub. It contains a job called "Publish Docker Image to Docker Hub" that handles the image publishing process. + + +## Stage + +- `publish` + + +## Variables + +The following variables are used in the job: + +- `DOCKER_IMAGE_BUILD_NAME`: The name of the Docker image to build. By default, it uses the GitLab CI project name. + +- `DOCKER_IMAGE_BUILD_REGISTRY`: The registry for the Docker image build. By default, it uses the GitLab CI registry image. + +- `DOCKER_IMAGE_BUILD_TAG`: The tag for the Docker image build. By default, it uses the GitLab CI commit SHA. + +- `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS`: A comma-separated list of available platforms for the Docker image build. Supported platforms include: `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`. + +- `CI_REGISTRY_USER`: The username for logging in to the GitLab CI registry. + +- `CI_REGISTRY_PASSWORD`: The password for logging in to the GitLab CI registry. + +- `NFC_DOCKERHUB_USERNAME`: The username for logging in to Docker Hub. + +- `NFC_DOCKERHUB_TOKEN`: The access token or password for logging in to Docker Hub. + +- `DOCKER_IMAGE_PUBLISH_REGISTRY`: The registry for publishing the Docker image to Docker Hub. + +- `DOCKER_IMAGE_PUBLISH_NAME`: The name of the Docker image for publishing to Docker Hub. + +- `DOCKER_IMAGE_PUBLISH_URL`: The URL to access the published Docker image on Docker Hub. + + +## Services + +- `docker:23-dind`: Runs Docker in Docker (DinD) service with version 23. + + +## Script + +The job executes the following steps in the `script` section: + +1. Logs in to the GitLab CI registry using the provided credentials (`CI_REGISTRY_USER` and `CI_REGISTRY_PASSWORD`). + +2. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is specified, it iterates over the platforms and inspects the Docker image using `docker buildx imagetools inspect`. + +3. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is not specified, it pulls the Docker image from the specified registry. + +4. Logs in to Docker Hub using the provided credentials (`NFC_DOCKERHUB_USERNAME` and `NFC_DOCKERHUB_TOKEN`). + +5. Lists the Docker images using `docker image ls`. + +6. Determines the appropriate tag for the Docker image based on the pipeline source and commit tag. + +7. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is specified, it creates multi-arch images using `docker buildx imagetools create` and tags them with the appropriate tag. + +8. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is not specified, it tags the Docker image with the appropriate tag based on the pipeline source and commit tag. + +9. Pushes the Docker image to Docker Hub. + +10. Logs out of Docker Hub. + + +## Environment + +The job sets the following environment variables: + +- **Name**: DockerHub + +- **URL**: The URL to access the published Docker image on Docker Hub. + + +## Rules + +The job is controlled by the following rules: + +- Runs when the pipeline is triggered by a Git tag and there is no associated branch. + +- Runs when the pipeline is triggered by a push to the `master` branch and there is a Dockerfile present. + +- Runs when the pipeline is triggered by a push to the `development` branch, there are changes in the Dockerfile or the `includes/` directory compared to the `master` branch, and it allows failure. + +- Never runs explicitly. + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "docker/build.gitlab-ci.yaml" + +``` diff --git a/gitlab-ci/docs/projects/gitlab-ci/git_mirror.md b/gitlab-ci/docs/projects/gitlab-ci/git_mirror.md new file mode 100644 index 00000000..7c21c654 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/git_mirror.md @@ -0,0 +1,88 @@ +--- +title: Git push mirror +description: How to use No Fuss Computings gitlab-ci job for repository mirrororing +date: 2021-08-03 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This job does a git push to a remote git repo. + + +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: + - sync + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/git_push_mirror/.gitlab-ci.yml + +Github (Push --mirror): + variables: + GIT_SYNC_URL: "https://${username variable}:${pasword variable}@github.com/NoFussComputing/gitlab-ci.git" + extends: + - .git_push_mirror + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| GIT_SYNC_URL | this is the remote git repositories https clone address.
***Note:** if the remote repository requires authentication, you will need to build the url. like above.* | + + +## Job Workflow + +- 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" + extends: + - .git_push_mirror + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + when: never + - if: '$CI_COMMIT_BRANCH == "development"' + when: always + +``` + +This will cause the job to only run on the `development` branch. + + +## Artifacts + +- None + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "git_push_mirror/.gitlab-ci.yml" + +``` + +!!! Note + Docs Still under development diff --git a/gitlab-ci/docs/projects/gitlab-ci/gitlab_release.md b/gitlab-ci/docs/projects/gitlab-ci/gitlab_release.md new file mode 100644 index 00000000..8cfbf9b4 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/gitlab_release.md @@ -0,0 +1,216 @@ +--- +title: Gitlab Release / Commit Footer References +description: How to use No Fuss Computings gitlab-ci job for Gitlab Releases and commit footer messages +date: 2021-08-03 +template: project.html +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*). + + +### fixing 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 | +|:-----:| +| *As you have changed the commit SHA1(s), when you next push your changes upstream, you must force push. `git push --force`* | + +| :octagonal_sign: **WARNING** | +|:-----:| +| *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 CI Template - Developer Manual + + +## Job: gitlab_release + +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. + +!!! Alert + *If prior to merging to the master branch you do a version increment, and there are no commits prior to merging. the job will not increment the version and the job will fail. it is recommended that you only do a version increment on the `development` branch if you are going to commit further changes to the `development` branch* + + +### Stage + +`release` + + +### Image + +The job uses the `registry.gitlab.com/gitlab-org/release-cli:latest` image. + + +### Variables + +The job does not use any additional variables. + + +### Explanation + +The `gitlab_release` job is responsible for creating releases and tags for the GitLab repository. It follows a specific release workflow and utilizes the `release-cli` tool to automate the release process. + + +### Steps + +1. Set ROOT_DIR variable: Sets the `ROOT_DIR` variable based on the value of `JOB_ROOT_DIR`. + +2. Create necessary directories: Creates necessary directories for storing artifacts and tests. + +3. Install dependencies: Updates the package manager and installs Git and Python 3. Sets up the Python environment by installing required packages. + +4. Clone repository: Clones the repository using the provided authentication token and checks out the `development` branch. + +5. Configure Git: Configures Git settings for the release process. + +6. Perform release steps: Executes release-related steps, such as running a custom command (`$MY_COMMAND`), generating the release changelog, and tagging the release. + +7. Push changes: Pushes the changes to the GitLab repository. + +8. Cleanup: Removes the cloned repository. + + +### Rules + +- The job is never triggered when `$JOB_STOP_GITLAB_RELEASE` is true. + +- The job is never triggered when the commit author is `nfc_bot `. + +- If the commit is pushed to the `master` branch, the job is only triggered on successful pipeline execution and failure is not allowed. + +- If the commit is pushed to the `development` branch, the job is triggered manually and failure is allowed. + + +### 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 + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/gitlab_release/.gitlab-ci.yml + +Gitlab Release: + variables: + 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}`. + + +## Job: commit_footer_refs + + +### Stage + +`validation` + + +### Image + +The job uses the `python:3.6-slim` image. + + +### Variables + +- `DEFAULT_ROOT_DIR`: The default root directory path. + + +### Explanation + +The `commit_footer_refs` job validates the commit footer references in the GitLab repository. It checks if the commit messages adhere to the conventional commit format and generates a JUnit XML report. + + +### Conventional Commits + +Conventional commits follow a specific format for commit messages, consisting of a type, optional scope, and a message. The format is as follows: + +``` +(): +``` + +- The `` represents the nature of the changes, such as `feat` for a new feature, `fix` for a bug fix, `docs` for documentation changes, and so on. + +- The `` (optional) provides additional context for the commit, indicating the module, component, or area of code being modified. + +- The `` contains a concise and descriptive summary of the changes. + +The commit footer can contain additional information, such as references to issues, feature requests, or pull requests. + + +### Steps + +1. Create necessary directories: Creates necessary directories for storing artifacts and test results. + +2. Set ROOT_DIR variable: Sets the `ROOT_DIR` variable based on the value of `JOB_ROOT_DIR`. + +3. Install dependencies: Updates the package manager and installs Git and the required Python packages for the commit footer validation. + +4. Clone repository: Clones the repository and checks out the specified branch. + +5. Run commit_footer script: Executes the `commit_footer` script to validate the commit footer references. + +6. Generate artifacts: Generates a JUnit XML report for the test results. + + +### Rules + +- The job is never triggered when `$JOB_STOP_CONVENTIONAL_COMMITS` is true. + +- The job is never triggered when `CHANGELOG_FOOTER_REFERENCES` is false. + +- The job is always triggered when the commit is not pushed to the master or development branch, and a .cz.yaml file is present, indicating the usage of conventional commits. + +- The job is never triggered otherwise. + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "gitlab_release/.gitlab-ci.yml" + +``` diff --git a/gitlab-ci/docs/projects/gitlab-ci/index.md b/gitlab-ci/docs/projects/gitlab-ci/index.md new file mode 100644 index 00000000..726998b8 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/index.md @@ -0,0 +1,111 @@ +--- +title: No Fuss Computings Gitlab-CI Project +description: How to use No Fuss Computings gitlab-ci project within your CI/CD pipelines +date: 2023-05-22 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +!!! Note + Docs Still under development + + +## Docs ToDo + +- Templates folder is for `gitlab-ci.yaml` that automagically create the jobs if included + +- other sub folders are for `` which **DO NOT** automagically create jobs, but are pure definitions only. + +- notate how each of the stages run and under what circumstance. *i.e. gitlab-ci.yml rules.exist/rules.changes* + +## CI Stages + +The CI stages for these jobs are as follows, and in the order expected by the jobs: + +- chores + > automated tasks + +- validation + > validation of files, commits, Merge Request titles, code quality, license checks. + +- build + > build any binaries or files that would be used in the later stages . + +- prepare + > any jobs that must run after build but before testing. for example a docker image build that includes artifacts from the build job + +- test + > unit, functional, integration and any other tests. + +- release + > git tagging and creating a gitlab release. Also includes adding build artifacts to gitlab registry. + +- sync + > repository synchronization, i.e. push mirror to github. + +- publish + > placement of build objects to external sources + + +## Git Sub-Module setup + +It is recommended that you set-up this repo as a git sub-module to your repo and that you configure it to a set commit/tag. This ensures that any change to `gitlab-ci` repo, does not effect your CI/CD jobs. + +run the following commands: + +``` bash + +git submodule add -b {ref} https://gitlab.com/nofusscomputing/projects/gitlab-ci.git gitlab-ci +git submodule update --remote + +``` + +!!! Tip + NOTE: `{ref}` should be replaced with the branch name, `master` is the stable branch and recommended. by default the sub-module will be created in folder `gitlab-ci`, it is recommended that you **don't** change this folder name. + + You can also substitute the gitlab url with the github url `https://github.com/NoFussComputing/gitlab-ci.git` for the submodule if you desire. this repo is auto-synced with github on each change to the repo. + +After each `git submodule update --remote` you will have to commit the sub-module update to your repo. Suggested commands as follows: + +``` bash + +git add .gitmodules + +git add gitlab-ci + +git commit -m "ci(gitlab-ci): updated to use version x + +{your reason here or explain what is provided/changed}" + +``` + +Then push the changes to your source. + + +## .gitlab-ci.yaml example + +example: + +``` yaml + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: master + file: + - .gitlab-ci_common.yaml + - $JOB_ROOT_DIR/{filepath to include here and is relative to the gitlab-ci repo root} + +variables: + MY_PROJECT_ID: "{your_project_id}" + +``` + +!!! Tip + Use a project import in your `.gitlab-ci.yml` file that is tied to a specific `ref`. for example a branch, commit or tag. Also ensure that the `gitlab-ci` `git sub-module` and the `ref` as part of the includes matches.* + + +## Artifacts + +Any artifacts by jobs will be created in folders named after the stage. + +preference is placed on jobs to output JUnit.xml test reports. This is because they are visible in merge requests. diff --git a/gitlab-ci/docs/projects/gitlab-ci/markdown_lint.md b/gitlab-ci/docs/projects/gitlab-ci/markdown_lint.md new file mode 100644 index 00000000..71c49ef9 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/markdown_lint.md @@ -0,0 +1,74 @@ +--- +title: Markdown File Linting +description: How to use No Fuss Computings gitlab-ci job for markdown linting +date: 2021-08-11 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This job lints markdown files as part of the validation CI stage. It is designated to run on all branches. If any errors are found, the generated JUnit test report will let you know what errors were found. + +You can include your linting rules in `.markdownlint.json` which should be within the root of your repository. for the available rules please see the [docs](https://github.com/DavidAnson/markdownlint/blob/main/README.md#rules--aliases). + +This job provides the following badge: + +- _None_ + + +## Dependencies + +- **Optional** file `.markdownlint.json` in repository root with any rules you wish to specify + + +## your .gitlab-ci.yml changes + +To use this job add the following to your `.gitlab-ci.yml` file + +``` yaml + +stages: + - validation + +include: + - local: CI/validation/.gitlab-ci.yml + +Markdown Linting: + extends: + - .Lint_Markdown + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| MDLINT_PATH | **Optional** specifies the path to lint. defaults to `"**/*.md"` | +| MDLINT_EXCLUDE_PATHS | **optional** Specifies the paths to exclude from linting. Defaults to `"!gitlab-ci"` | +| MD_LINT_CONFIG-PATH | **Optional** Specifies a path whenre the lint config file is. defaults to none. this variable enables you to specify a config that will be copied to the project root folder. ***Note:** if specified, the file will be deleted at the end of the linting job.* + + +## Job Workflow + +1. installs the required job dependencies + +1. Lints any markdow file found in `$MDLINT_PATH`, excluding paths `$MDLINT_EXCLUDE_PATHS` + + +## Artifacts + +- JUnit test report located at `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml` + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "lint/markdown.gitlab-ci.yaml" + +``` + +!!! Note + Docs Still under development diff --git a/gitlab-ci/docs/projects/gitlab-ci/mkdocs-build.md b/gitlab-ci/docs/projects/gitlab-ci/mkdocs-build.md new file mode 100644 index 00000000..bb7e9033 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/mkdocs-build.md @@ -0,0 +1,81 @@ +--- +title: MKDocs Static Site Build +description: How to use No Fuss Computings gitlab-ci job for MKDocs Static Site Build +date: 2021-08-11 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + + +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: + +- _None_ + +## Dependencies + +- **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 + +include: + - local: CI/build/.gitlab-ci.yml + +MKDocs build: + variables: + MKDOCS_BUILD_PATH: "build" + extends: + - .MKDocs_Build + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| MKDOCS_BUILD_PATH | **Mandatory, if different from default** The path where MKDocs places the build files. Defaults to `build` | +| MKDOCS_INCLUDE_SOURCE | **Optional** Include the build source files in the artifacts. Default is Not set. Any value in this variable, will include the source files. | +| MKDOCS_SOURCE_PATH | **Optional, if source files are not to be included** Set to the path where mkdocs uses to build the static html. | + + +## Job Workflow + +1. install mkdocs + + 1. if file `requirements.txt` exists in the repository root directory, use this fill to also install additional dependencies. + + 1. if no `requirements.txt` file exists, only install mkdocs. + +1. run mkdocs to build the static pages + +1. if variable `$MKDOCS_INCLUDE_SOURCE` is set, then copy `$MKDOCS_SOURCE_PATH` to the artifacts location. + +1. copy directory `$MKDOCS_BUILD_PATH` to the artifacts location. + + +## Artifacts + +- files in `"$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME"` + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "mkdocs/.gitlab-ci.yml" + +``` + +!!! Note + Docs Still under development diff --git a/gitlab-ci/docs/projects/gitlab-ci/python.md b/gitlab-ci/docs/projects/gitlab-ci/python.md new file mode 100644 index 00000000..6484c219 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/python.md @@ -0,0 +1,120 @@ +--- +title: Python +description: How to use No Fuss Computings gitlab-ci job for Python +date: 2021-08-11 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + + +This folder (`python`) covers jobs for python development + + +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} + +%2F-%2Fjobs%2Fartifacts%2F + +{branch} + +%2Fraw%2Fartifacts%2Fvalidation%2FPyLint%2Fbadge_pylint.json%3Fjob%3D + +{Job Name} + +)](https://gitlab.com/ + +{project path} + +/-/jobs/artifacts/ + +{branch} + +/file/ + +artifacts/validation/tests/gl-code-quality-report.html + +?job= + +{Job Name} +) + +``` + +| Variable | Description | +|:----|:----| +| `{project path}` | *project path, what's after gitlab.com/* | +| `{branch}` | *git branch to fetch the score from* | +| `{Job Name}` | *name of the gitlab-ci job for the linting* | + + +## Dependencies + +- None + + +## your .gitlab-ci.yml changes + +To add the `PyLint` job, add the following to your `.gitlab-ci.yml` file + +``` yaml + +stages: + - validation + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/master/python/.gitlab-ci.yml + +PyLint: + variables: + PYLINT_PATH: "/*/*.py" + PYLINT_RC_PATH: "." + extends: + - .PyLint + image: python:3.6-slim + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| PYLINT_PATH | *The path you wish the linter to search for python files* | +| PYLINT_RC_PATH | *The path to your `.pylintrc` file.* | + + +## Job Workflow + +- 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/gl-code-quality-report.json` - Gitlab code quality report (displays in merge request) + +- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html` - html code quality report + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "python/.gitlab-ci.yml" + +``` + +!!! Note + Docs Still under development diff --git a/gitlab-ci/docs/projects/gitlab-ci/templates/ansible_roles.md b/gitlab-ci/docs/projects/gitlab-ci/templates/ansible_roles.md new file mode 100644 index 00000000..0cfc2e8f --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/templates/ansible_roles.md @@ -0,0 +1,64 @@ +--- +title: Ansible +description: How to use No Fuss Computings gitlab-ci job for ansible +date: 2021-08-03 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This job does ansible role/playbook linting when any commit is pushed to any branch. + + +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 + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/ansible/.gitlab-ci.yml + +Ansible Lint (python 3.6): + variables: + ANSIBLE_LINT_PATH: "roles/" + extends: + - .ansible_linter_defaults + image: python:3.6-slim + +``` + +> You can use any python version you wish. + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| ANSIBLE_LINT_PATH | *The path you wish the linter to search for ansible roles/playbooks* | + + +## Job Workflow + +- 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 diff --git a/gitlab-ci/docs/projects/gitlab-ci/templates/automagic.md b/gitlab-ci/docs/projects/gitlab-ci/templates/automagic.md new file mode 100644 index 00000000..bfae8d68 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/templates/automagic.md @@ -0,0 +1,28 @@ +--- +title: Automatic Gitlab CI/CD jobs Template +description: How to use No Fuss Computings gitlab-ci template for auto creation of CI/CD joobs. +date: 2023-05-22 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This template is designed to autodetect which jobs should be created. By including it within your project, the jobs will be automagically created for the pipeline. + + +## Docs ToDo + +- document variables `PIPELINE_RUN_TRIGGER: 'false'` and `PIPELINE_RUN_SCHEDULE: 'false'` as being used as a gate to enable the jobs to run by the specified source. + + +!!! Note + Docs Still under development + + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "template/automagic.gitlab-ci.yaml" + +``` diff --git a/gitlab-ci/docs/projects/gitlab-ci/templates/docker_container.md b/gitlab-ci/docs/projects/gitlab-ci/templates/docker_container.md new file mode 100644 index 00000000..fb263956 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/templates/docker_container.md @@ -0,0 +1,37 @@ +--- +title: Docker Container CI Template +description: How to use No Fuss Computings gitlab-ci template for docker containers +date: 2023-05-13 +template: project.html +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 + +- notate that resource groups are used. also mention that the resource group allows the git tag pipeline as forced to wait for the previous pipeline, tag push to build the image first + +``` 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 + DOCKER_IMAGE_BUILD_REGISTRY: $CI_REGISTRY_IMAGE + DOCKER_IMAGE_BUILD_TAG: $CI_COMMIT_SHA + + # DOCKER_IMAGE_PUBLISH_NAME: $CI_PROJECT_NAME + # DOCKER_IMAGE_PUBLISH_REGISTRY: docker.io/nofusscomputing + # DOCKER_IMAGE_PUBLISH_URL: https://hub.docker.com/r/nofusscomputing/$DOCKER_IMAGE_PUBLISH_NAME + # JOB_STOP_CONVENTIONAL_COMMITS: 'any_value' + # 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' + +``` + +!!! Note + Docs Still under development diff --git a/gitlab-ci/docs/projects/gitlab-ci/templates/documentation_mkdocs.md b/gitlab-ci/docs/projects/gitlab-ci/templates/documentation_mkdocs.md new file mode 100644 index 00000000..45630b71 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/templates/documentation_mkdocs.md @@ -0,0 +1,33 @@ +--- +title: mkdocs documentation Gitlab CI/CD Template +description: How to use No Fuss Computings gitlab-ci template for building docs with mkdocs +date: 2023-05-22 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This template creates the jobs applicable to publishing pages to a website. The website in question is a static site built by MKDocs. + + +## Docs ToDo + +- notate that var `PAGES_ENVIRONMENT_PATH:` can be set to the slug of the page to show and is used for launching the environment to the url that contains the docs index page. + +- notate that resource groups are used. + +## Dependencies + +- **Mandatory** file `docs/index.md` this is the index page of your dcoumentation. + + +!!! Note + Docs Still under development + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "template/mkdocs-documentation.gitlab-ci.yaml" + +``` \ No newline at end of file diff --git a/gitlab-ci/docs/projects/gitlab-ci/templates/index.md b/gitlab-ci/docs/projects/gitlab-ci/templates/index.md new file mode 100644 index 00000000..6d5d0ca3 --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/templates/index.md @@ -0,0 +1,18 @@ +--- +title: Gitlab-CI Job Templates +description: How to use No Fuss Computings gitlab-ci project within your CI/CD pipelines +date: 2023-05-22 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +As part of our Gitlab CI job definitions we also have gitlab-ci.yaml templates that are specifically designed for inclusion and will automagically add the required jobs. + +## Docs ToDo + +- all templates are in the template folder. + +- explain `.gitlab-ci_common.yaml` is for inclusion by all, _suggested._ and will never create jobs, only specify defaults. is also included in all templates + +!!! Note + Docs Still under development diff --git a/gitlab-ci/docs/projects/gitlab-ci/yaml_lint.md b/gitlab-ci/docs/projects/gitlab-ci/yaml_lint.md new file mode 100644 index 00000000..c4ca22af --- /dev/null +++ b/gitlab-ci/docs/projects/gitlab-ci/yaml_lint.md @@ -0,0 +1,79 @@ +--- +title: YAML Linting +description: How to use No Fuss Computings gitlab-ci job for YAML Linting +date: 2021-08-11 +template: project.html +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 + + +## Dependencies + +- None + + +## your .gitlab-ci.yml changes + +To use this job add the following to your `.gitlab-ci.yml` file + +``` yaml + +stages: + - validation + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/master/yaml_lint/.gitlab-ci.yml + +Yaml Lint (python 3.6): + variables: + YAML_LINT_PATH: "." + YAML_LINT_EXTRA_ARGS: "{ extends: $ROOT_DIR/yaml_lint/.yamllint.yaml, ignore: [gitlab-ci/*] }" + extends: + - .yaml_linter_defaults + image: python:3.6-slim + +``` + +> You can use any python version you wish. + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| YAML_LINT_PATH | *The path you wish the linter to search for yaml files, defaults to `.`* | +| YAML_LINT_EXTRA_ARGS | *configuration in yaml format., defaults to `{ extends: $ROOT_DIR/yaml_lint/.yamllint.yaml, ignore: [gitlab-ci/*] }` for further info see the [YAML Lint docs](https://yamllint.readthedocs.io/en/stable/configuration.html?highlight=exclude#custom-configuration-without-a-config-file)* | + + +## Job Workflow + +- 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 + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "lint/yaml.gitlab-ci.yaml" + +``` + +!!! Note + Docs Still under development diff --git a/gitlab-ci/docs/projects/index.md b/gitlab-ci/docs/projects/index.md new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/docs/tags.md b/gitlab-ci/docs/tags.md new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/git_push_mirror/.gitlab-ci.yml b/gitlab-ci/git_push_mirror/.gitlab-ci.yml new file mode 100644 index 00000000..172f9bda --- /dev/null +++ b/gitlab-ci/git_push_mirror/.gitlab-ci.yml @@ -0,0 +1,32 @@ + +.git_push_mirror: + image: alpine:latest + stage: sync + before_script: + - apk update + - apk add git + script: + - if [ "0$GIT_SYNC_URL" == "0"]; then echo "[ERROR] you must define variable GIT_SYNC_URL for mirroring this repository."; fi + - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/$CI_PROJECT_PATH --mirror $CI_PROJECT_NAME + - cd $CI_PROJECT_NAME + - git remote add destination $GIT_SYNC_URL + - echo "https://gitlab.com/ $CI_PROJECT_PATH / $CI_PROJECT_NAME .git" + - git push destination --mirror + artifacts: + expire_in: 1 day + rules: + - if: '$JOB_STOP_GIT_PUSH_MIRROR' + when: never + + - if: $GIT_SYNC_URL == null + when: never + + - if: # condition_master_or_dev_push + ( + $CI_COMMIT_BRANCH == "master" || + $CI_COMMIT_BRANCH == "development" + ) && + $CI_PIPELINE_SOURCE == "push" + when: always + + - when: never diff --git a/gitlab-ci/git_push_mirror/CHANGELOG.md b/gitlab-ci/git_push_mirror/CHANGELOG.md new file mode 100644 index 00000000..41994a24 --- /dev/null +++ b/gitlab-ci/git_push_mirror/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2023-05-14 11:41:18 +0930 [1db2209](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1db2209dfb36fbdda28d68388aec9f62f85b57bc) - feat(git_push_mirror): always sync git tag +2023-05-13 15:35:28 +0930 [408e4ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - refactor: move docs as part of restructure +2023-05-13 11:47:56 +0930 [81445c0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/81445c06e43bce10761e3a7fbad7df97f82d6bc2) - feat(git_push_mirror): ability to disable job with variable +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-16 00:09:42 +0000 [1ef6c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef6c41818c40183f8019ea5cde48b4278e4d694) - build(version): bump version 0.4.0 → 0.5.0 +2022-01-15 03:53:53 +0000 [5c9000a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c9000a74859504ed64bbefa1fd193f80a2b69c2) - build(version): bump version 0.3.1 → 0.4.0 +2022-01-11 07:03:09 +0000 [7751fd9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7751fd9494f610fff0ea16bd303bfe62d0034eec) - build(version): bump version 0.3.0 → 0.3.1 +2021-08-12 03:32:36 +0000 [389bc08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/389bc08d7686153fb374aa83d440c35c9b4eac90) - build(version): bump version 0.3.0rc1 → 0.3.0 +2021-08-11 13:47:34 +0930 [def31ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/def31ef562c0002713401652657d59320548ee85) - style(yaml_lint): fixed yaml lint errors +2021-08-04 03:23:08 +0000 [eb5cc8a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb5cc8a0e2885a9ed16a8d1a81611aec4d5a4d31) - build(version): bump version 0.3.0rc0 → 0.3.0rc1 +2021-08-04 03:13:54 +0000 [09dcb65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/09dcb65b090f59e9f8a6bea5eba4bb98bddbad3d) - build(version): bump version 0.2.1 → 0.3.0rc0 +2021-08-04 02:49:45 +0000 [4453b43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4453b433c8966a334f02af592a6ce8092f2ac9de) - build(version): bump version 0.2.0 → 0.2.1 +2021-08-04 02:24:12 +0000 [856f2e1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/856f2e1770d0bda823996122ee70916dc0fe455b) - build(version): bump version 0.1.0 → 0.2.0 +2021-08-04 01:33:47 +0000 [6d34977](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d349774269bcd7c6e406cfe72c78b99f246df7b) - build(version): bump version 0.0.1 → 0.1.0 +2021-08-03 14:44:28 +0930 [247264e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/247264e36bc0b6c86d2f06f8dae09ff7447fc156) - docs(README.md): Added readme for the repo +2021-08-03 14:40:17 +0930 [7ffb204](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7ffb20418cfa8e6fa20cca60e42155171961d1ce) - docs(git_push_mirror): Update workflow and typos +2021-08-03 14:28:43 +0930 [9b28ae5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9b28ae5952adfb3d61e660814074ad3c7b42ff61) - feat(git_push_mirror): Added a job that syncs to a remote git repo diff --git a/gitlab-ci/gitlab_release/.gitlab-ci.yml b/gitlab-ci/gitlab_release/.gitlab-ci.yml new file mode 100644 index 00000000..fa3044e0 --- /dev/null +++ b/gitlab-ci/gitlab_release/.gitlab-ci.yml @@ -0,0 +1,124 @@ +.gitlab_release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + before_script: + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - apk update + - apk add git + - apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python + - python -m ensurepip && ln -sf pip3 /usr/bin/pip + - pip install --upgrade pip + - pip install -r $ROOT_DIR/gitlab_release/requirements.txt + - pip install $ROOT_DIR/gitlab_release/python-module/cz_nfc/. + - 'CLONE_URL="https://gitlab-ci-token:$GIT_COMMIT_TOKEN@gitlab.com/$CI_PROJECT_PATH.git"' + - echo "[DEBUG] CLONE_URL[$CLONE_URL]" + - git clone -b development $CLONE_URL repo + - cd repo + - git branch + - git config --global user.email "helpdesk@nofusscomputing.com" + - git config --global user.name "nfc_bot" + - git push --set-upstream origin development + - RELEASE_VERSION_CURRENT=$(cz -n cz_nfc version --project) + script: + - "$MY_COMMAND" + - if [ "$CI_COMMIT_BRANCH" == "development" ] ; then RELEASE_CHANGELOG=$(cz -n cz_nfc bump --changelog --changelog-to-stdout --prerelease rc); else RELEASE_CHANGELOG=$(cz -n cz_nfc bump --changelog --changelog-to-stdout); fi + - RELEASE_VERSION_NEW=$(cz -n cz_nfc version --project) + - RELEASE_TAG=$RELEASE_VERSION_NEW + - echo "[DEBUG] RELEASE_VERSION_CURRENT[$RELEASE_VERSION_CURRENT]" + - echo "[DEBUG] RELEASE_CHANGELOG[$RELEASE_CHANGELOG]" + - echo "[DEBUG] RELEASE_VERSION_NEW[$RELEASE_VERSION_NEW]" + - echo "[DEBUG] RELEASE_TAG[$RELEASE_TAG]" + - RELEASE_TAG_SHA1=$(git log -n1 --format=format:"%H") + - echo "[DEBUG] RELEASE_TAG_SHA1[$RELEASE_TAG_SHA1]" + - if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No tag to delete, version was not bumped"; else git tag -d $RELEASE_TAG; fi + + - if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No push will be conducted, version was not bumped"; else git push; fi + - if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No release will be created, version was not bumped"; else release-cli create --name "Release $RELEASE_TAG" --tag-name "$RELEASE_TAG" --tag-message "$RELEASE_CHANGELOG" --ref "$RELEASE_TAG_SHA1" --description "$RELEASE_CHANGELOG"; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git checkout master; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git push --set-upstream origin master; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git merge --no-ff development; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git push origin master; fi + after_script: + - rm -Rf repo + rules: + - if: '$JOB_STOP_GITLAB_RELEASE' + when: never + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + allow_failure: false + when: on_success + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + when: manual + allow_failure: true + + # for testing + # - if: '$CI_COMMIT_BRANCH != "master"' + # when: always + # allow_failure: true + - when: never + + +commit footer refs: + stage: validation + image: python:3.6-slim + variables: + DEFAULT_ROOT_DIR: './gitlab-ci' + before_script: + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - if [ "0$JOB_ROOT_DIR" == "0" ]; then export ROOT_DIR=$DEFAULT_ROOT_DIR; else export ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - apt update + - apt install --no-install-recommends -y git + - pip install -e $ROOT_DIR/gitlab_release/python-module/commit_footer/. + - git clone --depth 150 -b development $CI_REPOSITORY_URL check + - cd check + - git remote rm origin + - git remote add origin $CI_REPOSITORY_URL + - git fetch --all + - git checkout --track origin/$CI_COMMIT_BRANCH + script: + - commit_footer > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME.junit.xml" + artifacts: + expire_in: 1 days + when: always + paths: + - "$CI_PROJECT_DIR/artifacts/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml" + rules: + - if: '$JOB_STOP_CONVENTIONAL_COMMITS' + when: never + + - if: $CHANGELOG_FOOTER_REFERENCES == "False" + when: never + + # - if: '$CI_COMMIT_BRANCH == "development" || $CI_COMMIT_BRANCH == "master"' + # when: never + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" && + $CI_COMMIT_TAG == null + exists: + - .cz.yaml + changes: + paths: + - "**/**" + compare_to: development + when: always + + - when: never diff --git a/gitlab-ci/gitlab_release/CHANGELOG.md b/gitlab-ci/gitlab_release/CHANGELOG.md new file mode 100644 index 00000000..5b7a2186 --- /dev/null +++ b/gitlab-ci/gitlab_release/CHANGELOG.md @@ -0,0 +1,60 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-21 01:48:53 +0930 [088c9fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/088c9fb04c80961f4de8d2b129955ae8cd0b9529) - feat(conventional_commits): ensure .cz.yaml exists +2023-05-15 10:25:48 +0930 [18a2808](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18a280878799fe077efa0ed5b11bceedd53eb5c8) - fix(gitlab_release): allow skip on dev branch +2023-05-15 10:19:49 +0930 [d89941d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d89941df05bfed4b0ad1277e715b224d232e7949) - feat(gitlab_release): dont automagic run on dev +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2023-05-14 11:46:28 +0930 [e06ffef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e06ffef66c4a0ba1f48f109c175239560909e698) - feat(gitlab_release): run on merge to development +2023-05-14 11:45:24 +0930 [199ea1f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/199ea1f23c6a3df2b40ae3d9a5668719301500d9) - feat(gitlab_release): never run on merge or git tag +2023-05-14 11:44:20 +0930 [a745cea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a745ceac5ebce458b46593311e5285f40dcba349) - fix(gitlab_release): fixed rule to match nfc_bot +2023-05-14 11:41:47 +0930 [1fa7fec](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1fa7fec38a54b7ddf460b1394a7024ef161fab24) - refactor(gitlab_release): show debug before command +2023-05-14 11:39:53 +0930 [e76378d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e76378dd068e200a1198f1811efb9d3bec7878f5) - fix(gitlab_release): only run on master on_success +2023-05-14 09:56:35 +0930 [934a401](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/934a401a9620891b09a5fe9c9b0e50a97b43fa9b) - fix(ci): specify the commitizen version +2023-05-13 15:35:28 +0930 [408e4ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - refactor: move docs as part of restructure +2023-05-13 11:49:52 +0930 [8d512a9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8d512a9a4bd7f4895645436f057c4bab3efb864e) - feat(commit_footer_refs): ability to disable job with variable +2023-05-13 11:48:47 +0930 [a37acbf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a37acbfc7d3ea20ece7cb76e15a14858b26f8508) - feat(gitlab_release): ability to disable job with variable +2022-02-12 10:27:01 +0000 [9a7ae71](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9a7ae7106e80a038b31cdc9fc172bb1f974ecb94) - refactor: set correct commit details for nfc_bot +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-16 00:09:42 +0000 [1ef6c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef6c41818c40183f8019ea5cde48b4278e4d694) - build(version): bump version 0.4.0 → 0.5.0 +2022-01-16 09:02:44 +0930 [82c6c9f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/82c6c9f5d53594544cea9a7bc59a10ab1e9ebedd) - feat(commit_footer_refs): never run on development or master. +2022-01-15 03:53:53 +0000 [5c9000a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c9000a74859504ed64bbefa1fd193f80a2b69c2) - build(version): bump version 0.3.1 → 0.4.0 +2022-01-11 07:03:09 +0000 [7751fd9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7751fd9494f610fff0ea16bd303bfe62d0034eec) - build(version): bump version 0.3.0 → 0.3.1 +2021-08-12 14:46:26 +0930 [2ac22c0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2ac22c0e914016a8944ff9b94640f3e87f409069) - fix(commit_footer): fix bug introduced in code quality commit +2021-08-12 14:42:16 +0930 [ccc601f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ccc601f641a9b07b63a160d779c5037481316e75) - style(cz_nfc): code quality on cz_nfc.py +2021-08-12 14:27:41 +0930 [5676c5e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5676c5ee376f574a8581e8c8f4810eb5a7c511ba) - style(commit_footer): code quality on setup.py +2021-08-12 14:26:43 +0930 [3d69e57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3d69e57714cd529b13ddc9c575c2dc955a350dd9) - style(commit_footer): code quality on __main__.py +2021-08-12 14:21:34 +0930 [c093c31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c093c31cbd12989f7109dbcb6fd4f029c42a3919) - style(commit_footer): code quality on commits.py +2021-08-12 03:32:36 +0000 [389bc08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/389bc08d7686153fb374aa83d440c35c9b4eac90) - build(version): bump version 0.3.0rc1 → 0.3.0 +2021-08-11 13:47:34 +0930 [def31ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/def31ef562c0002713401652657d59320548ee85) - style(yaml_lint): fixed yaml lint errors +2021-08-11 12:17:50 +0930 [63af1ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/63af1efb4fd92a9f8755f766728a18d8f390b805) - fix(commit_footer_refs): Use the current git branch for comparison. +2021-08-08 15:57:50 +0930 [dc13d4f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/dc13d4f2841038c085dcf29dfb0b0c5d2f00f099) - docs(gitlab_release): Added user docs to fix errors from ci job 'commit footer refs' +2021-08-08 15:28:00 +0930 [22136f7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/22136f7dd22b9487d362a7ed63ca1b76e52b9cc7) - feat(gitlab_release): Toggle var added to enable switching changelog references. +2021-08-08 15:18:11 +0930 [eb0bf4c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb0bf4c1740dbd7a47ceb031c0d1c854899a1e40) - refactor(gitlab_release): file link to be in local repository for helping fix commit footer ref check failures +2021-08-08 15:05:35 +0930 [8177622](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/81776223c5cb392c12c7ca63488a1df10290e9d1) - refactor(gitlab_release): use a name for failed test to denote the issue +2021-08-08 15:03:12 +0930 [756b940](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/756b9406dde8cf0bf0030ac72855a054ece3a883) - feat(gitlab_release): be able to toggle commit footer check job +2021-08-08 14:51:57 +0930 [7cb676e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7cb676eb98a7de30d47a6b49a87067116684cfd2) - ci(gitlab_release): Add a validation job to check if commit messages contain a gitlab reference in the footer +2021-08-08 14:50:34 +0930 [11e1566](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/11e156619d0d820e534897bafd5f39e6f9defcbf) - feat(gitlab_release): python module to check if a commit message has gitlab references in the footer +2021-08-07 17:11:17 +0930 [8699c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8699c41219d70e6f41f42dc7f2c1bcf542b3f723) - feat(gitlab_release): Add commit footer to changelog +2021-08-07 14:56:51 +0930 [5f273ce](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5f273ce23a331eaf11623207ec4aba8b856c14f0) - docs(gitlab_release): Updated docs with new instructions on version incrementing +2021-08-07 14:31:19 +0930 [f76cabe](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f76cabeeb04b028a231dc1c232862db5fcad4345) - fix(gitlab_release): Adjust release workflow +2021-08-04 03:23:08 +0000 [eb5cc8a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb5cc8a0e2885a9ed16a8d1a81611aec4d5a4d31) - build(version): bump version 0.3.0rc0 → 0.3.0rc1 +2021-08-04 03:13:54 +0000 [09dcb65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/09dcb65b090f59e9f8a6bea5eba4bb98bddbad3d) - build(version): bump version 0.2.1 → 0.3.0rc0 +2021-08-04 12:39:01 +0930 [3e8c3ce](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3e8c3ce7cd64a6e9110818d32c15c3602fefb76c) - feat(gitlab_release): On the development brnach, releases to be 'rc' to denote considered non-stable +2021-08-04 12:24:02 +0930 [cc3fabd](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/cc3fabdaa28f97c3e1600e4a0d95a05bb547e772) - refactor(gitlab_release): Use Short commit SHA1 in main changelog link to gitlab +2021-08-04 02:49:45 +0000 [4453b43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4453b433c8966a334f02af592a6ce8092f2ac9de) - build(version): bump version 0.2.0 → 0.2.1 +2021-08-04 12:05:01 +0930 [588698d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/588698df2668853a97fe60901ab324310f34f279) - fix(gitlab_release): Correctly fetch the CI_PROJECT_URL for the environment +2021-08-04 02:24:12 +0000 [856f2e1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/856f2e1770d0bda823996122ee70916dc0fe455b) - build(version): bump version 0.1.0 → 0.2.0 +2021-08-04 11:50:41 +0930 [287b4c9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/287b4c954dddfaaf0a66af387676ea438cc80e61) - feat(gitlab_release): Include code refactor as part of the changelog +2021-08-04 11:48:28 +0930 [eebe8e3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eebe8e30dcb11cd239f35fcb98216b2ae4d20ece) - docs(gitlab_release): Include custom command instructions +2021-08-04 11:29:22 +0930 [7a69685](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7a69685b53cbe5bd7341a176bf63fd17d36bc7f0) - refactor(gitlab_release): Dont conduct any release, git push or tag delete if the version was not bumped +2021-08-04 11:16:44 +0930 [72e8b6c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/72e8b6c84defdb903c5741e3469651987769713f) - refactor(gitlab_release): build gitlab commit url for changelog so that there is a weblink to the changes +2021-08-04 01:33:47 +0000 [6d34977](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d349774269bcd7c6e406cfe72c78b99f246df7b) - build(version): bump version 0.0.1 → 0.1.0 +2021-08-04 11:00:19 +0930 [80ca361](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/80ca3618ee56d0f2a2c012416cb6206599a4f3f6) - fix(gitlab_release): A 'feat' commit must do a MINOR bump to version +2021-08-04 10:46:25 +0930 [ed5be7f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ed5be7fd3c16e86d48e179a2cded53a38f79e1d9) - fix(gitlab_release): ci image is alpine, use '/bin/sh' and add the changlogs to git cache for commiting +2021-08-04 10:44:57 +0930 [2035ed2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2035ed27af7fc1f3f5b2c42aa5874219fc5fe323) - refactor(gitlab_release): use 'git log' to get current commit hash +2021-08-04 10:43:25 +0930 [7706085](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7706085b09f3cd9b7c09f7f93b182fd425f6525a) - fix(gitlab_release): All tasks run as part of script including user custom script +2021-08-04 10:40:46 +0930 [1446c28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1446c28ed2bfe2efec99bc2fc83b111717bcb2af) - fix(gitlab_release): Use a user token to access the git repo for pushing commits back +2021-08-03 15:48:35 +0930 [6678a3d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6678a3dbab2763addc185e766cbaffbc074a6e98) - feat(git_release): Migrated from ansible-roles diff --git a/gitlab-ci/gitlab_release/python-module/commit_footer/__main__.py b/gitlab-ci/gitlab_release/python-module/commit_footer/__main__.py new file mode 100644 index 00000000..93466abb --- /dev/null +++ b/gitlab-ci/gitlab_release/python-module/commit_footer/__main__.py @@ -0,0 +1,6 @@ +#-*- coding: utf-8 -*- + +import cli + +if __name__ == '__main__': + cli.main() diff --git a/gitlab-ci/gitlab_release/python-module/commit_footer/cli.py b/gitlab-ci/gitlab_release/python-module/commit_footer/cli.py new file mode 100644 index 00000000..dcfad25e --- /dev/null +++ b/gitlab-ci/gitlab_release/python-module/commit_footer/cli.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- + +import sys +from commits import Commits + +def main(): + + commits = Commits() + + if commits.check(): + sys.exit(0) + else: + sys.exit(1) diff --git a/gitlab-ci/gitlab_release/python-module/commit_footer/commits.py b/gitlab-ci/gitlab_release/python-module/commit_footer/commits.py new file mode 100644 index 00000000..d1e447cb --- /dev/null +++ b/gitlab-ci/gitlab_release/python-module/commit_footer/commits.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- + +import os +import re +import git + +class Commits: + + + def __init__(self): + + self._repository = git.Repo(os.getcwd()) + + self._failed = [] + merge_base = self._repository.merge_base('development', self._repository.active_branch) + self._merge_base = str(merge_base[0]) + + self.fetch_all() + + + def fetch_all(self) -> bool: # get the commits and filter to only the current branch + + commits = list(self._repository.iter_commits(self._repository.active_branch)) + + clean = True + branch_commits = [] + for remove in commits: + + if str(remove).lower() == self._merge_base.lower(): + + clean = False + + if clean: + + branch_commits.append(remove) + + self._commits = branch_commits + + + def fetch(self, sha1:str) -> str: # fetch a single git message + + for commit in self._commits: + + if str(commit).lower() == sha1.lower(): + + return commit.message + + return '' + + # Get the last line of the commit message if has more than 2 lines + def footer(self, git_message:str) -> list: + footer = None + + if git_message.count("\n") > 2: + + footer_line = git_message.split("\n") + footer_line = footer_line[(len(footer_line)-1)] + + commit_footer = re.findall(r"([\!|\#][\d|not]+)", str(git_message)) + + if len(commit_footer) > 0: + footer = commit_footer + else: + footer = False + + return footer + + + def junit(self) -> bool: + + junit_testsuites = ''''''.format(len(self._failed), len(self._commits)) + + junit_testsuite = ''''''.format(len(self._failed), len(self._commits)) + + junit_testcase = '' + for commit in self._failed: + for key in commit: + junit_testcase += ''' + + {1} + + + + + + + '''.format(key, str(commit[key]), os.environ['ROOT_DIR']) + + + if junit_testcase == '': + junit_testcase = '''''' + + junit_close = '' + print(str(junit_testsuites)) + print(str(junit_testsuite)) + print(str(junit_testcase)) + print(str(junit_close)) + + + def check(self) -> bool: + check = True + + for commit in self._commits: + + if commit.message.count('\n') < 3: + continue + footer = self.footer(commit.message) + + if footer is False: + failed = {str(commit): str(commit.message)} + self._failed.append(failed) + continue + + self.junit() + + if len(self._failed) > 0: + check = False + + return check diff --git a/gitlab-ci/gitlab_release/python-module/commit_footer/setup.py b/gitlab-ci/gitlab_release/python-module/commit_footer/setup.py new file mode 100644 index 00000000..df83c8d0 --- /dev/null +++ b/gitlab-ci/gitlab_release/python-module/commit_footer/setup.py @@ -0,0 +1,13 @@ +from setuptools import setup + +setup( + name='NFC commit footer validation', + version='0.1.0', + py_modules=['main'], + license='MIT', + long_description='this is a long description', + install_requires=['gitpython'], + entry_points = { + 'console_scripts': ['commit_footer=cli:main'], + }, +) diff --git a/gitlab-ci/gitlab_release/python-module/cz_nfc/cz_nfc.py b/gitlab-ci/gitlab_release/python-module/cz_nfc/cz_nfc.py new file mode 100755 index 00000000..ba8bef78 --- /dev/null +++ b/gitlab-ci/gitlab_release/python-module/cz_nfc/cz_nfc.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- + +import os +import re + +import git as Git + +from commitizen import git +from commitizen.cz.base import BaseCommitizen + + +class NoFussCz(BaseCommitizen): + bump_pattern = r"^(break|new|fix|feat|hotfix|ci|docs)" + bump_map = { + "break": "MAJOR", + "new": "MINOR", + "feat": "MINOR", + "fix": "PATCH", + "hotfix": "PATCH", + "ci": "PATCH", + "docs": "PATCH" + } + + changelog_pattern = "^(break|new|fix|feat|hotfix|refactor|ci|docs)" + change_type_order = [ + "BREAKING CHANGE", + "feat", + "fix", + "refactor", + "perf", + "docs", + "ci" + ] + + change_type_map = { + "feat": "Features", + "fix": "Bug Fixes", + "refactor": "Code Refactor", + "perf": "Performance improvements", + "docs": "Documentaton / Guides", + "ci": "Continious Integration" + } + + commit_parser = r"^(?Pfeat|fix|refactor|perf|BREAKING CHANGE|refactor|ci|docs)(?:\((?P[^()\r\n]*)\)|\()?(?P!)?:\s(?P.*)?" + + + def changelog_message_builder_hook(self, parsed_message: dict, commit: git.GitCommit) -> dict: + rev = commit.rev + rev_short = str(rev)[0:8] + repo = Git.Repo(os.getcwd()) + + tree = list(repo.iter_commits(repo.active_branch)) + + footer_references = '' + for item in tree: + + if item.message.count("\n") > 2 and str(item).lower() == rev.lower(): + footer_line = item.message.split("\n") + footer_line = footer_line[(len(footer_line)-1)] + footer = re.findall(r"([\!|\#][0-9]+)", str(item.message)) + + try: + + for reference in footer: + + if '#' in reference: + + footer_references += ' ' + str( + '[{0}]({1}/-/issues/{2})'.format( + reference, + os.environ['CI_PROJECT_URL'], + reference.replace('#', '') + ) + ) + + if '!' in reference: + footer_references += ' ' + str( + '[{0}]({1}/-/merge_requests/{2})'.format( + reference, + os.environ['CI_PROJECT_URL'], + reference.replace('!', '') + ) + ) + + except Exception: + pass + + add_references = True + try: + + if os.environ['CHANGELOG_FOOTER_REFERENCES'] == 'False': + add_references = False + + except KeyError: # continue if the os var doesn't exist + add_references = True + + if footer_references != '' and add_references: + footer_references = ' [' + footer_references + ' ]' + else: + footer_references = '' + + msg = parsed_message["message"] + project_url = os.environ['CI_PROJECT_URL'] + parsed_message["message"] = f"[{rev_short}]({project_url}/-/commit/{rev}) - {msg}{footer_references}" + + return parsed_message + + + def questions(self) -> list: + raise NotImplementedError("Not Implemented yet") + + def message(self, answers: dict) -> str: + raise NotImplementedError("Not Implemented yet") + + +discover_this = NoFussCz diff --git a/gitlab-ci/gitlab_release/python-module/cz_nfc/setup.py b/gitlab-ci/gitlab_release/python-module/cz_nfc/setup.py new file mode 100644 index 00000000..15d0c43d --- /dev/null +++ b/gitlab-ci/gitlab_release/python-module/cz_nfc/setup.py @@ -0,0 +1,10 @@ +from setuptools import setup + +setup( + name='NFC commitizen Custom Bump Map and changelog', + version='0.1.0', + py_modules=['cz_nfc'], + license='MIT', + long_description='this is a long description', + install_requires=['commitizen', 'gitpython'] +) diff --git a/gitlab-ci/gitlab_release/requirements.txt b/gitlab-ci/gitlab_release/requirements.txt new file mode 100644 index 00000000..e46e7c52 --- /dev/null +++ b/gitlab-ci/gitlab_release/requirements.txt @@ -0,0 +1 @@ +commitizen==2.21.0 diff --git a/gitlab-ci/lint/.markdownlint-cli2.jsonc b/gitlab-ci/lint/.markdownlint-cli2.jsonc new file mode 100644 index 00000000..01f98e38 --- /dev/null +++ b/gitlab-ci/lint/.markdownlint-cli2.jsonc @@ -0,0 +1,5 @@ +{ + "outputFormatters": [ + [ "markdownlint-cli2-formatter-junit", { "name": "markdown.junit.xml" } ] + ] +} diff --git a/gitlab-ci/lint/.yamllint.yaml b/gitlab-ci/lint/.yamllint.yaml new file mode 100644 index 00000000..ba30e877 --- /dev/null +++ b/gitlab-ci/lint/.yamllint.yaml @@ -0,0 +1,26 @@ +--- +extends: default + +rules: + braces: {max-spaces-inside: 1, level: error} + brackets: {max-spaces-inside: 1, level: error} + colons: {max-spaces-after: -1, level: error} + commas: {max-spaces-after: -1, level: error} + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: + max: 2 + max-start: 1 + max-end: 1 + level: error + hyphens: {level: error} +# indentation: disable + indentation: + spaces: consistent + key-duplicates: enable + line-length: disable + new-line-at-end-of-file: disable + new-lines: {type: unix} + trailing-spaces: disable + truthy: disable diff --git a/gitlab-ci/lint/CHANGELOG.md b/gitlab-ci/lint/CHANGELOG.md new file mode 100644 index 00000000..a40a4fca --- /dev/null +++ b/gitlab-ci/lint/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-23 13:40:13 +0930 [e26f590](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e26f590ebcf284be949be4e1d337e1f587755446) - fix(md_linting): must lint on git tag +2023-05-23 09:10:19 +0930 [7c385b7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7c385b7552945699eb87ec3ec43169df0cb77297) - refactor(docs): pages dir renamed to docs +2023-05-22 13:43:28 +0930 [065bcbf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/065bcbf51717e6a29205ced8859a053a2915acd7) - chore(lint): correct lint errors +2023-05-22 13:05:21 +0930 [18af7f8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18af7f831ad2399a6ae9809c51e87f19450db1a7) - fix(markdown_lint): use new lint path +2023-05-22 13:04:11 +0930 [12d3a41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/12d3a412ac73baff16b77488db143efd7311b542) - fix(markdown_lint): typo in config variable +2023-05-22 12:57:08 +0930 [4fa90d4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4fa90d4c4249ed8929e7dde2e7bd0e8581d0d8a7) - feat(template): use md lint config from website-template +2023-05-22 12:00:25 +0930 [38d4690](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/38d469007a388312c71a61916275d6a12aad8bbd) - feat(markdown_lint): enable specifying the lint config path +2023-05-22 11:50:28 +0930 [bce7396](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bce7396d8bbf5ec6600a3a34a05198a87c4fcc70) - refactor(markdown_lint): move md linting to lint folder +2023-05-15 15:27:13 +0930 [a754aa8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a754aa81edf1570b4e8e2e7d4a23025c8b99f314) - fix(lint): use correct path for requirements.txt +2023-05-15 15:06:11 +0930 [539e40e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/539e40e3008e24411f62f439d394db4b5e69a066) - refactor: move ansible and yaml lint job to linting folder diff --git a/gitlab-ci/lint/ansible.gitlab-ci.yaml b/gitlab-ci/lint/ansible.gitlab-ci.yaml new file mode 100644 index 00000000..24794865 --- /dev/null +++ b/gitlab-ci/lint/ansible.gitlab-ci.yaml @@ -0,0 +1,81 @@ + +.ansible_linter_defaults: + stage: validation + variables: + ANSIBLE_LINT_PATH: defaults/ handlers/ meta/ tasks/ templates/ + before_script: + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'` + - apt update + - apt install --no-install-recommends -y git + - python3 -m venv env + - . env/bin/activate + - pip install --upgrade pip + - pip install -r $ROOT_DIR/lint/requirements.txt + - mkdir $PYTHON_VERSION + script: + - ansible-lint -q --nocolor --parseable $ANSIBLE_LINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-ansible-lint.log" 1>&1 || ANSIBLE_LINT=$? + - cat "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-ansible-lint.log" | ansible-lint-to-junit-xml > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-ansible-lint.junit.xml" 1>&1 || ANSIBLE_LINT_JUNIT=$? + - ls -la $PYTHON_VERSION + - if [ $ANSIBLE_LINT_JUNIT > 0 ]; then echo "Error ANSIBLE_LINT_JUNIT failed with $ANSIBLE_LINT_JUNIT"; fi + - if [ $ANSIBLE_LINT -ge 3 ]; then echo "ansible lint failed with $ANSIBLE_LINT"; exit $ANSIBLE_LINT; fi # don't fail the job?? 1=failed test, 2=failed command i.e. switch/flag + - | # Force failure if test must pass set TEST_MUST_PASS=yes + if [ "0$TEST_MUST_PASS" == "0yes" ]; then + + echo "Trace TEST_MUST_PASS[${TEST_MUST_PASS}]"; + + echo "ansible lint failed with $ANSIBLE_LINT"; + + exit $ANSIBLE_LINT; + + fi + + after_script: + - echo deactivate + artifacts: + expire_in: 3 days + when: always + paths: + - "artifacts/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml" + rules: + + - if: '$JOB_STOP_ANSIBLE_LINT' + when: never + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + exists: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + changes: + paths: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + changes: + paths: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + compare_to: 'development' + when: always + + - when: never diff --git a/gitlab-ci/lint/markdown.gitlab-ci.yaml b/gitlab-ci/lint/markdown.gitlab-ci.yaml new file mode 100644 index 00000000..dc2cc79b --- /dev/null +++ b/gitlab-ci/lint/markdown.gitlab-ci.yaml @@ -0,0 +1,102 @@ +.Lint_Markdown: + image: node:alpine3.14 + stage: validation + variables: + MDLINT_PATHS: "**/*.md **/**/*.md **/**/**/*.md **/**/**/**/*.md **/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci" + DEFAULT_ROOT_DIR: "./gitlab-ci" + MD_LINT_CONFIG_PATH: "" + before_script: + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown" + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - if [ "0$MD_LINT_CONFIG_PATH" != "0" ]; then cp "$MD_LINT_CONFIG_PATH/.markdownlint.json" $CI_PROJECT_DIR/.markdownlint.json; fi + - cp -f "$ROOT_DIR/lint/.markdownlint-cli2.jsonc" "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc" + - npm install markdownlint-cli2 --global + - npm install markdownlint-cli2-formatter-junit --global + script: + - echo "[DEBUG] MDLINT_PATHS=$MDLINT_PATHS" + - markdownlint-cli2 $MDLINT_PATHS 1>&1 || EXITCODE=$? + - echo DEBUG EXITCODE[$EXITCODE] + - rm -f "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc" + - if [ "0$MD_LINT_CONFIG-PATH" != "0" ]; then rm -f "$CI_PROJECT_DIR/.markdownlint.json"; fi + - mv *.junit.xml "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown/markdown_lint.junit.xml" + artifacts: + expire_in: 24 hrs + when: always + paths: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown/*.junit.xml" + rules: + - if: '$JOB_STOP_LINT_MARKDOWN' + when: never + + - if: # condition_any_branch_push + $CI_COMMIT_BRANCH != null && + $CI_COMMIT_TAG == null && + $CI_PIPELINE_SOURCE == "push" + exists: + # - "**.md" + # - "**/**.md" + - '{!docs/**,!pages/**,!gitlab-ci/**,!website-template/**,**}/*.md' + when: always + - when: never + + +.Lint_Markdown_Docs: + variables: + MDLINT_PATHS: "docs/*.md docs/**/*.md docs/**/**/*.md docs/**/**/**/*.md docs/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci !website-template" + MD_LINT_CONFIG_PATH: "$CI_PROJECT_DIR/website-template" + extends: .Lint_Markdown + rules: + - if: '$JOB_STOP_LINT_MARKDOWN_DOCS' + when: never + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{docs/**,pages/**}/*.md' + when: always + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' + when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + ( + $CI_PIPELINE_SOURCE == "pipeline" + || + $CI_PIPELINE_SOURCE == "push" + || + $CI_PIPELINE_SOURCE == "schedule" + ) + # See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE + exists: + - '{docs/**,pages/**}/*.md' + # No changes check # See nofusscomputing/projects/gitlab-ci#34 + # changes: + # paths: + # - '{docs/**,pages/**}/*.md' + # compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' # works + changes: + paths: + #- '{docs/*,pages/*}*.md' + - '{docs/**,pages/**}/*.md' + compare_to: 'development' + when: always + + - when: never diff --git a/gitlab-ci/lint/requirements.txt b/gitlab-ci/lint/requirements.txt new file mode 100644 index 00000000..5e254c3e --- /dev/null +++ b/gitlab-ci/lint/requirements.txt @@ -0,0 +1,11 @@ + +pipenv==2022.1.8 +wheel +ansible +setuptools_rust +Rust +ansible-lint==6.15.0 +yamllint==1.31.0 +lxml +ansible-lint-junit==0.17.7 +ansible-lint-to-junit-xml==0.1.0 diff --git a/gitlab-ci/lint/yaml.gitlab-ci.yaml b/gitlab-ci/lint/yaml.gitlab-ci.yaml new file mode 100644 index 00000000..1f493cc3 --- /dev/null +++ b/gitlab-ci/lint/yaml.gitlab-ci.yaml @@ -0,0 +1,97 @@ + +.yaml_lint_defaults: + variables: + YAML_LINT_PATH: "." + YAML_LINT_EXTRA_ARGS: "{ extends: $ROOT_DIR/lint/.yamllint.yaml, ignore: [gitlab-ci/*, website-template/*] }" + stage: validation + before_script: + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'` + - apt update + - apt install --no-install-recommends -y git + - python3 -m venv env + - . env/bin/activate + - pip install --upgrade pip + - pip install -r $ROOT_DIR/lint/requirements.txt + - mkdir $PYTHON_VERSION + script: + - echo "[DEBUG] YAML_LINT_PATH[$YAML_LINT_PATH]" + - echo "[DEBUG] YAML_LINT_CONFIG[$YAML_LINT_CONFIG]" + - yamllint $YAML_LINT_PATH -f parsable -d "$(echo $YAML_LINT_EXTRA_ARGS)" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-yaml-lint.log" 1>&1 || YAML_LINT=$? + - cat "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-yaml-lint.log" | ansible-lint-to-junit-xml > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-yaml-lint.junit.xml" + - if [ $YAML_LINT > 0 ]; then echo "YAML lint failed with $YAML_LINT"; exit $YAML_LINT; fi + after_script: + - echo deactivate + artifacts: + expire_in: 3 days + when: always + paths: + - "artifacts/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml" + rules: + - if: '$JOB_STOP_YAML_LINT' + when: never + + - if: '$CI_COMMIT_BRANCH == "master" && + ( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline")' + when: always + + - if: '$CI_COMMIT_BRANCH && + ( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline")' + exists: + - '{!gitlab-ci/**/*,!website-template/**/*,!.gitlab-ci,!*gitlab-ci*,**/*,**}.{yml,yaml}' + # - ".gitlab-ci*" + # - "**/*gitlab-ci*" + changes: + paths: + - '{!gitlab-ci/**/*,!website-template/**/*,!.gitlab-ci,!*gitlab-ci*,**/*,**}.{yml,yaml}' + compare_to: 'master' + when: always + + - when: never + + +.Gitlab_CI.Lint.YAML: + variables: + YAML_LINT_PATH: ".gitlab-ci* ./**/*gitlab-ci*" + YAML_LINT_EXTRA_ARGS: "{ extends: lint/.yamllint.yaml,ignore: [gitlab-ci/*,website-template/*] }" + extends: + - .yaml_lint_defaults + rules: + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{*,**/**,**}/*gitlab-ci*' + when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{*,**/**,**}/*gitlab-ci*' + changes: + paths: + - '{*,**/**,**}/*gitlab-ci*' + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{*,**/**,**}/*gitlab-ci*' + changes: + paths: + - '{*,**/**,**}/*gitlab-ci*' + compare_to: 'development' + when: always + + - when: never diff --git a/gitlab-ci/mkdocs.yml b/gitlab-ci/mkdocs.yml new file mode 100644 index 00000000..fbab0f56 --- /dev/null +++ b/gitlab-ci/mkdocs.yml @@ -0,0 +1,75 @@ +INHERIT: website-template/mkdocs.yml + +docs_dir: 'docs' + +repo_name: Gitlab-CI +repo_url: https://gitlab.com/nofusscomputing/projects/gitlab-ci +edit_uri: '/-/ide/project/nofusscomputing/projects/gitlab-ci/edit/development/-/docs/' + +nav: +- Home: index.md + +- Articles: + + - articles/index.md + +- Projects: + + - projects/index.md + + - Gitlab CI: + + - Ansible: + + - projects/gitlab-ci/ansible/collection.md + + - Build: + + - projects/gitlab-ci/docker_build.md + + - projects/gitlab-ci/mkdocs-build.md + + - Chores: + + - projects/gitlab-ci/ansible_playbook.md + + - Linting: + + - projects/gitlab-ci/markdown_lint.md + + - projects/gitlab-ci/yaml_lint.md + + - Publish: + + - projects/gitlab-ci/docker_publish.md + + - Templates: + + - projects/gitlab-ci/templates/index.md + + - projects/gitlab-ci/templates/ansible_roles.md + + - projects/gitlab-ci/templates/automagic.md + + - projects/gitlab-ci/templates/docker_container.md + + - projects/gitlab-ci/templates/documentation_mkdocs.md + + - Validation: + + - projects/gitlab-ci/conventional_commits.md + + - projects/gitlab-ci/index.md + + - projects/gitlab-ci/git_mirror.md + + - projects/gitlab-ci/gitlab_release.md + + - projects/gitlab-ci/python.md + +- Operations: + + - operations/index.md + +- Contact Us: contact.md + diff --git a/gitlab-ci/mkdocs/.gitkeep b/gitlab-ci/mkdocs/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/gitlab-ci/mkdocs/.gitlab-ci.yml b/gitlab-ci/mkdocs/.gitlab-ci.yml new file mode 100644 index 00000000..f5ee0b71 --- /dev/null +++ b/gitlab-ci/mkdocs/.gitlab-ci.yml @@ -0,0 +1,134 @@ +.MKDocs_Build: + image: python:3.11.2-bullseye + stage: build + variables: + GIT_DEPTH: 0 + MKDOCS_BUILD_PATH: build + MKDOCS_SOURCE_PATH: docs + DEFAULT_ROOT_DIR: './gitlab-ci' + before_script: + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - if [ ! -f "requirements.txt" ]; then pip install --upgrade pip -r $ROOT_DIR/mkdocs/requirements.txt; fi + - if [ -f "requirements.txt" ]; then pip install --upgrade pip -r $ROOT_DIR/mkdocs/requirements.txt; pip install -r requirements.txt; fi + - if [ -f "website-template/requirements.txt" ]; then pip install --upgrade pip -r $ROOT_DIR/mkdocs/requirements.txt; pip install -r website-template/requirements.txt; fi + script: + - mkdocs build --clean --strict + - mv "$MKDOCS_BUILD_PATH" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$MKDOCS_BUILD_PATH" + - if [ "0$MKDOCS_INCLUDE_SOURCE" != "0" ]; then cp $MKDOCS_SOURCE_PATH "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$MKDOCS_SOURCE_PATH"; fi + - ls -laR "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + artifacts: + expire_in: 24 hrs + paths: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + rules: + + - if: '$JOB_STOP_MKDOCS_BUILD' + when: never + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - 'mkdocs.{yaml,yml}' + when: always + + # - if: # condition_master_branch_push + # $CI_COMMIT_BRANCH == "master" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - 'mkdocs.{yaml,yml}' + # when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + ( + $CI_PIPELINE_SOURCE == "pipeline" + || + $CI_PIPELINE_SOURCE == "push" + || + $CI_PIPELINE_SOURCE == "schedule" + ) + # See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE + exists: + - 'mkdocs.{yaml,yml}' + # No changes check # See nofusscomputing/projects/gitlab-ci#34 + # changes: + # paths: + # - '{docs/**,pages/**}/*.md' + # compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - 'mkdocs.{yaml,yml}' + changes: + paths: + - '{docs/**,pages/**}/*.md' + compare_to: 'development' + when: always + + - when: never + + +.MKDocs_Build_Docs: + extends: .MKDocs_Build + variables: + MKDOCS_SOURCE_PATH: docs + rules: + - if: '$JOB_STOP_MKDOCS_BUILD' + when: never + + # Build docs on tag so they can be downloaded from the tag job and are always available. + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{docs/**,pages/**}/*.md' + when: always + + # - if: # condition_master_branch_push + # $CI_COMMIT_BRANCH == "master" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - '{docs/**,pages/**}/*.md' + # when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + ( + $CI_PIPELINE_SOURCE == "pipeline" + || + $CI_PIPELINE_SOURCE == "push" + || + $CI_PIPELINE_SOURCE == "schedule" + ) + # See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE + exists: + - 'mkdocs.{yaml,yml}' + # No changes check # See nofusscomputing/projects/gitlab-ci#34 + # changes: + # paths: + # - '{docs/**,pages/**}/*.md' + # compare_to: 'master' + when: always + + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' + changes: + paths: + - '{docs/**,pages/**}/*.md' + compare_to: 'development' + when: always + + - when: never + \ No newline at end of file diff --git a/gitlab-ci/mkdocs/CHANGELOG.md b/gitlab-ci/mkdocs/CHANGELOG.md new file mode 100644 index 00000000..fe248804 --- /dev/null +++ b/gitlab-ci/mkdocs/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-23 09:46:43 +0930 [7a9aca3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7a9aca3a54b1faacb7e286bade84aff0ff4fd2e5) - fix(mkdocs): default to docs directory as root +2023-05-22 18:05:24 +0930 [71a335c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/71a335c2667505c199bd67446327cd8794de5f52) - feat(mkdocs): install website-template requirements +2023-05-22 13:20:27 +0930 [a0b6d05](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a0b6d05a0f3f0fa84c825007f6ec9f28c945f3ef) - feat(mkdocs_build): always build +2023-05-22 13:01:18 +0930 [6d2e50e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d2e50e947839576f098bd7700e00b9d6ab4be1e) - feat(mkdocs_build): add manual build +2023-05-21 15:59:14 +0930 [dacb9f2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/dacb9f22dd9aee1ff741c7ac8078912d9a2b0dbf) - refactor(mkdocs): use locked version from website repo +2023-05-21 15:43:45 +0930 [5556a57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5556a57ea5588d4f0cd1434bfdde5cd77e3b4f5c) - feat(mkdocs): only run on success +2023-05-21 15:41:05 +0930 [1ec2666](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ec2666e8565d5206aefaf5462f0f83f74fbbcb7) - docs(mkdocs): moved to pages folder +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-24 14:08:14 +0930 [a2d705d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a2d705deb1f3898b6d5fa4d55bd995b1a7ad4b68) - ci(mkdcos): mkdocs requirements.txt had a '\n' in the filename. renamed. +2022-01-23 05:31:06 +0000 [906f09e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/906f09e2d3285681bd982d65eda3f56cf5a5169e) - feat(mkdocs_build): use a pip file for job so that licence scanning can function. +2022-01-23 05:18:27 +0000 [18c2e23](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18c2e2312896aa0ba07050d28155c7aaca2aee5c) - chore(mkdocs): move mkdocs jobs to its own directory. +2022-01-23 04:25:35 +0000 [5a41962](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5a41962a994a54d99a3e7ab1bc0d7379ea14c1c2) - feat(mkdocs_build): move ci job dependencies to a pip file so that the ci dependency job can check versions. +2022-01-23 04:22:38 +0000 [7665e51](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7665e512a5d6e5aab3f8c0a8241d4182f3362442) - chore: add mkdocs dir for pip file. diff --git a/gitlab-ci/mkdocs/requirements.txt b/gitlab-ci/mkdocs/requirements.txt new file mode 100644 index 00000000..d1e75433 --- /dev/null +++ b/gitlab-ci/mkdocs/requirements.txt @@ -0,0 +1,11 @@ +mkdocs==1.5.3 +mkdocstrings==0.25.1 +mkdocstrings-python==1.10.3 +mkdocs-minify-plugin==0.8.0 +mkdocs-material-extensions==1.3.1 +wheel +mkdocs-material==9.5.6 +./website-template/custom-plugins/mkdocs-plugin-tags +mkdocs-git-revision-date-localized-plugin==1.2.2 +pymdown-extensions==10.7 +Jinja2==3.1.3 diff --git a/gitlab-ci/python/.gitlab-ci.yml b/gitlab-ci/python/.gitlab-ci.yml new file mode 100644 index 00000000..f8204038 --- /dev/null +++ b/gitlab-ci/python/.gitlab-ci.yml @@ -0,0 +1,85 @@ + +.pylint_badge: &pylint_badge | + echo "{ + \"PyLintScore\": \"$PyPIScore\" + }" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/badge_pylint.json" + +.PyLint: + variables: + PYLINT_PATH: "/*/python-module/*/*.py" + PYLINT_RC_PATH: "/python/.pylintrc" + stage: validation + before_script: + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'` + - apt update + - apt install --no-install-recommends -y git + - python3 -m venv env + - . env/bin/activate + - pip install --upgrade pip + - pip install -r $ROOT_DIR/python/requirements.txt + - mkdir $PYTHON_VERSION + script: + - PYLINT_PATH=$ROOT_DIR$PYLINT_PATH + - echo "[DEBUG] PYLINT_PATH[$PYLINT_PATH]" + - PYLINT_RC_PATH=$ROOT_DIR$PYLINT_RC_PATH + - echo "[DEBUG] PYLINT_RC_PATH[$PYLINT_RC_PATH]" + - python3 -m pylint --rcfile $PYLINT_RC_PATH --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.json" + + - python3 -m pylint --rcfile $PYLINT_RC_PATH --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html" + + - PyPIScore=$(python3 -m pylint --rcfile $PYLINT_RC_PATH --exit-zero $PYLINT_PATH | sed -n 's/^Your code has been rated at \([-0-9./]*\).*/\1/p') + + - *pylint_badge + + after_script: + - echo deactivate + artifacts: + expire_in: 1 days + when: always + paths: + - "artifacts/*" + reports: + codequality: "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.json" + rules: + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + exists: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + when: always + + - if: # condition_development_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + changes: + paths: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + changes: + paths: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + compare_to: 'development' + when: always + + - when: never + diff --git a/gitlab-ci/python/.pylintrc b/gitlab-ci/python/.pylintrc new file mode 100644 index 00000000..83182234 --- /dev/null +++ b/gitlab-ci/python/.pylintrc @@ -0,0 +1,5 @@ +[MASTER] +disable= + C0114, # missing-module-docstring + C0115, # missing-class-docstring + C0116, # missing-function-docstring diff --git a/gitlab-ci/python/CHANGELOG.md b/gitlab-ci/python/CHANGELOG.md new file mode 100644 index 00000000..60149018 --- /dev/null +++ b/gitlab-ci/python/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2023-05-13 15:35:28 +0930 [408e4ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - refactor: move docs as part of restructure +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-16 00:09:42 +0000 [1ef6c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef6c41818c40183f8019ea5cde48b4278e4d694) - build(version): bump version 0.4.0 → 0.5.0 +2022-01-15 03:53:53 +0000 [5c9000a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c9000a74859504ed64bbefa1fd193f80a2b69c2) - build(version): bump version 0.3.1 → 0.4.0 +2022-01-11 07:03:09 +0000 [7751fd9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7751fd9494f610fff0ea16bd303bfe62d0034eec) - build(version): bump version 0.3.0 → 0.3.1 +2021-08-12 15:06:07 +0930 [4b6cc31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4b6cc3176fc4acc3b7dbb954162802af9cbb4c68) - fix(pylint): install the required packages for files being checked +2021-08-12 14:49:00 +0930 [936299a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/936299aefc6eadf9cbfec3152b352b321969cfab) - fix(pylint): fix bug introduced in code quality commit +2021-08-12 14:04:32 +0930 [73e061e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/73e061e649e8fbeee34c6d18cf1f901b394a1f26) - build(pylint): added .pylintrc to exclude some rules +2021-08-12 03:32:36 +0000 [389bc08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/389bc08d7686153fb374aa83d440c35c9b4eac90) - build(version): bump version 0.3.0rc1 → 0.3.0 +2021-08-11 15:51:45 +0930 [d610562](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d61056243804728e059b99fce1644a8cc37230bb) - feat(python_linting): added ci job, python linting, code quality and scoring diff --git a/gitlab-ci/python/requirements.txt b/gitlab-ci/python/requirements.txt new file mode 100644 index 00000000..703669b9 --- /dev/null +++ b/gitlab-ci/python/requirements.txt @@ -0,0 +1,4 @@ +pylint==2.9.6 +pylint-gitlab==0.3.0 +gitpython==3.1.18 +commitizen==2.17.13 diff --git a/gitlab-ci/sub-folder_changlog.sh b/gitlab-ci/sub-folder_changlog.sh new file mode 100755 index 00000000..a4eac1f2 --- /dev/null +++ b/gitlab-ci/sub-folder_changlog.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +for D in *; do + if [ -d "${D}" ]; then + + if [ "0${D}" != "0website-template" ] && [ "0${D}" != "0docs" ]; then + echo "[DEBUG] Creating changelog for sub-folder: ${D}" + + CHANGELOG_DATA=$(git log --pretty="format:%ci [%h](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/%H) - %s " --follow -- "${D}") + + echo "# Changelog" > ${D}/CHANGELOG.md + + echo "" >> ${D}/CHANGELOG.md + echo "$CHANGELOG_DATA" >> ${D}/CHANGELOG.md + + git add ${D}/CHANGELOG.md + + fi + fi +done diff --git a/gitlab-ci/template/CHANGELOG.md b/gitlab-ci/template/CHANGELOG.md new file mode 100644 index 00000000..28b8393e --- /dev/null +++ b/gitlab-ci/template/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-27 15:24:21 +0930 [19dde28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/19dde28526d5e3f7694da3246505537aa2e19c10) - chore: fix linting error +2023-05-27 15:21:27 +0930 [c5d27e8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c5d27e832e100156cb99c5ca580fd5a8eb600e0f) - feat(auto_jobs): created initial template to auto-create jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-23 12:37:40 +0930 [bef7684](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bef76847ec686fcff92229d7b9be0bcfc7b267da) - feat(template_website): enable specifying the url slug +2023-05-23 09:10:19 +0930 [7c385b7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7c385b7552945699eb87ec3ec43169df0cb77297) - refactor(docs): pages dir renamed to docs +2023-05-22 13:45:03 +0930 [0b9e737](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0b9e7375c911d65e06b0d801755449ab31cb45ea) - fix(template): use correct path for build artifact +2023-05-22 13:43:28 +0930 [065bcbf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/065bcbf51717e6a29205ced8859a053a2915acd7) - chore(lint): correct lint errors +2023-05-22 13:20:54 +0930 [8e2a233](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8e2a233814bd76ebff3dd8ed5a79afe307a84755) - feat(template): always deploy to pages on dev manual other +2023-05-22 13:13:59 +0930 [1b59d62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1b59d62348465cc9cc069d5ee23e759316fa9b3c) - refactor(template_website): adjust names of jobs +2023-05-22 12:57:08 +0930 [4fa90d4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4fa90d4c4249ed8929e7dde2e7bd0e8581d0d8a7) - feat(template): use md lint config from website-template +2023-05-22 11:50:28 +0930 [bce7396](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bce7396d8bbf5ec6600a3a34a05198a87c4fcc70) - refactor(markdown_lint): move md linting to lint folder +2023-05-21 16:40:44 +0930 [16d47d5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/16d47d5e350e1c78f72c97780ed1732a43927fcc) - feat(website): add pages job for website +2023-05-21 15:53:54 +0930 [91a50eb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/91a50eb15bd92ca65481a73c6f095681281941fe) - feat(template): created website job template +2023-05-17 15:41:09 +0930 [a90ccb8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a90ccb81772e295cebe89d7a9c32ab700e19884d) - refactor(docker): move docker jobs to their own file +2023-05-17 15:38:11 +0930 [c34e382](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c34e382a22cd39874abd8fb5116e831e888db8af) - refactor: use name that makes sense diff --git a/gitlab-ci/template/ansible-collection.gitlab-ci.yaml b/gitlab-ci/template/ansible-collection.gitlab-ci.yaml new file mode 100644 index 00000000..b82e88d3 --- /dev/null +++ b/gitlab-ci/template/ansible-collection.gitlab-ci.yaml @@ -0,0 +1,101 @@ + +include: + - local: $JOB_ROOT_DIR/ansible/collection/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/lint/ansible.gitlab-ci.yaml + + +Create Release: + extends: .ansible_collection_merge + needs: [] + + +Ansible Lint: + extends: .ansible_linter_defaults + image: python:3.11-slim + variables: + ANSIBLE_LINT_PATH: meta/ playbooks/ roles/ + needs: [] + rules: + + - if: $CI_COMMIT_TAG + when: always + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "development" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - if: + $CI_COMMIT_BRANCH != "development" + && + $CI_COMMIT_BRANCH != "master" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - when: never + + +# ToDo: add lint for README.md as ansible Galaxy doesn't seem to like html in the md document. 16 Feb 24. + + +Ansible Lint (galaxy.yml): + extends: .ansible_linter_defaults + image: python:3.11-slim + variables: + ANSIBLE_LINT_PATH: galaxy.yml + TEST_MUST_PASS: 'yes' + needs: [] + rules: + + - if: $CI_COMMIT_TAG + when: always + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "development" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - if: + $CI_COMMIT_BRANCH != "development" + && + $CI_COMMIT_BRANCH != "master" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - when: never + + +Build Collection: + extends: .ansible_collection_build + needs: + - Ansible Lint + - Ansible Lint (galaxy.yml) + + +Stage Collection: + extends: .ansible_collection_stage_package + needs: + - Build Collection + + +Gitlab Release: + extends: .ansible_collection_release + needs: + - Stage Collection + + +Ansible Galaxy: + extends: .ansible_collection_publish_galaxy + needs: + - Stage Collection + - Gitlab Release diff --git a/gitlab-ci/template/ansible-role.gitlab-ci.yaml b/gitlab-ci/template/ansible-role.gitlab-ci.yaml new file mode 100644 index 00000000..ffeb81db --- /dev/null +++ b/gitlab-ci/template/ansible-role.gitlab-ci.yaml @@ -0,0 +1,29 @@ +# This gitlab-ci file is used for creating docker images. +# by including this file, the jobs will be autocreated. + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + - local: $JOB_ROOT_DIR/lint/ansible.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml + + +Ansible Lint (python 3.11): + variables: + ANSIBLE_LINT_PATH: defaults/ handlers/ meta/ tasks/ templates/ + extends: + - .ansible_linter_defaults + image: python:3.11-slim + resource_group: build + needs: [] + + +Gitlab Release: + extends: + - .gitlab_release + + +Github (Push --mirror): + extends: + - .git_push_mirror \ No newline at end of file diff --git a/gitlab-ci/template/automagic.gitlab-ci.yaml b/gitlab-ci/template/automagic.gitlab-ci.yaml new file mode 100644 index 00000000..7d3d04f8 --- /dev/null +++ b/gitlab-ci/template/automagic.gitlab-ci.yaml @@ -0,0 +1,52 @@ +# This gitlab-ci file is used for the autocreation of ci jobs. +# by including this file, the jobs will be autocreated if they are detected as required. + +variables: + NFC_AUTO_JOBS: 'true' + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + + # Chore + - local: $JOB_ROOT_DIR/automation/.gitlab-ci-ansible.yaml + + # Validation + - local: $JOB_ROOT_DIR/lint/ansible.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml + + # sync + - local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml + + # release + - local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml + + # templates + - local: $JOB_ROOT_DIR/template/ansible-role.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/template/docker-image.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/template/mkdocs-documentation.gitlab-ci.yaml + + +# +# Chores +# +Update Git Submodules: + extends: .ansible_playbook_git_submodule + +Search Issues for git patches: + extends: .ansible_playbook_mr_from_issue_comment_patch + +# +# Release +# +Gitlab Release: + extends: + - .gitlab_release + + +# +# Sync +# +Github (Push --mirror): + extends: + - .git_push_mirror + needs: [] diff --git a/gitlab-ci/template/docker-image.gitlab-ci.yaml b/gitlab-ci/template/docker-image.gitlab-ci.yaml new file mode 100644 index 00000000..dae241a0 --- /dev/null +++ b/gitlab-ci/template/docker-image.gitlab-ci.yaml @@ -0,0 +1,85 @@ +# This gitlab-ci file is used for creating docker images. +# by including this file, the jobs will be autocreated. + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + - local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/docker/build.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/docker/publish.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml + + +variables: + # 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 + DOCKER_IMAGE_BUILD_REGISTRY: $CI_REGISTRY_IMAGE + DOCKER_IMAGE_BUILD_TAG: $CI_COMMIT_SHA + + # DOCKER_IMAGE_PUBLISH_NAME: $CI_PROJECT_NAME + # DOCKER_IMAGE_PUBLISH_REGISTRY: docker.io/nofusscomputing + # DOCKER_IMAGE_PUBLISH_URL: https://hub.docker.com/r/nofusscomputing/$DOCKER_IMAGE_PUBLISH_NAME + # JOB_STOP_CONVENTIONAL_COMMITS: 'any_value' + # 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' + + +Docker Container: + extends: .build_docker_container + resource_group: build + needs: [] + + +Docker.Hub.Branch.Publish: + extends: .publish-docker-hub + needs: [ "Docker Container" ] + resource_group: build + rules: # rules manually synced from docker/publish.gitlab-ci.yaml removing git tag + + # - if: # condition_master_branch_push + # $CI_COMMIT_BRANCH == "master" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - '{dockerfile,dockerfile.j2}' + # when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{dockerfile,dockerfile.j2}' + changes: + paths: + - '{dockerfile,dockerfile.j2,includes/**/*}' + compare_to: 'master' + allow_failure: true + when: on_success + + - when: never + + +Docker.Hub.Tag.Publish: + extends: .publish-docker-hub + resource_group: build + rules: # rules manually synced from docker/publish.gitlab-ci.yaml only keeping git tag + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{dockerfile,dockerfile.j2}' + when: always + + - when: never + + +Gitlab Release: + extends: + - .gitlab_release + + +Github (Push --mirror): + extends: + - .git_push_mirror \ No newline at end of file diff --git a/gitlab-ci/template/mkdocs-documentation.gitlab-ci.yaml b/gitlab-ci/template/mkdocs-documentation.gitlab-ci.yaml new file mode 100644 index 00000000..6010c445 --- /dev/null +++ b/gitlab-ci/template/mkdocs-documentation.gitlab-ci.yaml @@ -0,0 +1,63 @@ +# This gitlab-ci file is used for creating building pages directories for nofusscomputing.com. +# by including this file, the jobs will be autocreated and only for pages jobs. + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + - local: $JOB_ROOT_DIR/mkdocs/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/lint/markdown.gitlab-ci.yaml + + +Documentation.Lint: + extends: .Lint_Markdown_Docs + needs: [] + + +Documentation.Build: + extends: .MKDocs_Build_Docs + needs: [ 'Documentation.Lint' ] + resource_group: Documentation + +# this name must always be called 'pages' so that gitlab pages work +pages: + stage: deploy + resource_group: Documentation + variables: + GIT_STRATEGY: none + script: + - mv "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build" public + needs: [ 'Documentation.Build' ] + environment: + name: Gitlab Pages + url: $CI_PAGES_URL/$PAGES_ENVIRONMENT_PATH + artifacts: + paths: + - public + rules: + - if: '$JOB_STOP_GITLAB_PAGES' + when: never + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' + changes: + paths: + - '{docs/**,pages/**}/*.md' + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' + changes: + paths: + - '{docs/**,pages/**}/*.md' + compare_to: 'development' + allow_failure: true + when: manual + + - when: never diff --git a/gitlab-ci/test/.gitlab-ci.yml b/gitlab-ci/test/.gitlab-ci.yml new file mode 100644 index 00000000..64e3b992 --- /dev/null +++ b/gitlab-ci/test/.gitlab-ci.yml @@ -0,0 +1,99 @@ +# This gitlab-ci file is for testing job rules + + +API Only: + stage: test + needs: [] + script: + - echo should only run on + rules: + - if: + $CI_PIPELINE_SOURCE == "api" + when: always + + - when: never + + +Push Only: + stage: test + needs: [] + script: + - echo testing rules + rules: + - if: + $CI_COMMIT_BRANCH != "" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - when: never + + +MR-On Merging Only: + stage: test + needs: [] + script: + - echo should only run on merging a MR + rules: + - if: + $CI_MERGE_REQUEST_IID == "" + && + $CI_PIPELINE_SOURCE == "merge_request_event" + when: always + + - when: never + + +MR-Not On Merging: + stage: test + needs: [] + script: + - echo should never run on merging a MR + rules: + - if: + $CI_MERGE_REQUEST_IID != "" + && + $CI_PIPELINE_SOURCE == "merge_request_event" + when: always + + - when: never + + +MR-Merge Request Event: + stage: test + needs: [] + script: + - echo should only run on merge event + rules: + - if: + $CI_PIPELINE_SOURCE == "merge_request_event" + when: always + + - when: never + + +Trigger Only: + stage: test + needs: [] + script: + - echo should only run on trigger event + rules: + - if: + $CI_PIPELINE_SOURCE == "trigger" + when: always + + - when: never + + +Web Only: + stage: test + needs: [] + script: + - echo should only run on web only trigger + rules: + - if: + $CI_PIPELINE_SOURCE == "web" + when: always + + - when: never + diff --git a/gitlab-ci/website-template/.cz.yaml b/gitlab-ci/website-template/.cz.yaml new file mode 100644 index 00000000..62b2ada1 --- /dev/null +++ b/gitlab-ci/website-template/.cz.yaml @@ -0,0 +1,7 @@ +commitizen: + bump_message: "build(version): bump version $current_version \u2192 $new_version" + changelog_incremental: false + name: cz_conventional_commits + tag_format: $major.$minor.$patch$prerelease + update_changelog_on_bump: true + version: 0.0.1 diff --git a/gitlab-ci/website-template/.gitlab-ci.yml b/gitlab-ci/website-template/.gitlab-ci.yml new file mode 100644 index 00000000..a92fb24b --- /dev/null +++ b/gitlab-ci/website-template/.gitlab-ci.yml @@ -0,0 +1,93 @@ +--- + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: development + file: + - .gitlab-ci_common.yaml + - template/automagic.gitlab-ci.yaml + + +variables: + MY_PROJECT_ID: "38927651" + + +Ansible_playbooks.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_playbooks + + +Ansible-roles.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible-roles + + +common.ansible_role.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/common + + +Docker_Mail.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-mail + + +docker-buildx-qemu.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-buildx-qemu + + +execution_environment.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/execution_environment + + +git_configuration.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/git_configuration + + +gitlab-ci.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/gitlab-ci + + +firewall.ansible_role.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/firewall + + +kubernetes.ansible_role.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/kubernetes + + +Ops.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/ops + + +Website.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/website + + +Documentation.Lint: + rules: + - when: never + +Documentation.Build: + rules: + - when: never \ No newline at end of file diff --git a/gitlab-ci/website-template/.gitmodules b/gitlab-ci/website-template/.gitmodules new file mode 100644 index 00000000..ec715666 --- /dev/null +++ b/gitlab-ci/website-template/.gitmodules @@ -0,0 +1,4 @@ +[submodule "gitlab-ci"] + path = gitlab-ci + url = https://gitlab.com/nofusscomputing/projects/gitlab-ci.git + branch=development diff --git a/gitlab-ci/website-template/.markdownlint.json b/gitlab-ci/website-template/.markdownlint.json new file mode 100644 index 00000000..9d7c7401 --- /dev/null +++ b/gitlab-ci/website-template/.markdownlint.json @@ -0,0 +1,20 @@ +{ + "line-length": false, + "MD007": { + "indent": 4 + }, + "MD033": { + "allowed_elements": [ "div", "span", "u", "p" ] + }, + "blanks-around-headings":{ + "lines_above": 2, + "lines_below": 1 + }, + "MD012": { + "maximum": 2 + }, + "comment": { + "MD012": "MD012 max=2 added so that headings can have two lines above for clarity.", + "html_s": "don't allow html as this can be done in markdown" + } +} diff --git a/gitlab-ci/website-template/.nfc_automation.yaml b/gitlab-ci/website-template/.nfc_automation.yaml new file mode 100644 index 00000000..077d7f44 --- /dev/null +++ b/gitlab-ci/website-template/.nfc_automation.yaml @@ -0,0 +1,8 @@ +--- + +role_git_conf: + gitlab: + submodule_branch: "development" + default_branch: development + mr_labels: ~"type::automation" ~"impact::0" ~"priority::0" + auto_merge: true diff --git a/gitlab-ci/website-template/LICENSE b/gitlab-ci/website-template/LICENSE new file mode 100644 index 00000000..248717ef --- /dev/null +++ b/gitlab-ci/website-template/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Jon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/.gitignore b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/.gitignore new file mode 100755 index 00000000..f56be719 --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/.gitignore @@ -0,0 +1,125 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +# docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/LICENSE.md b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/LICENSE.md new file mode 100755 index 00000000..4720011e --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/LICENSE.md @@ -0,0 +1,7 @@ +# License + +Copyright (C) 2021 No Fuss Computing + +All Rights Reserved. + +Not yet suitable for public release. diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/MANIFEST.in b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/MANIFEST.in new file mode 100755 index 00000000..ebd0c96a --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/MANIFEST.in @@ -0,0 +1,2 @@ +include versioneer.py +include tags/_version.py diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/README.md b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/README.md new file mode 100755 index 00000000..b473fd91 --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/README.md @@ -0,0 +1,128 @@ +# No Fuss Computing's Tags Plugin for MKDocs + +Modified version from: [github.com/ginsburgnm/mkdocs-plugin-tags](https://github.com/ginsburgnm/mkdocs-plugin-tags) + +## Previous Readme below - tags + +Support for tags in the yaml-metadata in the header of markdown files. + +Extracts this metadata and creates a "Tags" page which lists all tags +and all pages for each tag. + +## Quick Demo + +Install this plugin (it will also install mkdocs if required) + +```bash +pip install mkdocs-plugin-tags +``` + +Create a new documentation folder: + +```bash +mkdocs new demo +``` + +Edit the `.md` files to add initial metadata. Currently, the metadata has to be +enclosed in `---` lines, and must include a `title:` property +(otherwise the page will appear as "untitled" in the tags page). So, for example: + +```bash +cd demo +cd docs +cat > index.md +--- +title: Welcome +tags: + - testing + - unimportant +--- +# Welcome to MkDocs + +For full documentation visit [mkdocs.org](https://mkdocs.org). + +^D +``` + +Edit `mkdocs.yml` to include this plugin: + +```yaml +plugins: + - tags: +``` + +Run the server: + +```bash +mkdocs serve --livereload +``` + +Visit the URL `/tags` (it should appear in the nav panel). +This is an auto-generated page which contains the tags as level 2 headers, +and under each tag, a listing of the pages which declare that tag in the +metadata section. + +![example screenshot](doc/imgs/screenshot.png) + +## How it works + +On each build (even with `--livereload`), all the `.md` files composing the +site are scanned, their "triple-dash-delimted" yaml header is extracted and +parsed, and the list of tags is collected. + +After that, a new temporal file is created (by default in `aux/tags.md`, but +this is customizable) which contains the generated tags page, in markdown +format. This file is not in the documents folder to avoid retriggering a +build, but it is added to the list of files to be converted to HTML by mkdocs. + +## Customization + +The layout of the tags page is a markdown file with jinja2 embedded contents. +The package provides such a template by default, with the following content: + +```markdown +--- +title: Tags +--- +# Contents grouped by tag + +{% for tag, pages in tags %} + +## {{tag}} +{% for page in pages %} + * [{{page.title}}]({{page.filename}}) +{% endfor %} + +{% endfor %} +``` + +You can style the `h2.tag` element via CSS, if you want. + +You can also provide your own markdown template, in case that you want a +different layout or metadata. The `page` object contains all the metadata +in a mkdocs page, and in addition a `.filename` attribute, which contains +the file name of the source of the page (relative to the docs folder), +which can be used to link to that page. + +The full customizable options for the plugin are: + +* `tags_folder`: Folder in which the auxiliar tags markdown file will be written + (`aux` by default, relative to the folder in which `mkdocs` is invoked). + It can be set to an absolute path, such as `/tmp/mysite/aux`. + The required folders are created. +* `tags_template`: path to the file which contains the markdown-jinja template + for the tags page. It is `None` by default, which means that the + package-provided template is used. It can be an absolute path, + or relative to the folder in which `mkdocs` is run. +* `css_name`: this allows you to pick what name styles the tag that appears on + the top of the page that contains a tag. This way things won't be overloaded + +For example, this can be put at `mkdocs.yaml`: + +```yaml +plugins: + - search + - tags: + tags_folder: /tmp/mysite/aux + tags_template: docs/theme/tags.md.template +``` diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/requirements.txt b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/requirements.txt new file mode 100755 index 00000000..fe9469e7 --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/requirements.txt @@ -0,0 +1 @@ +mkdocs==1.2.3 diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/setup.cfg b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/setup.cfg new file mode 100755 index 00000000..7a66196d --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/setup.cfg @@ -0,0 +1,27 @@ +[metadata] +name = mkdocs-plugin-tags +author = No Fuss Computing +author_email = helpdesk@nofusscomputing.com +url = https://gitlab.com/nofusscomputing/infrastructure/website +description = "Create tags in mkdocs" +long_description_content_type = text/markdown +long_description = file: README.md +license = MIT +keywords = "mkdocs python markdown tags" +classifiers = + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Intended Audience :: Information Technology + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Topic :: Security :: Cryptography + +[versioneer] +VCS = git +style = pep440 +versionfile_source = tags/_version.py +versionfile_build = tags/_version.py +tag_prefix = +parentdir_prefix = tags- diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/setup.py b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/setup.py new file mode 100755 index 00000000..6ef73b90 --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/setup.py @@ -0,0 +1,19 @@ +""" +Setup the plugin +""" +from setuptools import setup, find_packages + +setup( + version='0.0.2', + python_requires='>=3.6', + install_requires=[ + 'mkdocs>=1.2.3', + ], + packages=find_packages(exclude=['*.tests']), + package_data={'tags': ['templates/*.md.template']}, + entry_points={ + 'mkdocs.plugins': [ + 'nfc_tags = tags.plugin:TagsPlugin' + ] + } +) diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/__init__.py b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/__init__.py new file mode 100755 index 00000000..ecd3379a --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/__init__.py @@ -0,0 +1,3 @@ + +from . import _version +__version__ = _version.get_versions()['version'] diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/_version.py b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/_version.py new file mode 100755 index 00000000..adc1549b --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/_version.py @@ -0,0 +1,644 @@ + +# This file helps to compute a version number in source trees obtained from +# git-archive tarball (such as those provided by githubs download-from-tag +# feature). Distribution tarballs (built by setup.py sdist) and build +# directories (produced by setup.py build) will contain a much shorter file +# that just contains the computed version number. + +# This file is released into the public domain. Generated by +# versioneer-0.21 (https://github.com/python-versioneer/python-versioneer) + +"""Git implementation of _version.py.""" + +import errno +import os +import re +import subprocess +import sys +from typing import Callable, Dict + + +def get_keywords(): + """Get the keywords needed to look up the version information.""" + # these strings will be replaced by git during git-archive. + # setup.py/versioneer.py will grep for the variable names, so they must + # each be defined on a line of their own. _version.py will just call + # get_keywords(). + git_refnames = "$Format:%d$" + git_full = "$Format:%H$" + git_date = "$Format:%ci$" + keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} + return keywords + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_config(): + """Create, populate and return the VersioneerConfig() object.""" + # these strings are filled in when 'setup.py versioneer' creates + # _version.py + cfg = VersioneerConfig() + cfg.VCS = "git" + cfg.style = "pep440" + cfg.tag_prefix = "" + cfg.parentdir_prefix = "tags-" + cfg.versionfile_source = "tags/_version.py" + cfg.verbose = False + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + + +LONG_VERSION_PY: Dict[str, str] = {} +HANDLERS: Dict[str, Dict[str, Callable]] = {} + + +def register_vcs_handler(vcs, method): # decorator + """Create decorator to mark a method as the handler of a VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + process = None + for command in commands: + try: + dispcmd = str([command] + args) + # remember shell=False, so use git.cmd on windows, not just git + process = subprocess.Popen([command] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except OSError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %s" % dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %s" % (commands,)) + return None, None + stdout = process.communicate()[0].strip().decode() + if process.returncode != 0: + if verbose: + print("unable to run %s (error)" % dispcmd) + print("stdout was %s" % stdout) + return None, process.returncode + return stdout, process.returncode + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for _ in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %s but none started with prefix %s" % + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + with open(versionfile_abs, "r") as fobj: + for line in fobj: + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + except OSError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if "refnames" not in keywords: + raise NotThisMethod("Short version file found") + date = keywords.get("date") + if date is not None: + # Use only the last line. Previous lines may contain GPG signature + # information. + date = date.splitlines()[-1] + + # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = {r.strip() for r in refnames.strip("()").split(",")} + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = {r[len(TAG):] for r in refs if r.startswith(TAG)} + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = {r for r in refs if re.search(r'\d', r)} + if verbose: + print("discarding '%s', no digits" % ",".join(refs - tags)) + if verbose: + print("likely tags: %s" % ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + # Filter out refs that exactly match prefix or that don't start + # with a number once the prefix is stripped (mostly a concern + # when prefix is '') + if not re.match(r'\d', r): + continue + if verbose: + print("picking %s" % r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + TAG_PREFIX_REGEX = "*" + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + TAG_PREFIX_REGEX = r"\*" + + _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %s not under git control" % root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", + "%s%s" % (tag_prefix, TAG_PREFIX_REGEX)], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = runner(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"], + cwd=root) + # --abbrev-ref was added in git-1.6.3 + if rc != 0 or branch_name is None: + raise NotThisMethod("'git rev-parse --abbrev-ref' returned error") + branch_name = branch_name.strip() + + if branch_name == "HEAD": + # If we aren't exactly on a branch, pick a branch which represents + # the current commit. If all else fails, we are on a branchless + # commit. + branches, rc = runner(GITS, ["branch", "--contains"], cwd=root) + # --contains was added in git-1.5.4 + if rc != 0 or branches is None: + raise NotThisMethod("'git branch --contains' returned error") + branches = branches.split("\n") + + # Remove the first line if we're running detached + if "(" in branches[0]: + branches.pop(0) + + # Strip off the leading "* " from the list of branches. + branches = [branch[2:] for branch in branches] + if "master" in branches: + branch_name = "master" + elif not branches: + branch_name = None + else: + # Pick the first branch that is returned. Good or bad. + branch_name = branches[0] + + pieces["branch"] = branch_name + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparsable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%s'" + % describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%s' doesn't start with prefix '%s'" + print(fmt % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + % (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = runner(GITS, ["rev-list", "HEAD", "--count"], cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = runner(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip() + # Use only the last line. Previous lines may contain GPG signature + # information. + date = date.splitlines()[-1] + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_branch(pieces): + """TAG[[.dev0]+DISTANCE.gHEX[.dirty]] . + + The ".dev0" means not master branch. Note that .dev0 sorts backwards + (a feature branch will appear "older" than the master branch). + + Exceptions: + 1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + if pieces["branch"] != "master": + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0" + if pieces["branch"] != "master": + rendered += ".dev0" + rendered += "+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def pep440_split_post(ver): + """Split pep440 version string at the post-release segment. + + Returns the release segments before the post-release and the + post-release version number (or -1 if no post-release segment is present). + """ + vc = str.split(ver, ".post") + return vc[0], int(vc[1] or 0) if len(vc) == 2 else None + + +def render_pep440_pre(pieces): + """TAG[.postN.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post0.devDISTANCE + """ + if pieces["closest-tag"]: + if pieces["distance"]: + # update the post release segment + tag_version, post_version = pep440_split_post(pieces["closest-tag"]) + rendered = tag_version + if post_version is not None: + rendered += ".post%d.dev%d" % (post_version+1, pieces["distance"]) + else: + rendered += ".post0.dev%d" % (pieces["distance"]) + else: + # no commits, use the tag as the version + rendered = pieces["closest-tag"] + else: + # exception #1 + rendered = "0.post0.dev%d" % pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + return rendered + + +def render_pep440_post_branch(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] . + + The ".dev0" means not master branch. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["branch"] != "master": + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["branch"] != "master": + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-branch": + rendered = render_pep440_branch(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-post-branch": + rendered = render_pep440_post_branch(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%s'" % style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} + + +def get_versions(): + """Get version information or return default if unable to do so.""" + # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have + # __file__, we can work backwards from there to the root. Some + # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which + # case we can only use expanded keywords. + + cfg = get_config() + verbose = cfg.verbose + + try: + return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, + verbose) + except NotThisMethod: + pass + + try: + root = os.path.realpath(__file__) + # versionfile_source is the relative path from the top of the source + # tree (where the .git directory might live) to this file. Invert + # this to find the root from __file__. + for _ in cfg.versionfile_source.split('/'): + root = os.path.dirname(root) + except NameError: + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to find root of source tree", + "date": None} + + try: + pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) + return render(pieces, cfg.style) + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + except NotThisMethod: + pass + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", "date": None} diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/plugin.py b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/plugin.py new file mode 100755 index 00000000..598a6f10 --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/plugin.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python +""" +This plugin generates tags file as well as inserts markdown +at the beginning of a file that has tags + +@Adopted from +JL Diaz (c) 2019 +MIT License +""" +from collections import defaultdict +from pathlib import Path +from re import search, DOTALL, MULTILINE +from yaml import load, FullLoader, YAMLError +from jinja2 import Environment, FileSystemLoader +from mkdocs.structure.files import File +from mkdocs.plugins import BasePlugin +from mkdocs.config.config_options import Type +from mkdocs.__main__ import log + +class TagsPlugin(BasePlugin): + """ + Creates "tags.md" file containing a list of the pages grouped by tags + + It uses the info in the YAML metadata of each page, for the pages which + provide a "tags" keyword (whose value is a list of strings) + """ + config_scheme = ( + ('filename', Type(str, default='tags.md')), + ('folder', Type(str, default='aux')), + ('template', Type(str)), + ('css_name', Type(str, default='.button')), + ) + + def __init__(self): + self.metadata = [] + self.tag_dict = None + self.filename = "tags.md" + self.folder = "aux" + self.template = None + self.css_name = ".button" + self.templ = None + + #pylint: disable=unused-argument + def on_page_markdown(self, markdown, page, config, files): + """ + takes markdown, page, config, and files + currently modifies the markdown to add a button to click to get related tag info + tag is customizeable by adding css that keys off the `self.css_name` + """ + + page_url = page.url.split("/") + tags_link = '' + + for i in range(len(page_url) - 1): + tags_link = tags_link + '../' + + tags_link = tags_link + str(self.filename).strip('.md') + + if tags_link[-1] != '/': + tags_link = tags_link + '/' + + if 'tags' in page.meta: + swap_mark = [f"[{x}]({tags_link}#{x.lower()}){{{self.css_name}}}" + for x in page.meta['tags']] + swap_mark.append('\n') + return f'{" ".join(swap_mark)}{markdown}' + return markdown + + def on_config(self, config): + """Load config options""" + self.filename = Path(self.config.get("filename") or self.filename) + self.folder = Path(self.config.get("folder") or self.folder) + self.css_name = self.config.get("css_name") + # Make sure that the tags folder is absolute, and exists + if not self.folder.is_absolute(): + self.folder = Path(config["docs_dir"]) / ".." / self.folder + if not self.folder.exists(): + self.folder.mkdir(parents=True) + + if self.config.get("template"): + self.template = Path(self.config.get("template")) + if self.template is None: + self.template = Path(__file__).parent.joinpath( + "templates" + ).joinpath("tags.md.template") + environment = Environment( + loader=FileSystemLoader(searchpath=str(self.template.parent)) + ) + self.templ = environment.get_template(str(self.template.name)) + + def on_files(self, files, config): + """Load files to check for tags""" + self.metadata = [ + get_metadata(x.src_path, config['docs_dir']) + for x in files if x.src_path.endswith(".md") + ] + # Create new file with tags + self.generate_tags_file() + # New file to add to the build + newfile = File( + path=str(self.filename), + src_dir=str(self.folder), + dest_dir=config["site_dir"], + use_directory_urls=False + ) + files.append(newfile) + + def generate_tags_page(self, data): + """Generate the tags to be populated on the + mkdocs tag page""" + + css_name = self.css_name + + if css_name[0:1] == '.': + css_name = css_name[1:len(css_name)] + return self.templ.render( + tags=sorted(data.items(), key=lambda t: t[0].lower()), + css_name = css_name, + ) + + def generate_tags_file(self): + """Generate a file to be stored on the mkdocs page""" + sorted_meta = sorted(self.metadata, key=lambda e: e.get("year", 5000) if e else 0) + self.tag_dict = defaultdict(list) + for meta in sorted_meta: + if not meta: + continue + if "title" not in meta: + meta["title"] = meta['filename'].split("/")[-1].strip('.md') + tags = meta.get("tags", []) + for tag in tags: + self.tag_dict[tag].append(meta) + + with open(str(self.folder / self.filename), "w", encoding='utf-8') as fname: + fname.write(self.generate_tags_page(self.tag_dict)) + +# Helper functions +def get_metadata(name, path): + """Get the metadata off of a file""" + filename = Path(path) / Path(name) + with filename.open() as fname: + match_string = search(r"\A\s*---\n.*?\n---", fname.read(), flags=DOTALL | MULTILINE) + if match_string: + try: + metadata = match_string.group(0).strip('---') + meta = load(metadata, Loader=FullLoader) + meta.update(filename=name) + return meta + except YAMLError as err: + log.error("Couldn't parse %s yaml due to %s", fname, err) + return None diff --git a/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/templates/tags.md.template b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/templates/tags.md.template new file mode 100755 index 00000000..37795833 --- /dev/null +++ b/gitlab-ci/website-template/custom-plugins/mkdocs-plugin-tags/tags/templates/tags.md.template @@ -0,0 +1,7 @@ +# Contents grouped by tag +{% for tag, pages in tags %} + +## {{tag}} +{% for page in pages %} +* [{{page.title}}]({{page.filename}}) +{% endfor %}{% endfor %} diff --git a/gitlab-ci/website-template/mkdocs.yml b/gitlab-ci/website-template/mkdocs.yml new file mode 100644 index 00000000..c3f9c362 --- /dev/null +++ b/gitlab-ci/website-template/mkdocs.yml @@ -0,0 +1,124 @@ +site_name: No Fuss Computing +site_description: "Here at No Fuss Computing we predominately do research and development into, making your computing experience a more enjoyable one." +site_url: https://nofusscomputing.com + +site_author: No Fuss Computing +copyright: Copyright © No Fuss Computing 2021 + +#site_favicon: favicon.ico + +docs_dir: 'pages' +site_dir: build + + +theme: + name: material + logo: assets/logo.png + custom_dir: website-template/theme-overrides + icon: + repo: fontawesome/brands/gitlab # (1)! + locale: en + font: false + features: + - navigation.tracking + - navigation.tabs + - navigation.tabs.sticky + - navigation.expand + - navigation.indexes + - search.highlight + - toc.integrate + - navigation.top + - header.autohide + - navigation.sections + - content.code.annotate + + palette: + - media: "(prefers-color-scheme: light)" + scheme: default + primary: indigo + accent: indigo + toggle: + icon: material/lightbulb-outline + name: Switch to dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: indigo + accent: indigo + toggle: + icon: material/lightbulb + name: Switch to light mode + +extra_css: + - stylesheets/extra.css + + +plugins: + - nfc_tags: + filename: tags.md + folder: pages + css_name: ".tags" + - search: + lang: en + + - git-revision-date-localized: + type: iso_date + enable_creation_date: true + exclude: + - index.md + - tags.md +# - minify: +# minify_html: true + + + +extra: + homepage: https://nofusscomputing.com + version: 1.0 + social: + - link: https://hub.docker.com/u/nofusscomputing + name: DockerHub + icon: fontawesome/brands/docker + + - link: https://facebook.com/NoFussComputing + name: Facebook + icon: fontawesome/brands/facebook + + - link: https://gitlab.com/nofusscomputing + name: Gitlab + icon: fontawesome/brands/gitlab + + - link: https://github.com/NoFussComputing + name: Github + icon: fontawesome/brands/github + blog: + dir: articles + author: jon_nfc + author_image: https://gitlab.com/uploads/-/system/user/avatar/4125177/avatar.png + words_read_per_minute: 300 + list_length: 25 + extended_preview: true + + +markdown_extensions: + - def_list + - pymdownx.tasklist: + custom_checkbox: true + - meta + - attr_list + - admonition + - pymdownx.details + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.snippets + - md_in_html + - pymdownx.superfences + - pymdownx.tabbed: + alternate_style: true + - tables + # - pymdownx.emoji: + # emoji_index: !!python/name:material.extensions.emoji.twemoji + # emoji_generator: !!python/name:material.extensions.emoji.to_svg + # options: + # custom_icons: + # - .icons diff --git a/gitlab-ci/website-template/stylesheets/extra.css b/gitlab-ci/website-template/stylesheets/extra.css new file mode 100644 index 00000000..22ec1c8a --- /dev/null +++ b/gitlab-ci/website-template/stylesheets/extra.css @@ -0,0 +1,121 @@ +html .md-social a[title="DockerHub"] { + color: #0DB7ED; +} + +html .md-social a[title="Facebook"] { + color: #3B5998; + +} + +html .md-social a[title="Github"] { + color: #F5F5F5; +} + +html .md-social a[title="Gitlab"] { + color: #fc6d26; +} + +.docker { + color: #0DB7ED; +} + +.facebook { + color: #3B5998; +} + +.github { + color: #333; +} + +.gitlab { + color: #fc6d26; +} + +.tags { + background-color: #4051B5; + border-radius: 10px; + font-size: 12px; + color: white; + padding: 3px 6px; + text-align: center; + +} + +a.tags:hover { + color: #FFFF00; +} + +.tags:link { + color: white; +} + +.tags:visited { + color: white; +} + + +/* Blog Styles */ +.mdx-author { + display: flex; + font-size: 13.6px; +} +.mdx-author img { + height: 40px; + border-radius: 100%; +} +.mdx-author p:first-child { + flex-shrink: 0; + margin-right: 16px; +} +.mdx-author p > span { + display: block; +} + + +.container{ + width: 100%; +} +.container .row { + width: 95%; + margin: 0 auto; + height: fit-content; +} + +.container .row:after { + content: ""; + display: table; + clear: both; +} +.container .column { + float: left; + width: 50%; + padding-top: 30px; + +} + +.container .column .mdx-author { + padding-left: 30px; +} + +.container .column h2 { + margin: 0px; + text-align: center; +} + +.container .column ul { + margin: 0px; +} + +.container .column h3 { + margin: 0px; +} + +.container .column img { + height: 22px; +} +@media screen and ( max-width: 700px ) { + .container .column { + float: none; + width: 100%; + } +} diff --git a/gitlab-ci/website-template/theme-overrides/.icons/brand/docker.svg b/gitlab-ci/website-template/theme-overrides/.icons/brand/docker.svg new file mode 100644 index 00000000..c4b13198 --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/.icons/brand/docker.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/gitlab-ci/website-template/theme-overrides/article.html b/gitlab-ci/website-template/theme-overrides/article.html new file mode 100644 index 00000000..789df7b7 --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/article.html @@ -0,0 +1,27 @@ +{% extends "base.html" %} + +{% block content %} + + {% if page.meta.type == "blog" %} + + {% elif page.meta.type == "article" %} + + {% endif %} + +

{{ page.title }}

+ {% include "partials/article_metadata.html" %} +
+ {{ page.content }} + + + Published by: {{ config.site_name }}, + + {% if page.meta.copyrightHolder %} +
+ + Copyright {{ page.meta.copyrightHolder }} + + {% endif %} + {% if page.meta.type %}
{% endif %} +
+{% endblock %} diff --git a/gitlab-ci/website-template/theme-overrides/article_list.html b/gitlab-ci/website-template/theme-overrides/article_list.html new file mode 100644 index 00000000..dbe7cfc1 --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/article_list.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block content %} + {{ page.content }} + {% set article_posts = [] %} + {% for page in nav.pages %} + {% if page.url.startswith(config.extra.blog.dir) and page.meta.date is defined %} + + {{ article_posts.append( page ) or "" }} + {% endif %} + {% endfor %} + + {% for page in (article_posts|sort(attribute="meta.date", reverse=True))[:config.extra.blog.list_length] %} + {% if page.meta.type == "blog" %} + + {% elif page.meta.type == "article" %} + + {% endif %} +

+
+ {% include "partials/article_metadata.html" %} +

+ {{ page.meta.description }} +

+ + {% if config.extra.blog.extended_preview %} + + + {% include ".icons/octicons/arrow-right-24.svg" %} + + Continue reading +
+
+ {% endif %} + {% if page.meta.type %}
{% endif %} + {% endfor %} +
+{% endblock %} diff --git a/gitlab-ci/website-template/theme-overrides/home.html b/gitlab-ci/website-template/theme-overrides/home.html new file mode 100644 index 00000000..127f090f --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/home.html @@ -0,0 +1,68 @@ +{% extends "base.html" %} + +{% block content %} +
+ {{ page.content }} + {% set article_posts = [] %} + {% for page in nav.pages %} + {% if page.url.startswith(config.extra.blog.dir) and page.meta.date is defined %} + + {{ article_posts.append( page ) or "" }} + {% endif %} + {% endfor %} + +
+
+
+ +
    + {% for page in (article_posts|sort(attribute="meta.date", reverse=True))[:config.extra.blog.list_length] %} + {% if page.meta.type == "blog" %} +
  • + {% elif page.meta.type == "article" %} +
  • + {% else %} +
  • + {% endif %} +

    +

    + +

    +
  • + {% endfor %} +
+
+
+

Quick Links

+ +
+
+
+ +
+{% endblock %} diff --git a/gitlab-ci/website-template/theme-overrides/manual.html b/gitlab-ci/website-template/theme-overrides/manual.html new file mode 100755 index 00000000..1a73d657 --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/manual.html @@ -0,0 +1,63 @@ +{% extends "base.html" %} + +{% block content %} + +{% if page.edit_url %} + + {% include ".icons/material/pencil.svg" %} + +{% endif %} + + + + + +

{{ page.title }}

+ +
+ + + {{ page.content }} + + + + +
+ +
+

About:

+

This page forms part of our Operations Manual.

+

+

Page Metadata
+ Version: ToDo: place files short git commit here
+ Date Created: {{ page.meta.date.strftime("%Y-%m-%d") }}
+ {% if page.meta.git_revision_date_localized %}Date Edited: {{ page.meta.git_revision_date_localized.replace("\n", "").replace("\r", "") }}
{% endif %} +

+ +
Contribution:
+

Would You like to contribute to our Operations Manual? You can assist in the following ways:

+ +

 

+

ToDo: Add the page list of contributors

+ +
+ +
+ +{% endblock %} diff --git a/gitlab-ci/website-template/theme-overrides/partials/article_extended_preview.html b/gitlab-ci/website-template/theme-overrides/partials/article_extended_preview.html new file mode 100644 index 00000000..085d23bf --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/partials/article_extended_preview.html @@ -0,0 +1,7 @@ + + + {% include ".icons/octicons/arrow-right-24.svg" %} + + Continue reading +
+
diff --git a/gitlab-ci/website-template/theme-overrides/partials/article_metadata.html b/gitlab-ci/website-template/theme-overrides/partials/article_metadata.html new file mode 100644 index 00000000..e11a4717 --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/partials/article_metadata.html @@ -0,0 +1,32 @@ + diff --git a/gitlab-ci/website-template/theme-overrides/partials/article_social.html b/gitlab-ci/website-template/theme-overrides/partials/article_social.html new file mode 100644 index 00000000..cad4111b --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/partials/article_social.html @@ -0,0 +1,17 @@ +{% if config.extra.social %} + {% set ns = namespace() %} + {% for social in config.extra.social %} + {% set title = social.name %} + {% if not title and "//" in social.link %} + {% set _,url = social.link.split("//") %} + {% set title = url.split("/")[0] %} + {% endif %} + {% if ns.line_break is defined %} + {{ ns.line_break }} + {% endif %} + + {% include ".icons/" ~ social.icon ~ ".svg" %} + + {% set ns.line_break = " · " %} + {% endfor %} +{% endif %} \ No newline at end of file diff --git a/gitlab-ci/website-template/theme-overrides/partials/footer.html b/gitlab-ci/website-template/theme-overrides/partials/footer.html new file mode 100644 index 00000000..caa78b0e --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/partials/footer.html @@ -0,0 +1,14 @@ +{#- + This file was automatically generated - do not edit +-#} +
+ + +
diff --git a/gitlab-ci/website-template/theme-overrides/project.html b/gitlab-ci/website-template/theme-overrides/project.html new file mode 100644 index 00000000..4822f38e --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/project.html @@ -0,0 +1,63 @@ +{% extends "base.html" %} + +{% block content %} + +{% if page.edit_url %} + + {% include ".icons/material/pencil.svg" %} + +{% endif %} + + + + +

{{ page.title }}

+ +
+ + + {{ page.content }} + + + + + +
+

About:

+

This page forms part of our Project {{ config.repo_name }}.

+

+

Page Metadata
+ Version: ToDo: place files short git commit here
+ Date Created: {{ page.meta.date.strftime("%Y-%m-%d") }}
+ {% if page.meta.git_revision_date_localized %}Date Edited: {{ page.meta.git_revision_date_localized.replace("\n", "").replace("\r", "") }}
{% endif %} +

+ +
Contribution:
+

Would You like to contribute to our {{ config.repo_name }} project? You can assist in the following ways:

+ +

 

+

ToDo: Add the page list of contributors

+ +
+ +
+ +{% endblock %} diff --git a/gitlab-ci/website-template/theme-overrides/sitemap.xml b/gitlab-ci/website-template/theme-overrides/sitemap.xml new file mode 100644 index 00000000..81bc0170 --- /dev/null +++ b/gitlab-ci/website-template/theme-overrides/sitemap.xml @@ -0,0 +1,12 @@ + + +{%- for file in pages -%} + {% if not file.page.is_link %} + + {% if file.page.canonical_url %}{{ file.page.canonical_url|e }}{% else %}{{ file.page.abs_url|e }}{% endif %} + {% if file.page.meta.git_revision_date_localized %}{{ file.page.meta.git_revision_date_localized.replace("\n", "").replace("\r", "").replace('', '').replace('','') }}{% endif %} + weekly + + {%- endif -%} +{% endfor %} + \ No newline at end of file diff --git a/website-template/.cz.yaml b/website-template/.cz.yaml new file mode 100644 index 00000000..62b2ada1 --- /dev/null +++ b/website-template/.cz.yaml @@ -0,0 +1,7 @@ +commitizen: + bump_message: "build(version): bump version $current_version \u2192 $new_version" + changelog_incremental: false + name: cz_conventional_commits + tag_format: $major.$minor.$patch$prerelease + update_changelog_on_bump: true + version: 0.0.1 diff --git a/website-template/.gitlab-ci.yml b/website-template/.gitlab-ci.yml new file mode 100644 index 00000000..21365695 --- /dev/null +++ b/website-template/.gitlab-ci.yml @@ -0,0 +1,51 @@ +--- + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: development + file: + - .gitlab-ci_common.yaml + - template/automagic.gitlab-ci.yaml + + +variables: + MY_PROJECT_ID: "38927651" + +Documentation.Lint: + rules: + - when: never + +Documentation.Build: + rules: + - when: never + +pages: + rules: + - when: never + +Update Sub Repo: + extends: .submodule_update_trigger + parallel: + matrix: + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/ops + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/website + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_playbooks + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible-roles + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_docker_os + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_test + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/common + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/docker_management + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/execution_environment + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/firewall + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/git_configuration + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/homeassistant + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/kubernetes + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/nfc_glpi + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/django_template + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-bind + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-mail + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-buildx-qemu + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-glpi + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/gitlab-ci + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/configuration-management/itil_runbooks + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/kubernetes_monitoring diff --git a/website-template/.gitmodules b/website-template/.gitmodules new file mode 100644 index 00000000..ec715666 --- /dev/null +++ b/website-template/.gitmodules @@ -0,0 +1,4 @@ +[submodule "gitlab-ci"] + path = gitlab-ci + url = https://gitlab.com/nofusscomputing/projects/gitlab-ci.git + branch=development diff --git a/website-template/.markdownlint.json b/website-template/.markdownlint.json new file mode 100644 index 00000000..9d7c7401 --- /dev/null +++ b/website-template/.markdownlint.json @@ -0,0 +1,20 @@ +{ + "line-length": false, + "MD007": { + "indent": 4 + }, + "MD033": { + "allowed_elements": [ "div", "span", "u", "p" ] + }, + "blanks-around-headings":{ + "lines_above": 2, + "lines_below": 1 + }, + "MD012": { + "maximum": 2 + }, + "comment": { + "MD012": "MD012 max=2 added so that headings can have two lines above for clarity.", + "html_s": "don't allow html as this can be done in markdown" + } +} diff --git a/website-template/.nfc_automation.yaml b/website-template/.nfc_automation.yaml new file mode 100644 index 00000000..077d7f44 --- /dev/null +++ b/website-template/.nfc_automation.yaml @@ -0,0 +1,8 @@ +--- + +role_git_conf: + gitlab: + submodule_branch: "development" + default_branch: development + mr_labels: ~"type::automation" ~"impact::0" ~"priority::0" + auto_merge: true diff --git a/website-template/LICENSE b/website-template/LICENSE new file mode 100644 index 00000000..248717ef --- /dev/null +++ b/website-template/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2022 Jon + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/.gitignore b/website-template/custom-plugins/mkdocs-plugin-tags/.gitignore new file mode 100755 index 00000000..f56be719 --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/.gitignore @@ -0,0 +1,125 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +pip-wheel-metadata/ +share/python-wheels/ +*.egg-info/ +.installed.cfg +*.egg +MANIFEST + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.nox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*.cover +*.py,cover +.hypothesis/ +.pytest_cache/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py +db.sqlite3 +db.sqlite3-journal + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +# docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# IPython +profile_default/ +ipython_config.py + +# pyenv +.python-version + +# pipenv +# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. +# However, in case of collaboration, if having platform-specific dependencies or dependencies +# having no cross-platform support, pipenv may install dependencies that don't work, or not +# install all needed dependencies. +#Pipfile.lock + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# Environments +.env +.venv +env/ +venv/ +ENV/ +env.bak/ +venv.bak/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# mypy +.mypy_cache/ +.dmypy.json +dmypy.json + +# Pyre type checker +.pyre/ diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/LICENSE.md b/website-template/custom-plugins/mkdocs-plugin-tags/LICENSE.md new file mode 100755 index 00000000..4720011e --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/LICENSE.md @@ -0,0 +1,7 @@ +# License + +Copyright (C) 2021 No Fuss Computing + +All Rights Reserved. + +Not yet suitable for public release. diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/MANIFEST.in b/website-template/custom-plugins/mkdocs-plugin-tags/MANIFEST.in new file mode 100755 index 00000000..ebd0c96a --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/MANIFEST.in @@ -0,0 +1,2 @@ +include versioneer.py +include tags/_version.py diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/README.md b/website-template/custom-plugins/mkdocs-plugin-tags/README.md new file mode 100755 index 00000000..b473fd91 --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/README.md @@ -0,0 +1,128 @@ +# No Fuss Computing's Tags Plugin for MKDocs + +Modified version from: [github.com/ginsburgnm/mkdocs-plugin-tags](https://github.com/ginsburgnm/mkdocs-plugin-tags) + +## Previous Readme below - tags + +Support for tags in the yaml-metadata in the header of markdown files. + +Extracts this metadata and creates a "Tags" page which lists all tags +and all pages for each tag. + +## Quick Demo + +Install this plugin (it will also install mkdocs if required) + +```bash +pip install mkdocs-plugin-tags +``` + +Create a new documentation folder: + +```bash +mkdocs new demo +``` + +Edit the `.md` files to add initial metadata. Currently, the metadata has to be +enclosed in `---` lines, and must include a `title:` property +(otherwise the page will appear as "untitled" in the tags page). So, for example: + +```bash +cd demo +cd docs +cat > index.md +--- +title: Welcome +tags: + - testing + - unimportant +--- +# Welcome to MkDocs + +For full documentation visit [mkdocs.org](https://mkdocs.org). + +^D +``` + +Edit `mkdocs.yml` to include this plugin: + +```yaml +plugins: + - tags: +``` + +Run the server: + +```bash +mkdocs serve --livereload +``` + +Visit the URL `/tags` (it should appear in the nav panel). +This is an auto-generated page which contains the tags as level 2 headers, +and under each tag, a listing of the pages which declare that tag in the +metadata section. + +![example screenshot](doc/imgs/screenshot.png) + +## How it works + +On each build (even with `--livereload`), all the `.md` files composing the +site are scanned, their "triple-dash-delimted" yaml header is extracted and +parsed, and the list of tags is collected. + +After that, a new temporal file is created (by default in `aux/tags.md`, but +this is customizable) which contains the generated tags page, in markdown +format. This file is not in the documents folder to avoid retriggering a +build, but it is added to the list of files to be converted to HTML by mkdocs. + +## Customization + +The layout of the tags page is a markdown file with jinja2 embedded contents. +The package provides such a template by default, with the following content: + +```markdown +--- +title: Tags +--- +# Contents grouped by tag + +{% for tag, pages in tags %} + +## {{tag}} +{% for page in pages %} + * [{{page.title}}]({{page.filename}}) +{% endfor %} + +{% endfor %} +``` + +You can style the `h2.tag` element via CSS, if you want. + +You can also provide your own markdown template, in case that you want a +different layout or metadata. The `page` object contains all the metadata +in a mkdocs page, and in addition a `.filename` attribute, which contains +the file name of the source of the page (relative to the docs folder), +which can be used to link to that page. + +The full customizable options for the plugin are: + +* `tags_folder`: Folder in which the auxiliar tags markdown file will be written + (`aux` by default, relative to the folder in which `mkdocs` is invoked). + It can be set to an absolute path, such as `/tmp/mysite/aux`. + The required folders are created. +* `tags_template`: path to the file which contains the markdown-jinja template + for the tags page. It is `None` by default, which means that the + package-provided template is used. It can be an absolute path, + or relative to the folder in which `mkdocs` is run. +* `css_name`: this allows you to pick what name styles the tag that appears on + the top of the page that contains a tag. This way things won't be overloaded + +For example, this can be put at `mkdocs.yaml`: + +```yaml +plugins: + - search + - tags: + tags_folder: /tmp/mysite/aux + tags_template: docs/theme/tags.md.template +``` diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/requirements.txt b/website-template/custom-plugins/mkdocs-plugin-tags/requirements.txt new file mode 100755 index 00000000..fe9469e7 --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/requirements.txt @@ -0,0 +1 @@ +mkdocs==1.2.3 diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/setup.cfg b/website-template/custom-plugins/mkdocs-plugin-tags/setup.cfg new file mode 100755 index 00000000..7a66196d --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/setup.cfg @@ -0,0 +1,27 @@ +[metadata] +name = mkdocs-plugin-tags +author = No Fuss Computing +author_email = helpdesk@nofusscomputing.com +url = https://gitlab.com/nofusscomputing/infrastructure/website +description = "Create tags in mkdocs" +long_description_content_type = text/markdown +long_description = file: README.md +license = MIT +keywords = "mkdocs python markdown tags" +classifiers = + Intended Audience :: Developers + License :: OSI Approved :: MIT License + Operating System :: OS Independent + Intended Audience :: Information Technology + Programming Language :: Python :: 3.6 + Programming Language :: Python :: 3.7 + Programming Language :: Python :: 3.8 + Topic :: Security :: Cryptography + +[versioneer] +VCS = git +style = pep440 +versionfile_source = tags/_version.py +versionfile_build = tags/_version.py +tag_prefix = +parentdir_prefix = tags- diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/setup.py b/website-template/custom-plugins/mkdocs-plugin-tags/setup.py new file mode 100755 index 00000000..6ef73b90 --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/setup.py @@ -0,0 +1,19 @@ +""" +Setup the plugin +""" +from setuptools import setup, find_packages + +setup( + version='0.0.2', + python_requires='>=3.6', + install_requires=[ + 'mkdocs>=1.2.3', + ], + packages=find_packages(exclude=['*.tests']), + package_data={'tags': ['templates/*.md.template']}, + entry_points={ + 'mkdocs.plugins': [ + 'nfc_tags = tags.plugin:TagsPlugin' + ] + } +) diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/tags/__init__.py b/website-template/custom-plugins/mkdocs-plugin-tags/tags/__init__.py new file mode 100755 index 00000000..ecd3379a --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/tags/__init__.py @@ -0,0 +1,3 @@ + +from . import _version +__version__ = _version.get_versions()['version'] diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/tags/_version.py b/website-template/custom-plugins/mkdocs-plugin-tags/tags/_version.py new file mode 100755 index 00000000..adc1549b --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/tags/_version.py @@ -0,0 +1,644 @@ + +# This file helps to compute a version number in source trees obtained from +# git-archive tarball (such as those provided by githubs download-from-tag +# feature). Distribution tarballs (built by setup.py sdist) and build +# directories (produced by setup.py build) will contain a much shorter file +# that just contains the computed version number. + +# This file is released into the public domain. Generated by +# versioneer-0.21 (https://github.com/python-versioneer/python-versioneer) + +"""Git implementation of _version.py.""" + +import errno +import os +import re +import subprocess +import sys +from typing import Callable, Dict + + +def get_keywords(): + """Get the keywords needed to look up the version information.""" + # these strings will be replaced by git during git-archive. + # setup.py/versioneer.py will grep for the variable names, so they must + # each be defined on a line of their own. _version.py will just call + # get_keywords(). + git_refnames = "$Format:%d$" + git_full = "$Format:%H$" + git_date = "$Format:%ci$" + keywords = {"refnames": git_refnames, "full": git_full, "date": git_date} + return keywords + + +class VersioneerConfig: + """Container for Versioneer configuration parameters.""" + + +def get_config(): + """Create, populate and return the VersioneerConfig() object.""" + # these strings are filled in when 'setup.py versioneer' creates + # _version.py + cfg = VersioneerConfig() + cfg.VCS = "git" + cfg.style = "pep440" + cfg.tag_prefix = "" + cfg.parentdir_prefix = "tags-" + cfg.versionfile_source = "tags/_version.py" + cfg.verbose = False + return cfg + + +class NotThisMethod(Exception): + """Exception raised if a method is not valid for the current scenario.""" + + +LONG_VERSION_PY: Dict[str, str] = {} +HANDLERS: Dict[str, Dict[str, Callable]] = {} + + +def register_vcs_handler(vcs, method): # decorator + """Create decorator to mark a method as the handler of a VCS.""" + def decorate(f): + """Store f in HANDLERS[vcs][method].""" + if vcs not in HANDLERS: + HANDLERS[vcs] = {} + HANDLERS[vcs][method] = f + return f + return decorate + + +def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, + env=None): + """Call the given command(s).""" + assert isinstance(commands, list) + process = None + for command in commands: + try: + dispcmd = str([command] + args) + # remember shell=False, so use git.cmd on windows, not just git + process = subprocess.Popen([command] + args, cwd=cwd, env=env, + stdout=subprocess.PIPE, + stderr=(subprocess.PIPE if hide_stderr + else None)) + break + except OSError: + e = sys.exc_info()[1] + if e.errno == errno.ENOENT: + continue + if verbose: + print("unable to run %s" % dispcmd) + print(e) + return None, None + else: + if verbose: + print("unable to find command, tried %s" % (commands,)) + return None, None + stdout = process.communicate()[0].strip().decode() + if process.returncode != 0: + if verbose: + print("unable to run %s (error)" % dispcmd) + print("stdout was %s" % stdout) + return None, process.returncode + return stdout, process.returncode + + +def versions_from_parentdir(parentdir_prefix, root, verbose): + """Try to determine the version from the parent directory name. + + Source tarballs conventionally unpack into a directory that includes both + the project name and a version string. We will also support searching up + two directory levels for an appropriately named parent directory + """ + rootdirs = [] + + for _ in range(3): + dirname = os.path.basename(root) + if dirname.startswith(parentdir_prefix): + return {"version": dirname[len(parentdir_prefix):], + "full-revisionid": None, + "dirty": False, "error": None, "date": None} + rootdirs.append(root) + root = os.path.dirname(root) # up a level + + if verbose: + print("Tried directories %s but none started with prefix %s" % + (str(rootdirs), parentdir_prefix)) + raise NotThisMethod("rootdir doesn't start with parentdir_prefix") + + +@register_vcs_handler("git", "get_keywords") +def git_get_keywords(versionfile_abs): + """Extract version information from the given file.""" + # the code embedded in _version.py can just fetch the value of these + # keywords. When used from setup.py, we don't want to import _version.py, + # so we do it with a regexp instead. This function is not used from + # _version.py. + keywords = {} + try: + with open(versionfile_abs, "r") as fobj: + for line in fobj: + if line.strip().startswith("git_refnames ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["refnames"] = mo.group(1) + if line.strip().startswith("git_full ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["full"] = mo.group(1) + if line.strip().startswith("git_date ="): + mo = re.search(r'=\s*"(.*)"', line) + if mo: + keywords["date"] = mo.group(1) + except OSError: + pass + return keywords + + +@register_vcs_handler("git", "keywords") +def git_versions_from_keywords(keywords, tag_prefix, verbose): + """Get version information from git keywords.""" + if "refnames" not in keywords: + raise NotThisMethod("Short version file found") + date = keywords.get("date") + if date is not None: + # Use only the last line. Previous lines may contain GPG signature + # information. + date = date.splitlines()[-1] + + # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant + # datestamp. However we prefer "%ci" (which expands to an "ISO-8601 + # -like" string, which we must then edit to make compliant), because + # it's been around since git-1.5.3, and it's too difficult to + # discover which version we're using, or to work around using an + # older one. + date = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + refnames = keywords["refnames"].strip() + if refnames.startswith("$Format"): + if verbose: + print("keywords are unexpanded, not using") + raise NotThisMethod("unexpanded keywords, not a git-archive tarball") + refs = {r.strip() for r in refnames.strip("()").split(",")} + # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of + # just "foo-1.0". If we see a "tag: " prefix, prefer those. + TAG = "tag: " + tags = {r[len(TAG):] for r in refs if r.startswith(TAG)} + if not tags: + # Either we're using git < 1.8.3, or there really are no tags. We use + # a heuristic: assume all version tags have a digit. The old git %d + # expansion behaves like git log --decorate=short and strips out the + # refs/heads/ and refs/tags/ prefixes that would let us distinguish + # between branches and tags. By ignoring refnames without digits, we + # filter out many common branch names like "release" and + # "stabilization", as well as "HEAD" and "master". + tags = {r for r in refs if re.search(r'\d', r)} + if verbose: + print("discarding '%s', no digits" % ",".join(refs - tags)) + if verbose: + print("likely tags: %s" % ",".join(sorted(tags))) + for ref in sorted(tags): + # sorting will prefer e.g. "2.0" over "2.0rc1" + if ref.startswith(tag_prefix): + r = ref[len(tag_prefix):] + # Filter out refs that exactly match prefix or that don't start + # with a number once the prefix is stripped (mostly a concern + # when prefix is '') + if not re.match(r'\d', r): + continue + if verbose: + print("picking %s" % r) + return {"version": r, + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": None, + "date": date} + # no suitable tags, so version is "0+unknown", but full hex is still there + if verbose: + print("no suitable tags, using unknown + full revision id") + return {"version": "0+unknown", + "full-revisionid": keywords["full"].strip(), + "dirty": False, "error": "no suitable tags", "date": None} + + +@register_vcs_handler("git", "pieces_from_vcs") +def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command): + """Get version from 'git describe' in the root of the source tree. + + This only gets called if the git-archive 'subst' keywords were *not* + expanded, and _version.py hasn't already been rewritten with a short + version string, meaning we're inside a checked out source tree. + """ + GITS = ["git"] + TAG_PREFIX_REGEX = "*" + if sys.platform == "win32": + GITS = ["git.cmd", "git.exe"] + TAG_PREFIX_REGEX = r"\*" + + _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, + hide_stderr=True) + if rc != 0: + if verbose: + print("Directory %s not under git control" % root) + raise NotThisMethod("'git rev-parse --git-dir' returned error") + + # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty] + # if there isn't one, this yields HEX[-dirty] (no NUM) + describe_out, rc = runner(GITS, ["describe", "--tags", "--dirty", + "--always", "--long", + "--match", + "%s%s" % (tag_prefix, TAG_PREFIX_REGEX)], + cwd=root) + # --long was added in git-1.5.5 + if describe_out is None: + raise NotThisMethod("'git describe' failed") + describe_out = describe_out.strip() + full_out, rc = runner(GITS, ["rev-parse", "HEAD"], cwd=root) + if full_out is None: + raise NotThisMethod("'git rev-parse' failed") + full_out = full_out.strip() + + pieces = {} + pieces["long"] = full_out + pieces["short"] = full_out[:7] # maybe improved later + pieces["error"] = None + + branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"], + cwd=root) + # --abbrev-ref was added in git-1.6.3 + if rc != 0 or branch_name is None: + raise NotThisMethod("'git rev-parse --abbrev-ref' returned error") + branch_name = branch_name.strip() + + if branch_name == "HEAD": + # If we aren't exactly on a branch, pick a branch which represents + # the current commit. If all else fails, we are on a branchless + # commit. + branches, rc = runner(GITS, ["branch", "--contains"], cwd=root) + # --contains was added in git-1.5.4 + if rc != 0 or branches is None: + raise NotThisMethod("'git branch --contains' returned error") + branches = branches.split("\n") + + # Remove the first line if we're running detached + if "(" in branches[0]: + branches.pop(0) + + # Strip off the leading "* " from the list of branches. + branches = [branch[2:] for branch in branches] + if "master" in branches: + branch_name = "master" + elif not branches: + branch_name = None + else: + # Pick the first branch that is returned. Good or bad. + branch_name = branches[0] + + pieces["branch"] = branch_name + + # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty] + # TAG might have hyphens. + git_describe = describe_out + + # look for -dirty suffix + dirty = git_describe.endswith("-dirty") + pieces["dirty"] = dirty + if dirty: + git_describe = git_describe[:git_describe.rindex("-dirty")] + + # now we have TAG-NUM-gHEX or HEX + + if "-" in git_describe: + # TAG-NUM-gHEX + mo = re.search(r'^(.+)-(\d+)-g([0-9a-f]+)$', git_describe) + if not mo: + # unparsable. Maybe git-describe is misbehaving? + pieces["error"] = ("unable to parse git-describe output: '%s'" + % describe_out) + return pieces + + # tag + full_tag = mo.group(1) + if not full_tag.startswith(tag_prefix): + if verbose: + fmt = "tag '%s' doesn't start with prefix '%s'" + print(fmt % (full_tag, tag_prefix)) + pieces["error"] = ("tag '%s' doesn't start with prefix '%s'" + % (full_tag, tag_prefix)) + return pieces + pieces["closest-tag"] = full_tag[len(tag_prefix):] + + # distance: number of commits since tag + pieces["distance"] = int(mo.group(2)) + + # commit: short hex revision ID + pieces["short"] = mo.group(3) + + else: + # HEX: no tags + pieces["closest-tag"] = None + count_out, rc = runner(GITS, ["rev-list", "HEAD", "--count"], cwd=root) + pieces["distance"] = int(count_out) # total number of commits + + # commit date: see ISO-8601 comment in git_versions_from_keywords() + date = runner(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip() + # Use only the last line. Previous lines may contain GPG signature + # information. + date = date.splitlines()[-1] + pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1) + + return pieces + + +def plus_or_dot(pieces): + """Return a + if we don't already have one, else return a .""" + if "+" in pieces.get("closest-tag", ""): + return "." + return "+" + + +def render_pep440(pieces): + """Build up version string, with post-release "local version identifier". + + Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you + get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty + + Exceptions: + 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_branch(pieces): + """TAG[[.dev0]+DISTANCE.gHEX[.dirty]] . + + The ".dev0" means not master branch. Note that .dev0 sorts backwards + (a feature branch will appear "older" than the master branch). + + Exceptions: + 1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + if pieces["branch"] != "master": + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "%d.g%s" % (pieces["distance"], pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0" + if pieces["branch"] != "master": + rendered += ".dev0" + rendered += "+untagged.%d.g%s" % (pieces["distance"], + pieces["short"]) + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def pep440_split_post(ver): + """Split pep440 version string at the post-release segment. + + Returns the release segments before the post-release and the + post-release version number (or -1 if no post-release segment is present). + """ + vc = str.split(ver, ".post") + return vc[0], int(vc[1] or 0) if len(vc) == 2 else None + + +def render_pep440_pre(pieces): + """TAG[.postN.devDISTANCE] -- No -dirty. + + Exceptions: + 1: no tags. 0.post0.devDISTANCE + """ + if pieces["closest-tag"]: + if pieces["distance"]: + # update the post release segment + tag_version, post_version = pep440_split_post(pieces["closest-tag"]) + rendered = tag_version + if post_version is not None: + rendered += ".post%d.dev%d" % (post_version+1, pieces["distance"]) + else: + rendered += ".post0.dev%d" % (pieces["distance"]) + else: + # no commits, use the tag as the version + rendered = pieces["closest-tag"] + else: + # exception #1 + rendered = "0.post0.dev%d" % pieces["distance"] + return rendered + + +def render_pep440_post(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX] . + + The ".dev0" means dirty. Note that .dev0 sorts backwards + (a dirty tree will appear "older" than the corresponding clean one), + but you shouldn't be releasing software with -dirty anyways. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + return rendered + + +def render_pep440_post_branch(pieces): + """TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] . + + The ".dev0" means not master branch. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["branch"] != "master": + rendered += ".dev0" + rendered += plus_or_dot(pieces) + rendered += "g%s" % pieces["short"] + if pieces["dirty"]: + rendered += ".dirty" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["branch"] != "master": + rendered += ".dev0" + rendered += "+g%s" % pieces["short"] + if pieces["dirty"]: + rendered += ".dirty" + return rendered + + +def render_pep440_old(pieces): + """TAG[.postDISTANCE[.dev0]] . + + The ".dev0" means dirty. + + Exceptions: + 1: no tags. 0.postDISTANCE[.dev0] + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"] or pieces["dirty"]: + rendered += ".post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + else: + # exception #1 + rendered = "0.post%d" % pieces["distance"] + if pieces["dirty"]: + rendered += ".dev0" + return rendered + + +def render_git_describe(pieces): + """TAG[-DISTANCE-gHEX][-dirty]. + + Like 'git describe --tags --dirty --always'. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + if pieces["distance"]: + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render_git_describe_long(pieces): + """TAG-DISTANCE-gHEX[-dirty]. + + Like 'git describe --tags --dirty --always -long'. + The distance/hash is unconditional. + + Exceptions: + 1: no tags. HEX[-dirty] (note: no 'g' prefix) + """ + if pieces["closest-tag"]: + rendered = pieces["closest-tag"] + rendered += "-%d-g%s" % (pieces["distance"], pieces["short"]) + else: + # exception #1 + rendered = pieces["short"] + if pieces["dirty"]: + rendered += "-dirty" + return rendered + + +def render(pieces, style): + """Render the given version pieces into the requested style.""" + if pieces["error"]: + return {"version": "unknown", + "full-revisionid": pieces.get("long"), + "dirty": None, + "error": pieces["error"], + "date": None} + + if not style or style == "default": + style = "pep440" # the default + + if style == "pep440": + rendered = render_pep440(pieces) + elif style == "pep440-branch": + rendered = render_pep440_branch(pieces) + elif style == "pep440-pre": + rendered = render_pep440_pre(pieces) + elif style == "pep440-post": + rendered = render_pep440_post(pieces) + elif style == "pep440-post-branch": + rendered = render_pep440_post_branch(pieces) + elif style == "pep440-old": + rendered = render_pep440_old(pieces) + elif style == "git-describe": + rendered = render_git_describe(pieces) + elif style == "git-describe-long": + rendered = render_git_describe_long(pieces) + else: + raise ValueError("unknown style '%s'" % style) + + return {"version": rendered, "full-revisionid": pieces["long"], + "dirty": pieces["dirty"], "error": None, + "date": pieces.get("date")} + + +def get_versions(): + """Get version information or return default if unable to do so.""" + # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have + # __file__, we can work backwards from there to the root. Some + # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which + # case we can only use expanded keywords. + + cfg = get_config() + verbose = cfg.verbose + + try: + return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, + verbose) + except NotThisMethod: + pass + + try: + root = os.path.realpath(__file__) + # versionfile_source is the relative path from the top of the source + # tree (where the .git directory might live) to this file. Invert + # this to find the root from __file__. + for _ in cfg.versionfile_source.split('/'): + root = os.path.dirname(root) + except NameError: + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to find root of source tree", + "date": None} + + try: + pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose) + return render(pieces, cfg.style) + except NotThisMethod: + pass + + try: + if cfg.parentdir_prefix: + return versions_from_parentdir(cfg.parentdir_prefix, root, verbose) + except NotThisMethod: + pass + + return {"version": "0+unknown", "full-revisionid": None, + "dirty": None, + "error": "unable to compute version", "date": None} diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/tags/plugin.py b/website-template/custom-plugins/mkdocs-plugin-tags/tags/plugin.py new file mode 100755 index 00000000..598a6f10 --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/tags/plugin.py @@ -0,0 +1,151 @@ +#!/usr/bin/env python +""" +This plugin generates tags file as well as inserts markdown +at the beginning of a file that has tags + +@Adopted from +JL Diaz (c) 2019 +MIT License +""" +from collections import defaultdict +from pathlib import Path +from re import search, DOTALL, MULTILINE +from yaml import load, FullLoader, YAMLError +from jinja2 import Environment, FileSystemLoader +from mkdocs.structure.files import File +from mkdocs.plugins import BasePlugin +from mkdocs.config.config_options import Type +from mkdocs.__main__ import log + +class TagsPlugin(BasePlugin): + """ + Creates "tags.md" file containing a list of the pages grouped by tags + + It uses the info in the YAML metadata of each page, for the pages which + provide a "tags" keyword (whose value is a list of strings) + """ + config_scheme = ( + ('filename', Type(str, default='tags.md')), + ('folder', Type(str, default='aux')), + ('template', Type(str)), + ('css_name', Type(str, default='.button')), + ) + + def __init__(self): + self.metadata = [] + self.tag_dict = None + self.filename = "tags.md" + self.folder = "aux" + self.template = None + self.css_name = ".button" + self.templ = None + + #pylint: disable=unused-argument + def on_page_markdown(self, markdown, page, config, files): + """ + takes markdown, page, config, and files + currently modifies the markdown to add a button to click to get related tag info + tag is customizeable by adding css that keys off the `self.css_name` + """ + + page_url = page.url.split("/") + tags_link = '' + + for i in range(len(page_url) - 1): + tags_link = tags_link + '../' + + tags_link = tags_link + str(self.filename).strip('.md') + + if tags_link[-1] != '/': + tags_link = tags_link + '/' + + if 'tags' in page.meta: + swap_mark = [f"[{x}]({tags_link}#{x.lower()}){{{self.css_name}}}" + for x in page.meta['tags']] + swap_mark.append('\n') + return f'{" ".join(swap_mark)}{markdown}' + return markdown + + def on_config(self, config): + """Load config options""" + self.filename = Path(self.config.get("filename") or self.filename) + self.folder = Path(self.config.get("folder") or self.folder) + self.css_name = self.config.get("css_name") + # Make sure that the tags folder is absolute, and exists + if not self.folder.is_absolute(): + self.folder = Path(config["docs_dir"]) / ".." / self.folder + if not self.folder.exists(): + self.folder.mkdir(parents=True) + + if self.config.get("template"): + self.template = Path(self.config.get("template")) + if self.template is None: + self.template = Path(__file__).parent.joinpath( + "templates" + ).joinpath("tags.md.template") + environment = Environment( + loader=FileSystemLoader(searchpath=str(self.template.parent)) + ) + self.templ = environment.get_template(str(self.template.name)) + + def on_files(self, files, config): + """Load files to check for tags""" + self.metadata = [ + get_metadata(x.src_path, config['docs_dir']) + for x in files if x.src_path.endswith(".md") + ] + # Create new file with tags + self.generate_tags_file() + # New file to add to the build + newfile = File( + path=str(self.filename), + src_dir=str(self.folder), + dest_dir=config["site_dir"], + use_directory_urls=False + ) + files.append(newfile) + + def generate_tags_page(self, data): + """Generate the tags to be populated on the + mkdocs tag page""" + + css_name = self.css_name + + if css_name[0:1] == '.': + css_name = css_name[1:len(css_name)] + return self.templ.render( + tags=sorted(data.items(), key=lambda t: t[0].lower()), + css_name = css_name, + ) + + def generate_tags_file(self): + """Generate a file to be stored on the mkdocs page""" + sorted_meta = sorted(self.metadata, key=lambda e: e.get("year", 5000) if e else 0) + self.tag_dict = defaultdict(list) + for meta in sorted_meta: + if not meta: + continue + if "title" not in meta: + meta["title"] = meta['filename'].split("/")[-1].strip('.md') + tags = meta.get("tags", []) + for tag in tags: + self.tag_dict[tag].append(meta) + + with open(str(self.folder / self.filename), "w", encoding='utf-8') as fname: + fname.write(self.generate_tags_page(self.tag_dict)) + +# Helper functions +def get_metadata(name, path): + """Get the metadata off of a file""" + filename = Path(path) / Path(name) + with filename.open() as fname: + match_string = search(r"\A\s*---\n.*?\n---", fname.read(), flags=DOTALL | MULTILINE) + if match_string: + try: + metadata = match_string.group(0).strip('---') + meta = load(metadata, Loader=FullLoader) + meta.update(filename=name) + return meta + except YAMLError as err: + log.error("Couldn't parse %s yaml due to %s", fname, err) + return None diff --git a/website-template/custom-plugins/mkdocs-plugin-tags/tags/templates/tags.md.template b/website-template/custom-plugins/mkdocs-plugin-tags/tags/templates/tags.md.template new file mode 100755 index 00000000..37795833 --- /dev/null +++ b/website-template/custom-plugins/mkdocs-plugin-tags/tags/templates/tags.md.template @@ -0,0 +1,7 @@ +# Contents grouped by tag +{% for tag, pages in tags %} + +## {{tag}} +{% for page in pages %} +* [{{page.title}}]({{page.filename}}) +{% endfor %}{% endfor %} diff --git a/website-template/docs/.gitkeep b/website-template/docs/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/website-template/docs/articles/index.md b/website-template/docs/articles/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/docs/contact.md b/website-template/docs/contact.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/docs/index.md b/website-template/docs/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/docs/operations/index.md b/website-template/docs/operations/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/docs/projects/ansible/collection/centurion/index.md b/website-template/docs/projects/ansible/collection/centurion/index.md new file mode 100644 index 00000000..606c2670 --- /dev/null +++ b/website-template/docs/projects/ansible/collection/centurion/index.md @@ -0,0 +1,118 @@ +--- +title: Centurion +description: No Fuss Computings Companion Ansible Collection Centurion for Centurion ERP. +date: 2024-07-30 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/ansible/collections/kubernetes +--- + + + +![Project Status - Active](https://img.shields.io/badge/Project%20Status-Active-green?logo=github&style=plastic) + + +![GitHub Actions Workflow Status](https://img.shields.io/github/actions/workflow/status/nofusscomputing/ansible_collection_centurion/ci.yaml?branch=master&style=plastic&logo=github&label=Build&color=%23000) ![GitHub Release](https://img.shields.io/github/v/release/nofusscomputing/ansible_collection_centurion?sort=date&style=plastic&logo=github&label=Release&color=000) + +[![Downloads](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fgalaxy.ansible.com%2Fapi%2Fv3%2Fplugin%2Fansible%2Fcontent%2Fpublished%2Fcollections%2Findex%2Fnofusscomputing%2Fcenturion%2F&query=%24.download_count&style=plastic&logo=ansible&logoColor=white&label=Galaxy%20Downloads&labelColor=black&color=cyan)](https://galaxy.ansible.com/ui/repo/published/nofusscomputing/centurion/) + + + + + +This Ansible Collection is intended to compliement [Centurion ERP](../../../centurion_erp/index.md). + + +## Features + +- [Inventory plugin](./plugins/inventory.md) + + +## Ansible Automation Platform / AWX + +This collection can be directly added to AAP/AWX. To do so conduct the following: + +1. Add the collection as a Project + + `Projects -> Add` + + - name: _Collection/No Fuss Computing/Centurion_ + + - Source Control Type: _Git_ + + - Source Control URL: _https://gitlab.com/nofusscomputing/projects/ansible/collections/centurion_erp_collection.git_ + + - Source Control Branch/Tag/Commit: _set to a branch, tag or commit_ + + - `Save` + +1. Add a Credential type for the invneotries use + + `Credential Types -> Add` + + - name: _Collection/No Fuss Computing/Centurion_ + + - Input configuration: + + ``` yaml + + fields: + - id: CENTURION_API + type: string + label: Centurion Host URL + - id: CENTURION_TOKEN + type: string + label: Centurion API Token + secret: true + - id: VALIDATE_CENTURION_CERTS + type: boolean + label: Validate Centurion SSL Certificate + required: + - CENTURION_API + - CENTURION_TOKEN + + ``` + + - Injector configuration: + + ``` yaml + + env: + CENTURION_API: '{{ CENTURION_API }}' + CENTURION_TOKEN: '{{ CENTURION_TOKEN }}' + VALIDATE_CENTURION_CERTS: '{{ VALIDATE_CENTURION_CERTS | default(true) }}' + + ``` + +1. Create a Credential + + `Credentials -> Add` + + - name: _Centurion_ + + - Credential Type: _Collection/No Fuss Computing/Centurion_ + +1. Add an inventory + + `Inventoryies -> Add` and complete the fields + + - name: _Centurion_ + + - `Save` + +1. Add a source to the inventory + + `Inventoryies -> -> Sources -> Add` + + - name: _Centurion ERP_ + + - Source: _Sourced from Project_ + + - Credential: _Centurion_ + + - Project: _Collection/No Fuss Computing/Centurion_ + + - Inventory File: _inventory/inventory.yaml_ + + - `Save` + +1. a diff --git a/website-template/docs/projects/ansible/collection/centurion/plugins/index.md b/website-template/docs/projects/ansible/collection/centurion/plugins/index.md new file mode 100644 index 00000000..ff592be8 --- /dev/null +++ b/website-template/docs/projects/ansible/collection/centurion/plugins/index.md @@ -0,0 +1,11 @@ +--- +title: Plugins +description: No Fuss Computings Companion Ansible Collection Centurion Plugins. +date: 2024-07-31 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/ansible/collections/kubernetes +--- + +Available plugins include: + +- [Inventory](./inventory.md) diff --git a/website-template/docs/projects/ansible/collection/centurion/plugins/inventory.md b/website-template/docs/projects/ansible/collection/centurion/plugins/inventory.md new file mode 100644 index 00000000..c2af17df --- /dev/null +++ b/website-template/docs/projects/ansible/collection/centurion/plugins/inventory.md @@ -0,0 +1,9 @@ +--- +title: Inventory +description: No Fuss Computings Companion Ansible Collection Centurion Inventory Plugin. +date: 2024-07-31 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/ansible/collections/kubernetes +--- + +This inventory plugin obtains the data required from [Centurion ERP](../../../../centurion_erp/index.md) to build up an ansible inventory for all devices. diff --git a/website-template/docs/projects/ansible/collection/index.md b/website-template/docs/projects/ansible/collection/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/docs/projects/ansible/index.md b/website-template/docs/projects/ansible/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/docs/projects/centurion_erp/index.md b/website-template/docs/projects/centurion_erp/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/docs/projects/index.md b/website-template/docs/projects/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/docs/tags.md b/website-template/docs/tags.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/.cz.yaml b/website-template/gitlab-ci/.cz.yaml new file mode 100644 index 00000000..fd445ea6 --- /dev/null +++ b/website-template/gitlab-ci/.cz.yaml @@ -0,0 +1,7 @@ +commitizen: + bump_message: "build(version): bump version $current_version \u2192 $new_version" + changelog_incremental: false + name: cz_conventional_commits + tag_format: $major.$minor.$patch$prerelease + update_changelog_on_bump: true + version: 0.7.0rc0 diff --git a/website-template/gitlab-ci/.gitignore b/website-template/gitlab-ci/.gitignore new file mode 100644 index 00000000..a5e24abd --- /dev/null +++ b/website-template/gitlab-ci/.gitignore @@ -0,0 +1,17 @@ + +# Log files +*.log + +# Python environments +env/ +dev_env/ + +# ignore junit reports +*.junit.xml + +# ignore gitlab-ci artifacts +artifacts/ + + +__pycache__ +*.egg-info diff --git a/website-template/gitlab-ci/.gitlab-ci.yml b/website-template/gitlab-ci/.gitlab-ci.yml new file mode 100644 index 00000000..b27f1ec7 --- /dev/null +++ b/website-template/gitlab-ci/.gitlab-ci.yml @@ -0,0 +1,149 @@ + +stages: + - chores + - validation + - build + - prepare + - test + - release + - sync + - deploy + - publish + +include: + - local: $JOB_ROOT_DIR/lint/yaml.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/template/automagic.gitlab-ci.yaml + + - local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/lint/markdown.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/python/.gitlab-ci.yml + # - local: $JOB_ROOT_DIR/test/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/ansible/collection/ci-test.gitlab-ci.yml + - template: Security/Dependency-Scanning.gitlab-ci.yml + #- template: Security/License-Scanning.gitlab-ci.yml + + +variables: + JOB_ROOT_DIR: '.' + SECURE_LOG_LEVEL: debug + GIT_SUBMODULE_STRATEGY: normal + GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/gitlab-ci.git" + MY_PROJECT_ID: "28543717" + LICENSE_FINDER_CLI_OPTS: '--recursive' + MDLINT_PATHS: "**/*.md **/**/*.md **/**/**/*.md **/**/**/**/*.md **/**/**/**/**/**/*.md #**CHANGELOG.md #CHANGELOG.md #website-template/** #.gitlab/**" + PAGES_ENVIRONMENT_PATH: projects/gitlab-ci/ + +# Scanner doesn't Pickup multiple pip files. Disable and specify jobs with pip file. +gemnasium-python-dependency_scanning: + rules: + - when: never + +# source: https://gitlab.com/gitlab-org/gitlab/-/blob/2f33a8cb4dcea7b875e360d4cd9e016e027d2973/lib/gitlab/ci/templates/Security/Dependency-Scanning.gitlab-ci.yml +.gemnasium-python-dependency_scanning: + extends: .ds-analyzer + image: + name: "$DS_ANALYZER_IMAGE" + variables: + # Python 3.7 not available +# DS_PYTHON_VERSION: "3.7" + # DS_ANALYZER_IMAGE is an undocumented variable used internally to allow QA to + # override the analyzer image with a custom value. This may be subject to change or + # breakage across GitLab releases. + DS_ANALYZER_IMAGE: "$SECURE_ANALYZERS_PREFIX/gemnasium-python:$DS_MAJOR_VERSION" + # Stop reporting Pipenv and Setuptools as "pip". + # See https://gitlab.com/gitlab-org/gitlab/-/issues/338252 + DS_REPORT_PACKAGE_MANAGER_PIP_WHEN_PYTHON: "false" + # Can't find pillow 9.0, check python version. 3.6 only available, 3.7 not. + before_script: + - python --version + # Bug reported at gitlab-org/gitlab#350949. + # workaround, delete all other pip files except the one to be scanned + # Delete all existing pipfiles except the one to be scanned. + - for found_file in $(find . -type f -name 'requirements.txt'); do if [ $found_file != "./$PIP_REQUIREMENTS_FILE" ]; then echo "[DEBUG] Removing '$found_file' due to bug reported at gitlab-org/gitlab#350949"; rm -f $found_file; fi done; + rules: + - if: $DEPENDENCY_SCANNING_DISABLED + when: never + # Support passing of $PIP_REQUIREMENTS_FILE + # See https://docs.gitlab.com/ee/user/application_security/dependency_scanning/#configuring-specific-analyzers-used-by-dependency-scanning + - if: $CI_COMMIT_BRANCH && + $GITLAB_FEATURES =~ /\bdependency_scanning\b/ && + $DS_DEFAULT_ANALYZERS =~ /gemnasium-python/ && + $PIP_REQUIREMENTS_FILE && + ( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline") + +Ansible Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: ansible/requirements.txt + + +conventional_commits Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: conventional_commits/requirements.txt + + +gitlab_release Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: gitlab_release/requirements.txt + + +mkdocs Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: mkdocs/requirements.txt + + +python Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: python/requirements.txt + + +yaml_lint Dependencies: + extends: .gemnasium-python-dependency_scanning + variables: + PIP_REQUIREMENTS_FILE: lint/requirements.txt + + +PyLint: + extends: + - .PyLint + image: python:3.6-slim + + +gilab-ci.yml Lint (python 3.11): + extends: + - .Gitlab_CI.Lint.YAML + image: python:3.11-slim + + +Update Sub Repo: + extends: .submodule_update_trigger + parallel: + matrix: + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/ops + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/configuration-management/itil_runbooks + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/website + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_playbooks + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible-roles + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_docker_os + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_test + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/ci-test + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/firewall + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/kubernetes + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/phpipam_scan_agent + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/common + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/docker_management + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/execution_environment + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/git_configuration + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/homeassistant + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/nfc_glpi + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-bind + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-mail + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-buildx-qemu + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-glpi + - SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/kubernetes_monitoring diff --git a/website-template/gitlab-ci/.gitlab-ci_common.yaml b/website-template/gitlab-ci/.gitlab-ci_common.yaml new file mode 100644 index 00000000..82d8311e --- /dev/null +++ b/website-template/gitlab-ci/.gitlab-ci_common.yaml @@ -0,0 +1,16 @@ +variables: + JOB_ROOT_DIR: 'gitlab-ci' + GIT_SUBMODULE_STRATEGY: normal + #PIPELINE_RUN_TRIGGER: 'false' + PIPELINE_RUN_SCHEDULE: 'true' + +stages: + - chores + - validation + - build + - prepare + - test + - release + - sync + - deploy + - publish diff --git a/website-template/gitlab-ci/.gitlab/.gitkeep b/website-template/gitlab-ci/.gitlab/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/.gitlab/issue_templates/.gitkeep b/website-template/gitlab-ci/.gitlab/issue_templates/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/.gitlab/issue_templates/new_job.md b/website-template/gitlab-ci/.gitlab/issue_templates/new_job.md new file mode 100644 index 00000000..d95b30cc --- /dev/null +++ b/website-template/gitlab-ci/.gitlab/issue_templates/new_job.md @@ -0,0 +1,84 @@ +## :new: Ansible Role - {new ansible role name} + + +
+:clipboard: template filename.extension + +``` yaml +your yaml playbook here +``` +
+ + +### Playbook usage + + + + +
+:clipboard: example playbook + +``` yaml +your yaml playbook here +``` + +
+ + +### :ledger: Documentation + + + +
+:clipboard: contribution - Documentation + + + +
+ +## :link: Links + + + - link 1 + + - issue #number + + +## :ballot_box_with_check: Tasks + + + - [ ] ~Documentation Added + + - [ ] (dev) Merge request opened and linked to this issue + + + + + + +/label ~"workflow::not started" + +/label ~"category::feature" diff --git a/website-template/gitlab-ci/.gitlab/merge_request_templates/.gitkeep b/website-template/gitlab-ci/.gitlab/merge_request_templates/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/.gitlab/merge_request_templates/default.md b/website-template/gitlab-ci/.gitlab/merge_request_templates/default.md new file mode 100644 index 00000000..8f81fc63 --- /dev/null +++ b/website-template/gitlab-ci/.gitlab/merge_request_templates/default.md @@ -0,0 +1,34 @@ +## :books: Summary + + + + +----- + +| :link: **Related Issue(s)** | :link: **Related Merge Request(s)** | +|:----:|:----:| +| | | + + +### :construction_worker: Tasks + + + - [ ] merging to correct branch? + + - [ ] issue linked to this MR? + + - related issues: + + - [ ] closed in a commit message + + - [ ] Manually closed + + - [ ] All related issues tasks complete? + + + + + +/label ~"workflow::not started" + +/label ~"category::feature" diff --git a/website-template/gitlab-ci/.gitmodules b/website-template/gitlab-ci/.gitmodules new file mode 100644 index 00000000..b8db7a84 --- /dev/null +++ b/website-template/gitlab-ci/.gitmodules @@ -0,0 +1,4 @@ +[submodule "website-template"] + path = website-template + url = https://gitlab.com/nofusscomputing/infrastructure/website-template.git + branch=development diff --git a/website-template/gitlab-ci/.templates/README.md b/website-template/gitlab-ci/.templates/README.md new file mode 100644 index 00000000..156681df --- /dev/null +++ b/website-template/gitlab-ci/.templates/README.md @@ -0,0 +1,48 @@ +# {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" + +stages: + - {new stage name} + +include: + - local: CI/{job name}/.gitlab-ci.yml + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| NEW VAR | this var does this and bka | + + +## Job Workflow + + +## Artifacts + + +## License + +To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci) diff --git a/website-template/gitlab-ci/.vscode/extensions.json b/website-template/gitlab-ci/.vscode/extensions.json new file mode 100644 index 00000000..d5e2ce37 --- /dev/null +++ b/website-template/gitlab-ci/.vscode/extensions.json @@ -0,0 +1,9 @@ +{ + "recommendations": [ + "gitlab.gitlab-workflow", + "jebbs.markdown-extended", + "redhat.vscode-yaml", + "streetsidesoftware.code-spell-checker", + "streetsidesoftware.code-spell-checker-australian-english" + ] +} \ No newline at end of file diff --git a/website-template/gitlab-ci/.vscode/settings.json b/website-template/gitlab-ci/.vscode/settings.json new file mode 100644 index 00000000..b83abeec --- /dev/null +++ b/website-template/gitlab-ci/.vscode/settings.json @@ -0,0 +1,5 @@ +{ + "gitlab.aiAssistedCodeSuggestions.enabled": false, + "gitlab.duoChat.enabled": false, + "cSpell.language": "en-AU,en" +} \ No newline at end of file diff --git a/website-template/gitlab-ci/CHANGELOG.md b/website-template/gitlab-ci/CHANGELOG.md new file mode 100644 index 00000000..bb03693e --- /dev/null +++ b/website-template/gitlab-ci/CHANGELOG.md @@ -0,0 +1,506 @@ +## 0.7.0rc0 (2024-02-02) + +### Bug Fixes + +- **mkdocs**: [3fa71fe9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3fa71fe91ad1e874b76fab7323e02496ac757f5d) - correct mkdocs image name [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) ] +- **commit_footer_refs**: [0f6e06c5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0f6e06c50f7cae602cdc2ca00bbce7fe1fd72c32) - enable automated jobs without MR to succeed. [ [#44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/44) [!72](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/72) ] +- **commit_footer_refs**: [b8199586](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b8199586b4fe4c9f93efe68a908eaa8582f064c3) - dont update git submodules [ [!71](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/71) [#42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/42) [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) ] + +### Code Refactor + +- **mkdocs**: [955ce375](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/955ce3752050e78085c2037fe66714db41114c9e) - set env name to gitlab pages [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) [#43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/43) ] + +### Features + +- **sub_module_update**: [fc9f3761](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fc9f37617cd26b3e44326161ba10183eb13444dd) - wbsite-template [ [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ] +- **mkdocs**: [3fbd4317](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3fbd4317c0388fb8e406eb78614e3943375496ed) - update requirements.txt to current versions [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ] +- **mkdocs**: [c4087c70](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c4087c7069524df573a43db29c399940600ddba7) - update python to 3.11.2 [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ] + +## 0.6.1 (2023-11-06) + +### Bug Fixes + +- **docker**: [359c664d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/359c664d97c516bd3b35fb46961288c74f6bd940) - always build on tag [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) [#37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/37) ] +- **build**: [799de6c9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/799de6c98c0925ef4a85cf246512041fc89534db) - adjust to enforce [ [!66](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/66) ] +- **docker**: [4ea999ce](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4ea999cec96824c2670c5d448dff8c06b1582adc) - ensure on any changes to directory path, build occurs [ [!64](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/64) [#38](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/38) [!76](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/76) ] +- **template**: [4da44b77](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4da44b77dfbc015d28fda34fcfe54d70a6542943) - issue comment patch remove setting role path [ [!62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/62) ] + +### Code Refactor + +- **ansible**: [d21692f7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d21692f7886986db1808befb00b045c1a9a65a8f) - move submodule/issue patch to mr pipeline [ [!67](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/67) ] + +### Continious Integration + +- **deploy**: [f35d99dc](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f35d99dc436d1e9ab200a8b94052de2fa23608fc) - added docker management repo [ [!63](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/63) ] + +### Documentaton / Guides + +- [535d0b42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/535d0b42938fc66f94fd57018dd81e2111ad3abe) - update docker tag build [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) [#37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/37) ] +- [d9b303ed](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d9b303edc1f61f1d7a4785b5b5396625cc98a179) - expand [ [!59](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/59) ] + +### Features + +- **conventional_commits**: [3918686e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3918686e483f6fabb6c487be6f2d7105da08d11a) - do not run on master branch [ [!70](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/70) [#40](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/40) ] +- **sub_module_update**: [8eb57c58](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8eb57c580973fa49bd3ffb12553cc24e39c5afac) - enable passing commit type and category [ [!69](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/69) [#39](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/39) [!122](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/122) [#39](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/39) [!96](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/96) [!28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/28) ] +- **deploy**: [86a0292f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/86a0292fafa0fb139f068106dacfa2ee6917f4d4) - add new nfc repos [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) ] +- **release**: [837311c0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/837311c0221820b93072e9bfcba2191a8b96b9ea) - annotate git tag with changelog [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) ] +- **build**: [e8758c4c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e8758c4ccecdbf0c22a5e67bf086762c68c6b915) - no docs/docker build on master push, only tag [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) ] +- **docker**: [0d797415](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0d7974152c26200c8beaa3a1ddecf504f4406ee3) - add debugging to publish [ [#36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/36) [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) [#36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/36) [#11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/11) ] +- **deploy**: [1a168593](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1a168593eb0fd234885982a16bc216804e76d293) - added ansible.docker.os repo [ [!67](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/67) ] +- **docker_publish**: [9489c99f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9489c99fe489c9b9b9e29fc2013d5ff6a990094a) - on merge to dev always publish [ [!65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/65) ] +- **template**: [da40e027](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/da40e027376c163ca4915f3edcf322b6e0b0c278) - added auto job mr from issue comment patch [ [!61](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/61) ] + +## 0.6.1rc8 (2023-06-08) + +### Bug Fixes + +- **lint**: [4462ec04](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4462ec04268c5b967f0672828d1cd7b3995894d9) - all lint to immediatly start job [ [!57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/57) ] +- **ci**: [9b00af99](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9b00af996ff96f58a26b83066004e5a9e94ac155) - correct dockerhub tag [ [!57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/57) ] +- **ci**: [6af454be](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6af454be4d2b658e0c362392ff502b3fb3da2cbf) - remove spaces from regex exists and changes [ [!56](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/56) ] +- **ansible_lint**: [46d85bcf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46d85bcf49ea73545a5af4324c28af51a17acd3c) - enable first level dir paths [ [!55](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/55) ] +- **docker_build**: [11b62099](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/11b6209992294e45a051e26963d772d75014e516) - on success push container to docker hub [ [!53](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/53) ] +- **docker_build**: [e90b938b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e90b938bba092bdaecbc1a43758218da0058427b) - init submodule submodules [ [!53](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/53) ] + +### Documentaton / Guides + +- [469255f4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/469255f450e946a712d379415e45a74eb8c07995) - added notes [ [!58](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/58) ] + +### Features + +- **ci**: [0ec520f0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0ec520f02328b69642f929a19e8517c7d475a988) - add resource groups [ [!55](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/55) [#33](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/33) ] +- **sync**: [e75464c7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e75464c7c409fd17864624d48c9fec8e6e3544e9) - immediatee git sync [ [!55](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/55) ] +- **latest_artifacts**: [755fcac0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/755fcac06e9f265789b02a88eb90df35ab1dbf07) - ensure artifats for jobs are always avail on branches [ [!54](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/54) [#34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/34) [#331232](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/331232) ] +- **latest_artifacts**: [22dd4985](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/22dd4985be315be95be55b2b4edff5ae4ba1eeb4) - ensure artifats for jobs are always avail on branches [ [!52](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/52) [#34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/34) [#331232](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/331232) ] + +## 0.6.1rc7 (2023-06-05) + +### Bug Fixes + +- **mkdocs**: [5ffc68d7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5ffc68d7241bb0c729a990b4a5b060bd6488ea8c) - adjust rules to match lint [ [!51](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/51) ] +- **docker**: [097725c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/097725c1be5d155cebada0cf2cbb17ddbd041e6e) - detect canges in include path corrected [ [!50](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/50) ] +- **ci**: [9e098245](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9e098245d7a6272fd51aee0a479af3a233fdb30e) - typo in docker build [ [!49](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/49) [!20](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/20) ] +- **ansible_playbook**: [13ee3bf5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/13ee3bf535dadf7cada645ddec74e2e29872ac2c) - No4 enable parent pipelines [ [!47](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/47) ] +- **ansible_playbook**: [3c0543f7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3c0543f7ad0673bcb6600e6ff20693be5f784f23) - No3 enable parent pipelines [ [!45](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/45) ] +- **ansible_playbook**: [f3fa9c5a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f3fa9c5a416295cb2a0362a31f05995336ea9155) - enable parent pipelines [ [!45](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/45) ] +- **ansible_playbook**: [3ee48daa](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3ee48daa10eee6dd80b79ed076c4ad4d1ff9bb57) - enable parent pipelines [ [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ] + +### Features + +- **ansible_lint**: [6a149f6e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6a149f6ed6d514c42d67b6b04cea114aa32067b8) - added inventory & playbooks directories [ [!50](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/50) [#22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/22) [!27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/27) ] +- **ci**: [1dcb3ed5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1dcb3ed521538de47745ed00148bb4123708d90d) - dont git submodule recurse [ [!50](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/50) ] +- **commit_footer_refs**: [f3256c58](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f3256c5858e1b5b2b6444f9d8ae63f556f4acb30) - only run on changes [ [!50](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/50) ] +- **ci**: [d8a6d5f7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d8a6d5f7ec1f73d5ae506301666383aac843708d) - git gubmodule update trigger moved to api call via curl [ [!48](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/48) [!62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/62) ] +- **ci**: [35cfa92c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/35cfa92cd900e7ed7008695bf0b65aaf147bb0ec) - git submodule job moved to own definition [ [!48](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/48) [!62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/62) ] +- **ansible_playbook**: [a86d17ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a86d17eff267750c3713968852d5013ef00ee226) - rules set to never 'ONLY' [ [!48](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/48) [!62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/62) ] + +## 0.6.1rc6 (2023-06-02) + +### Bug Fixes + +- **md_lint**: [ba43bb9c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ba43bb9c8de87d723abcd0b4b7519c88d8c3b162) - lint on git tag [ [!43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/43) ] + +## 0.6.1rc5 (2023-06-02) + +### Bug Fixes + +- **gitlab_yaml_lint**: [efa62710](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/efa62710571e48872d700a8a8802a526fb86b1f6) - adjust logic to detect changes [ [!42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/42) ] +- **commit_footer_check**: [6accd863](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6accd8633ca0579de084d9762f610711ae1e5715) - run on non master/dev branches only [ [!42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/42) ] + +### Code Refactor + +- **ci**: [9d767282](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9d767282ffa86c48077bd08b605cf50be76a9b07) - update ansible-role repo path [ [!40](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/40) [#74](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/74) ] + +### Features + +- **submodule_update_trigger**: [86b05338](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/86b05338854f94997cb5cf09fad0561c09f86461) - only update own submodule [ [!41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/41) [#16](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/16) [!60](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/60) ] +- **mkdocs_build**: [ff8c43c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ff8c43c1ea2126cabf0ad2f400a784a9f90ec1ac) - always build on git tag [ [!41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/41) ] +- **ci_rules**: [04e7e928](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/04e7e928e0f4f2212078fd08fd87b2e024dd5257) - add exists and changes for rules [ [!41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/41) [#32](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/32) ] +- **yaml_anchors**: [862176f9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/862176f9dca8cf8ee998456db0cc12f7084f7fc0) - initial conditional checks [ [!41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/41) [#32](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/32) ] +- **ci**: [6f810f80](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6f810f8084e54f0afc9ebb47bfcc855536046a08) - add more repos to update [ [!39](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/39) ] + +## 0.6.1rc4 (2023-05-31) + +### Bug Fixes + +- **ansible_playbook**: [73ea66e6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/73ea66e60d9cdb235aebda839e0a734212c997bc) - always pull image [ [!37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/37) ] +- **mkdocs_build**: [c47be421](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c47be42184c96855f0702c0258931da9730df517) - ensure config file exists when run on branch [ [!36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/36) ] +- **automagic**: [8ced1720](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8ced1720e00f984e75c51bf8985e45d07aac8c09) - fix git submodule so it runs on schedule [ [!35](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/35) [#31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/31) ] +- **docs_environment**: [b68f6cb4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b68f6cb4b4a571dee52cb765ddb6a5a70c78b364) - don't define empty env path [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **doc_pages**: [91ac4476](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/91ac4476fbefd2476d1c147c1681a1a53cc40201) - use updated job name [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) [#30](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/30) ] +- **ansible_lint**: [75968b14](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/75968b140ca0b2734d6af14e78e7c598b6221600) - only run if tasks/main.yaml exists [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **mkdocs_build_website**: [0bc72554](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0bc72554534488d147356d148d635d490b8a1007) - renamed and normalized [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) [#30](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/30) ] +- **sub_folder_changelog**: [203a9990](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/203a99903c28201f74304ca8689fae25a7a28aa0) - dont create changelog for docs [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **jobs**: [a010f7ba](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a010f7bab19fc89f71c8bc5a81a3d1944f4bdc05) - jobs that occur on push should also run on 'trigger' [ [!33](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/33) [#26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/26) ] +- **docker_publish**: [79855cdb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/79855cdb99762fd444bedddb6be59cb4ba41fe50) - job only run on dockerfile exists [ [!32](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/32) [#28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/28) ] +- **docker**: [502f12c2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/502f12c21689f86675a000e51ca415019fcad184) - job only run on dockerfile exists [ [!31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/31) [#28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/28) ] + +### Code Refactor + +- [e79b5545](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e79b554550dbabe5df429d6c57fe15cb2b144432) - rename website to documentation [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **ci**: [681b8f1a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/681b8f1a0293986a0b67ba13c72bf8dd92ca692a) - update deploy job name [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **docker_hub**: [7b4b01bd](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7b4b01bdab2c4299e892071ef3c19b324bf3768c) - move needs to template [ [!31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/31) ] + +### Documentaton / Guides + +- [87165450](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/871654508cd183afc1240c9c5de16e9f762c89ee) - refine [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **automagic**: [95bc6a5b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/95bc6a5b036d809ef4bce8af6f70568c595785eb) - added initial autmagic docs [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **ansible_playbook**: [39881505](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/398815055e013059afc6c4d99fa97bdeeb003909) - document ci job definition [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) [#26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/26) [#27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/27) ] + +### Features + +- **ci**: [7018440d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7018440dcbd09c2eb406817eab7df3e24e19687d) - on push to dev, update git sub modules on specified [ [!38](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/38) ] +- **mkdocs_build_docs**: [5e491285](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5e4912857aea43678b2ef61230df3817f193d684) - keyword needs does not belong in definition [ [!36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/36) ] +- **lint_markdown_docs**: [9ebd0a27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9ebd0a27f65b36b289b3e7c0647e839b5f7a2798) - ensure also detects website [ [!36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/36) ] +- **ci**: [44076553](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/440765537dcc4370d6558ec5d41fe7f87a5f7f4d) - use automagic ci template [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **automagic**: [18bc18c2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18bc18c29b4ae08963d4c744e9479622b2cd921c) - add ansible template [ [!34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/34) ] +- **ansible_play**: [fff7d314](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fff7d31498d486b1c39f1672df9b283ad02c21d8) - force output colour in job logs [ [!33](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/33) ] + +## 0.6.1rc3 (2023-05-28) + +### Bug Fixes + +- **scheduled_pipelines**: [bade89c5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - if scheduled pipeline only run schedualable jobs [ [!30](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/30) [#29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/29) ] + +### Code Refactor + +- **ansible_playbook**: [f9af921e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f9af921e6b6ec10f9f77ec6a016c6cbb9559d1bf) - final logic adjustment for job [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [#25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/25) ] +- **automation**: [1f6ee9ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1f6ee9ea27824df1c82bf85e1e239f57f2145bdf) - final logic changes [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [#25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/25) ] + +### Features + +- **auto_jobs**: [c5d27e83](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c5d27e832e100156cb99c5ca580fd5a8eb600e0f) - created initial template to auto-create jobs [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [#26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/26) ] +- **variables**: [158cc94d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/158cc94d1a817f89b6603e9bac7678196b21d1d5) - added pipeline trigger and schedule [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [#26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/26) ] +- **automation**: [0d3eaa6a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0d3eaa6ac2dc448505b18c6aecd4a72e28ffde83) - job to run ansible playbooks [ [!29](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/29) [!8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/8) [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) [#5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/5) ] + +## 0.6.1rc2 (2023-05-24) + +### Bug Fixes + +- **sub_folder_changelog**: [0482c014](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0482c0144ede393996449a22f1f7742c2e512ac2) - dont create in git submodules [ [!28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/28) [#23](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/23) ] +- **md_linting**: [e26f590e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e26f590ebcf284be949be4e1d337e1f587755446) - must lint on git tag [ [!27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/27) [!3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/3) ] +- **mkdocs**: [7a9aca3a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7a9aca3a54b1faacb7e286bade84aff0ff4fd2e5) - default to docs directory as root [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- **template**: [0b9e7375](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0b9e7375c911d65e06b0d801755449ab31cb45ea) - use correct path for build artifact [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **markdown_lint**: [18af7f83](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18af7f831ad2399a6ae9809c51e87f19450db1a7) - use new lint path [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **markdown_lint**: [12d3a412](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/12d3a412ac73baff16b77488db143efd7311b542) - typo in config variable [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs**: [f42b0ecf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f42b0ecf60def9d0f8d366d09ab91006b6fe32c6) - add placeholder pages [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **docker**: [f604c6e2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f604c6e27d2e7704491f4c78979db40cf89764c0) - ensure qemu binfmt is loaded [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) [!1861](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/1861) ] +- **docker_hub**: [8e0f16c5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8e0f16c585978ded46164c80559b402c0cb2edf2) - push correct image [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **lint**: [a754aa81](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a754aa81edf1570b4e8e2e7d4a23025c8b99f314) - use correct path for requirements.txt [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **gitlab_release**: [18a28087](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18a280878799fe077efa0ed5b11bceedd53eb5c8) - allow skip on dev branch [ [!17](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/17) ] + +### Code Refactor + +- **docs**: [7c385b75](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7c385b7552945699eb87ec3ec43169df0cb77297) - pages dir renamed to docs [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- **template_website**: [1b59d623](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1b59d62348465cc9cc069d5ee23e759316fa9b3c) - adjust names of jobs [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **markdown_lint**: [bce7396d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bce7396d8bbf5ec6600a3a34a05198a87c4fcc70) - move md linting to lint folder [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **docs**: [3a2a135d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3a2a135d0af50a9360870e0a7f362c3820543e40) - markdown linting errors fix [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs**: [dacb9f22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/dacb9f22dd9aee1ff741c7ac8078912d9a2b0dbf) - use locked version from website repo [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **docker**: [a90ccb81](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a90ccb81772e295cebe89d7a9c32ab700e19884d) - move docker jobs to their own file [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- [c34e382a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c34e382a22cd39874abd8fb5116e831e888db8af) - use name that makes sense [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- [539e40e3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/539e40e3008e24411f62f439d394db4b5e69a066) - move ansible and yaml lint job to linting folder [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] + +### Continious Integration + +- **pages**: [bcb80358](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bcb80358d9adb6b3a89fab1003f4434fb2949bdc) - add pages slug [ [!27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/27) ] + +### Documentaton / Guides + +- [28c04fb2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/28c04fb2e854521167367161d13b09650829d17d) - add job definitions to page [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- [657df7a5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/657df7a5ceb59798c7bb072aed5bf7ef82aef9b6) - add job definition to page [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- [0bc3451b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0bc3451bc20e7705a32d89e9f601af363523d946) - added edit url [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- [4fb85408](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4fb85408b8f4e8b87eb97a43db50c86399d8e350) - move readme to project pages index [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- [b66abc19](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b66abc1947676a624d32b4895a9a05000105f36a) - notate under development [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- [61200e52](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/61200e526efcb71bcec9f27ac4bd7c6f02fc23a6) - update structure [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **template**: [e40310fc](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e40310fc21b6af684f6db7858196e8180b6e03df) - add index and website [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- [55061ad5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/55061ad5efd303cf5a53c4672409f7d159113c62) - use project template [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs**: [1ec2666e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ec2666e8565d5206aefaf5462f0f83f74fbbcb7) - moved to pages folder [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **conventional_commits**: [70dfb826](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/70dfb826d100432265e3f3b08948bb808855e0aa) - added config file requirement [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] + +### Features + +- **template_website**: [bef76847](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bef76847ec686fcff92229d7b9be0bcfc7b267da) - enable specifying the url slug [ [!27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/27) ] +- **docs**: [a8f675c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a8f675c102d0027f23b4490aa3620b504d0193cc) - temp adding of requirements [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) ] +- **mkdocs**: [71a335c2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/71a335c2667505c199bd67446327cd8794de5f52) - install website-template requirements [ [!26](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/26) [!7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/7) ] +- **pages**: [480502a7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/480502a7638f346be8334d3c03d5b00ec18f0c2f) - don't include projects in nav [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **template**: [8e2a2338](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8e2a233814bd76ebff3dd8ed5a79afe307a84755) - always deploy to pages on dev manual other [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs_build**: [a0b6d05a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a0b6d05a0f3f0fa84c825007f6ec9f28c945f3ef) - always build [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs_build**: [6d2e50e9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d2e50e947839576f098bd7700e00b9d6ab4be1e) - add manual build [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **template**: [4fa90d4c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4fa90d4c4249ed8929e7dde2e7bd0e8581d0d8a7) - use md lint config from website-template [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **markdown_lint**: [38d46900](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/38d469007a388312c71a61916275d6a12aad8bbd) - enable specifying the lint config path [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **pages**: [15750124](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/157501245d7c347670055352f9263917a2c3f445) - use repo name [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **website**: [16d47d5e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/16d47d5e350e1c78f72c97780ed1732a43927fcc) - add pages job for website [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **template**: [91a50eb1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/91a50eb15bd92ca65481a73c6f095681281941fe) - created website job template [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **mkdocs**: [5556a57e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5556a57ea5588d4f0cd1434bfdde5cd77e3b4f5c) - only run on success [ [!25](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/25) ] +- **conventional_commits**: [088c9fb0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/088c9fb04c80961f4de8d2b129955ae8cd0b9529) - ensure .cz.yaml exists [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **docker_build**: [6765894c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6765894cebc958df92fd3f42d93bd205101d1966) - enable spcifying the dockerfile to use [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **template**: [67f39d96](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/67f39d9694b80ad0d2d08800d4faadf594fb6623) - added a ansible-role job template [ [!24](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/24) ] +- **gitlab_release**: [d89941df](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d89941df05bfed4b0ad1277e715b224d232e7949) - dont automagic run on dev [ [!4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/4) [#21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/21) [!23](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/23) [#21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/21) [!4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/4) ] + +## 0.6.1rc1 (2023-05-15) + +### Bug Fixes + +- **ci**: [b0024c99](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b0024c99b0cd06e12f95882749b3668a639cf24c) - v no longer suffix to tag [ [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) ] +- **docker**: [72f52898](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/72f52898869fe23174e649f0bf8327732fd52147) - setup ROOT_DIR [ [!3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/3) [!1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/1) [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) [!3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/3) [!1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/1) ] +- **conventional_commits**: [76db5b17](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/76db5b17578d8585ed31e0728dbfb37ea2fae153) - never run on git tag [ [!7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/7) [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) [!7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/7) ] +- **markdown_lint**: [8581981a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8581981a43c31d6903865f067fa3f77adae949e5) - fix search paths [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [a04b272c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a04b272c167dae27940211b7c77a4adcb33b2086) - remove extra var creation [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [3b686a46](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3b686a461be22b682642eb1143f2bd2ea2d3ef17) - ensure config is within double quote [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [52c6ceda](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/52c6ceda83b04e1e18eaa9c32b1a41733dc26497) - scan all [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [0d59871a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0d59871a1a73178c248b2189dfae2cd93f21c469) - enable specifying additional config [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **markdown_lint**: [cf10e289](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/cf10e289d21a5cc529bbe7effb189aab65875510) - enable job for md in sub folders [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) [#19](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/19) [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) ] +- [d389d141](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d389d14192e1e483fbd48fa9b5c5bee25db14a20) - validation jobs on all except merge [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [a745ceac](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a745ceac5ebce458b46593311e5285f40dcba349) - fixed rule to match nfc_bot [ [!20](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/20) [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) [!20](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/20) ] +- **gitlab_release**: [e76378dd](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e76378dd068e200a1198f1811efb9d3bec7878f5) - only run on master on_success [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) [#16](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/16) ] +- **ci**: [934a401a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/934a401a9620891b09a5fe9c9b0e50a97b43fa9b) - specify the commitizen version [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **markdown_lint**: [8391bf65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8391bf659bf5dd39edf31205a68c699851e78be3) - remove quotes from search path variable. [ [#18](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/18) ] + +### Code Refactor + +- **ci**: [02e9e5f4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/02e9e5f4f4cc0b93ae92c7ba3a2cfb38305af64c) - inconsistant tabs [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- [adc720bb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/adc720bbfa0dd8ff66f70fe56678b5f388ce8d0c) - cleanup non-needed dir [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [1fa7fec3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1fa7fec38a54b7ddf460b1394a7024ef161fab24) - show debug before command [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- [408e4eab](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - move docs as part of restructure [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- [9a7ae710](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9a7ae7106e80a038b31cdc9fc172bb1f974ecb94) - set correct commit details for nfc_bot [ [!20](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/20) ] + +### Continious Integration + +- [1233d6ad](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1233d6ad90032f3a6c5a3a6ff0c92510d0ef298a) - disable licence scanning until fixed [ [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) ] +- **yaml_lint**: [ca60625b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ca60625bf171924e91ea6eea5aa3decc51b7f0dc) - update to python 11 +- **markdown_linting**: [47e39849](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/47e3984916bf671e6dbc39e05160a2409fc78b6b) - exclude .gitlab and changelog [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- [49282457](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/492824572b963f048af993fc36d8696f9b0fe41e) - dont lint git submodule website-template [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **docs**: [72f8eb72](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/72f8eb720d5266b7aa83b5e2974da075a1c06875) - added mkdocs config [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] + +### Documentaton / Guides + +- **yaml_lint**: [a925db14](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a925db14641e709572b832278f43aabe48d153f7) - update docs for new variables [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] + +### Features + +- **conventional**: [93931cb9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/93931cb9076e0db238f4e297abe3d8f37bd71b80) - job not to run when bot pushes change [ [!22](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/22) ] +- **ci**: [7ed3f92d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7ed3f92dd75397ad4623ada8469633dc8b0caf5f) - exclude website-template from yaml lint [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **ci**: [bbbf9e35](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bbbf9e35e2ad5d0fdf1c4c697f127dfe68d5e0da) - set correct search path [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **yaml_lint**: [0b4e85c3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0b4e85c3134ff9f126056113383383559cdfb227) - added var to prevent job from runnng [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [e06ffef6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e06ffef66c4a0ba1f48f109c175239560909e698) - run on merge to development [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [199ea1f2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/199ea1f23c6a3df2b40ae3d9a5668719301500d9) - never run on merge or git tag [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **git_push_mirror**: [1db2209d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1db2209dfb36fbdda28d68388aec9f62f85b57bc) - always sync git tag [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **template**: [8b9a0356](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8b9a0356dec7d99a63c4ed744b78ae707155e9f3) - added new template for ci pipeline for docker containers [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **common**: [9670fc47](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9670fc47401630ef6c407bd7eaccd3db64195543) - created a common ci file for inclusion [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **commit_footer_refs**: [8d512a9a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8d512a9a4bd7f4895645436f057c4bab3efb864e) - ability to disable job with variable [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **gitlab_release**: [a37acbfc](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a37acbfc7d3ea20ece7cb76e15a14858b26f8508) - ability to disable job with variable [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **git_push_mirror**: [81445c06](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/81445c06e43bce10761e3a7fbad7df97f82d6bc2) - ability to disable job with variable [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **conventional_commits**: [9e7d357b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9e7d357bab2b92704d37ad5621df9fe8d1e31a26) - ability to disable job with variable [ [!21](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/21) ] +- **markdown_lint**: [d75e9599](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d75e95998b4a195cfcc36683ffa6f058bf7b05be) - artifact locations to be hard set [ [!19](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/19) ] + +## v0.6.1rc0 (2022-01-25) + +### Bug Fixes + +- **lint_markdown**: [e0402ecf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e0402ecfb2ab662a74bb70df7937b02576d5e41b) - ensure the correct path for the job directory is used [ [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) [!18](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/18) ] + +## v0.6.0 (2022-01-24) + +### Bug Fixes + +- **ansible**: [0df60b12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0df60b12dbfff983ca3a671b90ab1be126597e52) - remove duplicate lines that last code review didn't remove. +- **ansible**: [484d9879](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/484d98792a27c9d967331e9d3cd1afdca435bdd6) - fix typo in job pip file +- **dependency_scanning**: [e1894ec0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e1894ec0c4fe7504901682f008c2ff0db7e351fe) - upgraded versions from vulnerability scan. + +### Code Refactor + +- [6668c2fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6668c2fb8d7545b4f9052ad3065e58f00d11be62) - test specifying must equal. + +### Continious Integration + +- **markdown_lint**: [3096d7ee](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3096d7ee0a86d104de04e77b4b734ec0d266020d) - Added Linting of Markdown for files in this repository. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **mkdcos**: [a2d705de](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a2d705deb1f3898b6d5fa4d55bd995b1a7ad4b68) - mkdocs requirements.txt had a '\n' in the filename. renamed. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [39a76a08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/39a76a08691dbdf487405f7c5e6b717eb862d80f) - delete all python 'requirements.txt' files that are not the specified one to be scanned. [ [#350949](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/350949) [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [4e1da5e8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4e1da5e87281284e021791a4b600a1bff53b8431) - python 3.7 not available for dependecy scanning. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [a6afa766](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a6afa76600e07d40e8b94fa2d8385ad78634e3b0) - increase python version to 3.7 [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [7153f9b4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7153f9b42591e177112d279d2134fc0db1f5a14d) - check python version as pillow 9.0 reported as not found. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **dependency_scanning**: [996ee64a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/996ee64ab43f926ca52ab3154ab43e20b6d48fcb) - scanner set to use python 3.6 [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- [725bfaf8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/725bfaf829069002e3b2cb944556d2ce5facb426) - debug logging for dep scanning +- **python_dependency_scan**: [2fffa866](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2fffa866d84f460893c8d9711bc21a74908edb3e) - disabled main job and manual setup for all ci jobs. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **licence_finder**: [83cce72a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/83cce72af22b09bd8a245af99e9134d3be129eac) - set to recursive scan so all licence's can be detected. +- **scanners**: [fc816192](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fc816192be680f64ee1b4b96cccd0d605c529b86) - Added dependency and licence scanners +- [5c872f16](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c872f163e4de5834efd74a78e3e948d242916ec) - Added a test stage for gitlab specific tests. +- **artifacts**: [e0d8885d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e0d8885d52319a6188c779e80c2064b773721184) - markdown lint and mkdocs build artifacts to expire after 24 hours + +### Documentaton / Guides + +- **markdown_lint**: [b6dcb47b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b6dcb47b1d1831784d36f482fd99c0ce5e56f088) - removed no longer needed requirement. +- **markdown_lint**: [fd48316a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fd48316ae763282fc106b7da184c05b35d9ae052) - updated docs on how to use and view rules. +- **mkdocs_build**: [347597e3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/347597e3c1cb20eaa32d1e1cbb2d9d13661a663a) - include mandatory vars in template ci file. +- **mkdocs**: [1ef0e224](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef0e2245facffb760ba2ad9a57af1d6178a2d1a) - Completed the mkdocs build readme [ [#15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/15) [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) ] +- **markdown_lint**: [6363ea37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6363ea377cd008bbc839e6f4ee4fca337b77bc19) - completed the job docs. [ [#12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/12) ] +- **mkdocs**: [5c05ed76](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c05ed7605ddbecb1a3c7046716afa07829c264f) - initial adding of mkdocs build readme. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) [#5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/5) ] +- **markdown_lint**: [6383cde3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6383cde3bf9985b2cb43908bc2486d1dc67b7026) - initial adding of the docs [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) [#12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/12) ] + +### Features + +- **markdown_lint**: [9ab336fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9ab336fbddd6cba1d29c5a001ab52772ed4554b6) - include junit configuration file '.markdownlint-cli2.jsonc' in ci job. +- **mkdocs_build**: [906f09e2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/906f09e2d3285681bd982d65eda3f56cf5a5169e) - use a pip file for job so that licence scanning can function. +- **mkdocs_build**: [5a41962a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5a41962a994a54d99a3e7ab1bc0d7379ea14c1c2) - move ci job dependencies to a pip file so that the ci dependency job can check versions. +- **build**: [50b5e854](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/50b5e8542b827e6b6cf70f3f4c26b4c1737fe0c1) - initial add of mkdocs build job [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) [#15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/15) ] +- **validation**: [954aa28d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/954aa28dbf1073be05a3dd6d13da818a0bc7cb4e) - Added a Markdown linting validation job. [ [!15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/15) [#12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/12) ] + +## v0.5.0 (2022-01-16) + +### Bug Fixes + +- **commit.py**: [73918f2f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/73918f2f5e19440d0e300da3a20712739c316d88) - filter merge request search to 'opened' and on current branch. [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] + +### Continious Integration + +- **MR_Title**: [31517b4b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/31517b4bf00c1f177ef925d09b1a6714577f62c5) - save the merge request title as a variable and debug output in job log. [ [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] + +### Documentaton / Guides + +- **README.md**: [f4670844](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f4670844cc0961bf38fbf760f8eee505a54ab495) - Added project header template [ [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] + +### Features + +- **.yaml_lint_defaults**: [140985c3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/140985c3a4ea07cf30f7fe8c970fb07cc61b776d) - Always run on all branches as this denotes quality. [ [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] +- **commit_footer_refs**: [82c6c9f5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/82c6c9f5d53594544cea9a7bc59a10ab1e9ebedd) - never run on development or master. [ [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) ] + +## v0.4.0 (2022-01-15) + +### Bug Fixes + +- **commit.py**: [99bdc2a0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/99bdc2a0929d4e7036e50e8ce22ce9b0f90f0736) - fix typo that caused exception [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **conventional_commits**: [d03d9fef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d03d9fefc916dd6730d9ffa778c11d48d621318e) - fetch all branches prior to check for parent branch [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **ci**: [d5782d95](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d5782d95e825d406ea805c425cfefd6752fb6e35) - added variable 'GIT_SUBMODULE_STRATEGY' to be 'recursive' [ [#10](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/10) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **conventional_commits**: [42ad02ee](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/42ad02ee5db65c3c6c33ad14fe0371c9916897bf) - use git show-branch to find origin branch [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/11) ] + +### Features + +- **commit.py**: [e5531fc7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e5531fc77b5bdb1ccc0741e388df2d8d25ba6ade) - throw an error if no token was supplied. i.e. empty variable. [ [#11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/11) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **commit.py**: [6b7ad95f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6b7ad95fc0ccccf79ff645bad3f86660f5096a4e) - confirm a merge request was found, if not output 'ci: No Merge Request found' [ [#11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/11) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **commit.py**: [c543c47a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c543c47af8c7c386ae57f5a7a50904d396758c3a) - try to us `CI_JOB_TOKEN` before the specified token, if any. [ [#11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/11) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] +- **commit.py**: [b01550e0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b01550e09f273edc8a57f4ad4b41ee2d67705d41) - removed ability to fetch first commit or target branch [ [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [#6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/6) [!12](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/12) ] + +## v0.3.1 (2022-01-11) + +### Bug Fixes + +- **pylint**: [4b6cc317](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4b6cc3176fc4acc3b7dbb954162802af9cbb4c68) - install the required packages for files being checked [ [#7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/7) ] +- **pylint**: [936299ae](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/936299aefc6eadf9cbfec3152b352b321969cfab) - fix bug introduced in code quality commit [ [#7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/7) ] +- **commit_footer**: [2ac22c0e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2ac22c0e914016a8944ff9b94640f3e87f409069) - fix bug introduced in code quality commit [ [#7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/7) ] + +### Documentaton / Guides + +- **readme**: [8ac36de8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8ac36de8e0f113ce17d54dfce1345a0adab41bc8) - Updated with an example .gitlab-ci.yml example [ [#2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/2) [!10](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/10) ] + +## v0.3.0 (2021-08-12) + +### BREAKING CHANGE + +- !2 + +### Bug Fixes + +- **commit_message**: [3360a15f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3360a15fde12682edfd9044d2541dc819615b838) - fixed commit message check if there is only one commit to the branch [ [!7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/7) ] +- **commit_footer_refs**: [63af1efb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/63af1efb4fd92a9f8755f766728a18d8f390b805) - Use the current git branch for comparison. [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [f76cabee](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f76cabeeb04b028a231dc1c232862db5fcad4345) - Adjust release workflow [ [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) ] + +### Code Refactor + +- **gitlab_release**: [eb0bf4c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb0bf4c1740dbd7a47ceb031c0d1c854899a1e40) - file link to be in local repository for helping fix commit footer ref check failures [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] +- **gitlab_release**: [81776223](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/81776223c5cb392c12c7ca63488a1df10290e9d1) - use a name for failed test to denote the issue [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] + +### Continious Integration + +- **gitlab_release**: [7cb676eb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7cb676eb98a7de30d47a6b49a87067116684cfd2) - Add a validation job to check if commit messages contain a gitlab reference in the footer [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] + +### Documentaton / Guides + +- **readme**: [0653766c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0653766c935cb117082bfe1481ae83e4a1b2bb5c) - Updated badges and intro [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) ] +- **gitlab_templates**: [9f7a24c1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9f7a24c1ebc0bdb5a153977dcb1c53d7ec2fb140) - added issue and merge request templates [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **template**: [da8eb5c3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/da8eb5c3381379f6e405c3ebe14d9a883c52f41a) - added template readme for CI job folders [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **readme**: [ace7a034](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ace7a03456861d59e2f904405f45409c53e831ab) - explain sync and using github to link gitlab-ci [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **readme**: [8790917e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8790917e7d959aa7b8305912bb443ba6b72200c6) - explain repo layout and versioning [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) ] +- **readme**: [19900945](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/19900945e763249b6ef7a9e2e2cbcf11748b1eea) - added how to update gitlab-ci [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) ] +- **readme**: [8a988ebf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8a988ebf09015211f8f6566acc0ba71c1f00bee1) - Added how to use this repository [ [!5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/5) ] +- **gitlab_release**: [dc13d4f2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/dc13d4f2841038c085dcf29dfb0b0c5d2f00f099) - Added user docs to fix errors from ci job 'commit footer refs' [ [#3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/3) [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] +- **changelog**: [35edb7cf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/35edb7cfc59e2d147bdb5cb5d03710ec747073ae) - Updated changelog to new layout [ [!3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/3) [#3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/3) ] +- **gitlab_release**: [5f273ce2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5f273ce23a331eaf11623207ec4aba8b856c14f0) - Updated docs with new instructions on version incrementing [ [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) ] + +### Features + +- **python_linting**: [d6105624](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d61056243804728e059b99fce1644a8cc37230bb) - added ci job, python linting, code quality and scoring [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **yaml_lint**: [d20a56fa](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d20a56fa0ca492e3fc2ad7c548fc891cc8ffc8ec) - Added job yaml lint for checking yaml files [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [22136f7d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/22136f7dd22b9487d362a7ed63ca1b76e52b9cc7) - Toggle var added to enable switching changelog references. [ [#3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/3) ] +- **gitlab_release**: [756b9406](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/756b9406dde8cf0bf0030ac72855a054ece3a883) - be able to toggle commit footer check job [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] +- **gitlab_release**: [11e15661](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/11e156619d0d820e534897bafd5f39e6f9defcbf) - python module to check if a commit message has gitlab references in the footer [ [#4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/4) ] +- **gitlab_release**: [8699c412](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8699c41219d70e6f41f42dc7f2c1bcf542b3f723) - Add commit footer to changelog [ [!1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/1) [#3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/3) ] + +## v0.3.0rc1 (2021-08-04) + +### Documentaton / Guides + +- **changelog**: [cb78ab82](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/cb78ab82182a9edcd568a8b4c315490041539149) - regenerated so that all entries use the new url format [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +## v0.3.0rc0 (2021-08-04) + +### Code Refactor + +- **gitlab_release**: [cc3fabda](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/cc3fabdaa28f97c3e1600e4a0d95a05bb547e772) - Use Short commit SHA1 in main changelog link to gitlab [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Features + +- **gitlab_release**: [3e8c3ce7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3e8c3ce7cd64a6e9110818d32c15c3602fefb76c) - On the development brnach, releases to be 'rc' to denote considered non-stable [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +## v0.2.1 (2021-08-04) + +### Bug Fixes + +- **gitlab_release**: [588698df](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/588698df2668853a97fe60901ab324310f34f279) - Correctly fetch the CI_PROJECT_URL for the environment + +## v0.2.0 (2021-08-04) + +### Code Refactor + +- **gitlab_release**: [7a69685b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7a69685b53cbe5bd7341a176bf63fd17d36bc7f0) - Dont conduct any release, git push or tag delete if the version was not bumped +- **gitlab_release**: [72e8b6c8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/72e8b6c84defdb903c5741e3469651987769713f) - build gitlab commit url for changelog so that there is a weblink to the changes [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Documentaton / Guides + +- **gitlab_release**: [eebe8e30](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eebe8e30dcb11cd239f35fcb98216b2ae4d20ece) - Include custom command instructions [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Features + +- **gitlab_release**: [287b4c95](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/287b4c954dddfaaf0a66af387676ea438cc80e61) - Include code refactor as part of the changelog [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +## v0.1.0 (2021-08-04) + +### Bug Fixes + +- **gitlab_release**: [80ca3618](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/80ca3618ee56d0f2a2c012416cb6206599a4f3f6) - A 'feat' commit must do a MINOR bump to version [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [ed5be7fd](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ed5be7fd3c16e86d48e179a2cded53a38f79e1d9) - ci image is alpine, use '/bin/sh' and add the changlogs to git cache for commiting [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [7706085b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7706085b09f3cd9b7c09f7f93b182fd425f6525a) - All tasks run as part of script including user custom script [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **gitlab_release**: [1446c28e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1446c28ed2bfe2efec99bc2fc83b111717bcb2af) - Use a user token to access the git repo for pushing commits back [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **ansible**: [2a3266fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2a3266fb537e22dddf47708d0af101945027128f) - Ensure the default ci directory is populated [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Code Refactor + +- **gitlab_release**: [2035ed27](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2035ed27af7fc1f3f5b2c42aa5874219fc5fe323) - use 'git log' to get current commit hash [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Continious Integration + +- **git_push_mirror**: [b5935056](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b593505698b3d3359569f29f97c90e17e211f304) - Push repo to github NoFussComputing/gitlab-gi [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **conventional_commits**: [a2174104](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a2174104d1eb05d329bacd44700bf81ac709dcac) - Add conventional commits job to check commits and MR titles [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Documentaton / Guides + +- **README.md**: [247264e3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/247264e36bc0b6c86d2f06f8dae09ff7447fc156) - Added readme for the repo [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **git_push_mirror**: [7ffb2041](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7ffb20418cfa8e6fa20cca60e42155171961d1ce) - Update workflow and typos [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +### Features + +- **job_changelog**: [1ecd857c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ecd857c0bf8ef009ad2482ad1d52604adadc0ed) - Create a changelog per job folder [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **git_release**: [6678a3db](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6678a3dbab2763addc185e766cbaffbc074a6e98) - Migrated from ansible-roles [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **ansible**: [2413daef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2413daefb1e7e5a9e7a3cbb2d8cff2214f4a98ae) - Added ansible validation job for linting [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **git_push_mirror**: [9b28ae59](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9b28ae5952adfb3d61e660814074ad3c7b42ff61) - Added a job that syncs to a remote git repo [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] +- **conventional_commits**: [392a200f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/392a200fd469c4161dbab5f2b59031a7a64f20a2) - Added conventional commit job [ [#1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/1) ] + +## v0.0.1 (2021-08-03) diff --git a/website-template/gitlab-ci/LICENSE b/website-template/gitlab-ci/LICENSE new file mode 100644 index 00000000..08f796d7 --- /dev/null +++ b/website-template/gitlab-ci/LICENSE @@ -0,0 +1,22 @@ +MIT License + +Copyright (c) 2021 No Fuss Computing + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/website-template/gitlab-ci/README.md b/website-template/gitlab-ci/README.md new file mode 100644 index 00000000..5cbadf39 --- /dev/null +++ b/website-template/gitlab-ci/README.md @@ -0,0 +1,73 @@ +
+ +# No Fuss Computing - Gitlab-CI + +
+ +![Project Status - Active](https://img.shields.io/badge/Project%20Status-Active-green?logo=gitlab&style=plastic) + +
+ +![Gitlab forks count](https://img.shields.io/badge/dynamic/json?label=Forks&query=%24.forks_count&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2F&color=ff782e&logo=gitlab&style=plastic) ![Gitlab stars](https://img.shields.io/badge/dynamic/json?label=Stars&query=%24.star_count&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2F&color=ff782e&logo=gitlab&style=plastic) [![Open Issues](https://img.shields.io/badge/dynamic/json?color=ff782e&logo=gitlab&style=plastic&label=Open%20Issues&query=%24.statistics.counts.opened&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2Fissues_statistics)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues) + +![GitHub forks](https://img.shields.io/github/forks/NoFussComputing/gitlab-ci?logo=github&style=plastic&color=000000&labell=Forks) ![GitHub stars](https://img.shields.io/github/stars/NoFussComputing/gitlab-ci?color=000000&logo=github&style=plastic) ![Github Watchers](https://img.shields.io/github/watchers/NoFussComputing/gitlab-ci?color=000000&label=Watchers&logo=github&style=plastic) + +
+ +This project is hosted on [Gitlab](https://gitlab.com/nofusscomputing/projects/gitlab-ci) and has a read-only copy hosted on [Github](https://github.com/NoFussComputing/gitlab-ci). + + +---- + +**Stable Branch** + +![Gitlab build status - stable](https://img.shields.io/badge/dynamic/json?color=ff782e&label=Build&query=0.status&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2Fpipelines%3Fref%3Dmaster&logo=gitlab&style=plastic) ![branch release version](https://img.shields.io/badge/dynamic/yaml?color=ff782e&logo=gitlab&style=plastic&label=Release&query=%24.commitizen.version&url=https%3A%2F%2Fgitlab.com%2Fnofusscomputing%2Fprojects%2Fgitlab-ci%2F-%2Fraw%2Fmaster%2F.cz.yaml) [![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%2Fmaster%2Fraw%2Fartifacts%2Fvalidation%2FPyLint%2Fbadge_pylint.json%3Fjob%3DPyLint)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/jobs/artifacts/master/file/artifacts/validation/tests/gl-code-quality-report.html?job=PyLint) + +---- + +**Development Branch** + +![Gitlab build status - development](https://img.shields.io/badge/dynamic/json?color=ff782e&label=Build&query=0.status&url=https%3A%2F%2Fgitlab.com%2Fapi%2Fv4%2Fprojects%2F28543717%2Fpipelines%3Fref%3Ddevelopment&logo=gitlab&style=plastic) ![branch release version](https://img.shields.io/badge/dynamic/yaml?color=ff782e&logo=gitlab&style=plastic&label=Release&query=%24.commitizen.version&url=https%3A%2F%2Fgitlab.com%2Fnofusscomputing%2Fprojects%2Fgitlab-ci%2F-%2Fraw%2Fdevelopment%2F.cz.yaml) [![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) + +---- + +
+ +
+ +links: + +- [Issues](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues) + +- [Merge Requests (Pull Requests)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests) + + +## Using this repository for your Gitlab CI/CD Jobs. + +This repository has been designed as a central point for your repositories CI/CD jobs. By simply linking this repository to your repository and configuring, your CI/CD jobs will run as part of the build process, whilst keeping any CI/CD commits limited within your git history. + +Each CI/CD job is contained within its own sub-folder. Each sub-folder has a readme specific to the job, which includes the details on how to implement, use etc. + +For further details on using these templates with your Gitlab CI/CD jobs, pleaase view the [documentation](https://nofusscomputing.com/projects/gitlab-ci). + + +### gitlab-ci repository layout + +We use the following branches *(these jobs assume you do as well)*: + - `master` - Considered as the stable branch + - `development` considered as unstable + +We also tag each branch to denote the version of release. We use our own repo to do the version increment automagically in line with [semantic versioning](https://semver.org/). + + +## Contributing + +All contributions for this project must conducted from [Gitlab](https://gitlab.com/nofusscomputing/projects/gitlab-ci). + +For further details on contributing please refer to the [contribution guide](CONTRIBUTING.md). + + +## Other + +This repo is release under this [license](LICENSE) + diff --git a/website-template/gitlab-ci/anchors/conditions.yaml b/website-template/gitlab-ci/anchors/conditions.yaml new file mode 100644 index 00000000..824cfb39 --- /dev/null +++ b/website-template/gitlab-ci/anchors/conditions.yaml @@ -0,0 +1,70 @@ +--- + +.condition_dev_branch_push: &condition_dev_branch_push # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + +.condition_master_branch_push: &condition_master_branch_push # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + +.condition_not_master_or_dev_push: &condition_not_master_and_dev_push # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + +.condition_master_or_dev_push: &condition_master_or_dev_push # condition_master_or_dev_push + ( + $CI_COMMIT_BRANCH == "master" || + $CI_COMMIT_BRANCH == "development" + )&& + $CI_PIPELINE_SOURCE == "push" + +.condition_git_tag: &condition_git_tag # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + +.condition_any_branch_push: &condition_any_branch_push # condition_any_branch_push + $CI_COMMIT_BRANCH != null && + $CI_COMMIT_TAG == null && + $CI_PIPELINE_SOURCE == "push" + + + + + + + + +.rules_commit_develop_branch: &when_commit_develop_branch + - if: # on dev branch + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + changes: + paths: + <<: *repository_change_files + compare_to: 'master' + exists: + <<: *repository_exists_files + when: always + + - if: # not on master or dev + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + changes: + paths: + <<: *repository_change_files + compare_to: 'development' + exists: + - dockerfile + - dockerfile.j2 + when: always + + - if: # tagged pipeline + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - dockerfile + - dockerfile.j2 + when: on_success diff --git a/website-template/gitlab-ci/ansible/collection/.gitlab-ci.yml b/website-template/gitlab-ci/ansible/collection/.gitlab-ci.yml new file mode 100644 index 00000000..510792f2 --- /dev/null +++ b/website-template/gitlab-ci/ansible/collection/.gitlab-ci.yml @@ -0,0 +1,662 @@ +--- + +variables: + ANSIBLE_GALAXY_UPLOAD_TOKEN: "" # Mandatory, String. The token to upload to ansible galaxy. DONT SET HERE, USE PIPELINE VARIABLES. + ANSIBLE_GALAXY_SERVER_URL: https://galaxy.ansible.com # Optional, default=(as displayed)String. URL to the Galaxy server for uploads + ANSIBLE_GALAXY_NAMESPACE: "" # Mandatory, String. The ansible galaxy upload namespace + ANSIBLE_GALAXY_PACKAGE_NAME: "" # Mandatory, String. The Ansible Galaxy package name + + +.ansible_collection_merge: + stage: chores + image: python:3.11-bookworm + before_script: + - | # Create artifact directory + mkdir -p artifacts + + - | # Install Pre-req packages + apt update; + + apt install -y --no-install-recommends \ + curl \ + git; + + # ToDo: Install python deps + - | + pip install \ + commitizen==3.14.1 + + - | # setup git user + git config --global user.email "helpdesk@nofusscomputing.com"; + git config --global user.name "nfc_bot"; + + - | # Update origin using gitlab token + echo "Current git origin"; + + git remote -v; + + git remote remove origin; + + echo "Removed origin"; + + git remote add origin https://gitlab-ci-token:$GIT_COMMIT_TOKEN@gitlab.com/$CI_PROJECT_PATH.git; + + echo "Add origin with auth"; + + git remote -v; + + - | # fetch repo details + git fetch -fpv; + + - | # switch to dev branch + git switch development; + + - | # pull dev branch + git pull origin development --rebase + + - | # Init git sub-modules + git submodule update --init + + + script: + + + - | # Store old version number + export OLD_VERSION=$(cz version --project); + echo "Trace - OLD_VERSION[$OLD_VERSION]" + + # rc codes https://commitizen-tools.github.io/commitizen/exit_codes/ + - | # Bump the version + + if [ "0${VERSION_BUMP_INCREMENT}" != '0' ]; then + + export BUMP_INCREMENT="--increment ${VERSION_BUMP_INCREMENT}"; + + fi; + + if [ $CI_COMMIT_BRANCH == "development" ]; then + + cz bump \ + --files-only \ + --yes \ + ${BUMP_INCREMENT} \ + --prerelease alpha \ + + + export VERSION_BUMPED=$? + + elif [ $CI_COMMIT_BRANCH == "master" ]; then + + cz bump \ + --files-only \ + ${BUMP_INCREMENT} \ + --yes + + export VERSION_BUMPED=$? + + else + + echo "Something went wrong with creating the release"; + exit 1; + + fi; + + echo "Trace - VERSION_BUMPED[$VERSION_BUMPED]" + + - | # Store new version number + if [ "0$VERSION_BUMPED" == "00" ]; then + + export NEW_VERSION=$(cz version --project) + + echo "Trace - NEW_VERSION[$NEW_VERSION]" + + fi; + + - | # git stage .cz.yaml + if [ "0$VERSION_BUMPED" == "00" ]; then + + git add .cz.yaml; + + echo "git staged .cz.yaml"; + + git status; + + fi; + + - | # Update version in galaxy file + if [ "0$VERSION_BUMPED" == "00" ]; then + + sed -E "s/version: (.+)/version: ${NEW_VERSION}/g" -i galaxy.yml + + fi; + + - | # git stage galaxy.yml + if [ "0$VERSION_BUMPED" == "00" ]; then + + git add galaxy.yml + + echo "git staged galaxy.yml"; + + git status; + + fi; + + - | # changelog since last version - for development branch + echo "changelog since last version - for development branch"; + + if [ "0$VERSION_BUMPED" == "00" ]; then + + cz changelog --incremental --dry-run --unreleased-version "${NEW_VERSION}" > artifacts/incremental_changelog.txt + + ls -lR artifacts/ + + fi; + + - | # store incremental changelog since last version + echo "store incremental changelog since last version"; + + if [ "0$VERSION_BUMPED" == "00" ]; then + + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/incremental_changelog.txt \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/incremental_changelog.txt" + + fi; + + - | # complete changelog since last normal release - for master branch + echo "complete changelog since last normal release - for master branch"; + + if [ "0$VERSION_BUMPED" == "00" ]; then + + cz changelog --merge-prerelease --dry-run --unreleased-version "${NEW_VERSION}" > artifacts/full_changelog.txt + + fi; + + - | # store full changelog (merge-prerelease) + if [ "0$VERSION_BUMPED" == "00" ]; then + + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/full_changelog.txt \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/full_changelog.txt" + + fi; + + - | # Update CHANGELOG.md + if [ "0$VERSION_BUMPED" == "00" ]; then + + if [ $CI_COMMIT_BRANCH == "development" ]; then + + cz changelog --incremental --unreleased-version "${NEW_VERSION}"; + + elif [ $CI_COMMIT_BRANCH == "master" ]; then + + cz changelog --merge-prerelease --unreleased-version "${NEW_VERSION}"; + + else + + echo "This job should only run on 'development' and 'master' branches"; + exit 1; + + fi; + + fi; + + - | # Create release notes + if [ "0$VERSION_BUMPED" == "00" ]; then + + if [ $CI_COMMIT_BRANCH == "development" ]; then + + cp artifacts/incremental_changelog.txt artifacts/release_notes.md + + elif [ $CI_COMMIT_BRANCH == "master" ]; then + + cp artifacts/full_changelog.txt artifacts/release_notes.md + + else + + echo "This job should only run on 'development' and 'master' branches"; + exit 1; + + fi; + + fi; + + - | # Store Release notes + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/release_notes.md \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/release_notes.md"; + + - | # git stage CHANGELOG.md + if [ "0$VERSION_BUMPED" == "00" ]; then + + git add CHANGELOG.md; + + echo "git staged CHANGELOG.md"; + + git status; + + fi; + + - | # Custom commands from RELEASE_ADDITIONAL_ACTIONS_BUMP + if [ -f ${RELEASE_ADDITIONAL_ACTIONS_BUMP} ]; then + + echo "Custom commands found in variable RELEASE_ADDITIONAL_ACTIONS_BUMP"; + + chmod +x ${RELEASE_ADDITIONAL_ACTIONS_BUMP}; + + echo '------------------------------ TRACE SoF ------------------------------'; + + echo "File: RELEASE_ADDITIONAL_ACTIONS_BUMP[${RELEASE_ADDITIONAL_ACTIONS_BUMP}]"; + + echo '------ contents ------'; + + echo ""; + + cat ${RELEASE_ADDITIONAL_ACTIONS_BUMP}; + + echo ""; + + echo '------ contents ------'; + + echo ""; + + ${RELEASE_ADDITIONAL_ACTIONS_BUMP}; + + echo ""; + + echo "git reset edited file: ${RELEASE_ADDITIONAL_ACTIONS_BUMP}"; + + git restore ${RELEASE_ADDITIONAL_ACTIONS_BUMP}; + + git status + + echo '------------------------------ TRACE EoF ------------------------------' + fi; + + # - | # Find merge request ID + # echo "Trace CI_OPEN_MERGE_REQUESTS[${CI_OPEN_MERGE_REQUESTS}]"; + + # if grep -q "," <<< "$CI_OPEN_MERGE_REQUESTS"; then + + # export MERGE_REQUEST_FOUND=$(echo "${CI_OPEN_MERGE_REQUESTS}" | cut -d "," -f 1 | cut -d '!' -f 2); + + # else + + # export MERGE_REQUEST_FOUND=$(echo "${CI_OPEN_MERGE_REQUESTS}" | cut -d '!' -f 2); + + # fi + + # echo "Trace MERGE_REQUEST_FOUND[${MERGE_REQUEST_FOUND}]"; + + # if [ "$CI_MERGE_REQUEST_IID" ]; then + + # export MERGE_REQUEST_FOUND=${CI_MERGE_REQUEST_IID} + + # echo "Using CI_MERGE_REQUEST_IID[${CI_MERGE_REQUEST_IID}] as value for MERGE_REQUEST_FOUND"; + + # fi + + - | # Find merge request ID + echo "Trace CI_OPEN_MERGE_REQUESTS[${CI_OPEN_MERGE_REQUESTS}]"; + + echo "Trace CI_MERGE_REQUEST_IID[${CI_MERGE_REQUEST_IID}]"; + + export MERGE_REQUEST_FOUND=$(git log -1 | grep -E '\!(.+)' | cut -d '!' -f 2); + + echo "Trace MERGE_REQUEST_FOUND[${MERGE_REQUEST_FOUND}]"; + + - | # commit any changes + if [ "0$VERSION_BUMPED" == "00" ]; then + + git status; + + echo "commit changes to repo" + + cat < ${NEW_VERSION} + + !${MERGE_REQUEST_FOUND} + EOF + + fi; + + - | # Store the changes commit for the tag + export CHANGE_COMMIT=$(git log -n1 --format=format:"%H") + + echo "Trace - CHANGE_COMMIT[$CHANGE_COMMIT]" + + if [ "${CI_COMMIT_SHA}" == "${CHANGE_COMMIT}" ]; then + + echo "No changes appear to have been commited!" + + exit 1; + + fi; + + git log -3; + + + - | # create git tag, if changed + if [ "0$VERSION_BUMPED" == "00" ]; then + + git tag -m "$(cat artifacts/incremental_changelog.txt)" ${NEW_VERSION} ${CHANGE_COMMIT}; + + fi; + + - | # push development to origin + if [ "0$VERSION_BUMPED" == "00" ]; then + + git push --set-upstream origin development + + fi; + + - | # merge bump changes to master + if [ "0$VERSION_BUMPED" == "00" ]; then + + if [ $CI_COMMIT_BRANCH == "master" ]; then + + echo "Trace Checkout master branch"; + git checkout master; + + echo "Trace merge changes from development branch"; + git merge --no-ff development; + + echo "Trace push changes to origin"; + git push origin master; + + fi; + + fi; + + - | # store metadata for use in later stages + if [ "0$VERSION_BUMPED" == "00" ]; then + + cat < artifacts/metadata.env + + export CHANGE_COMMIT=${CHANGE_COMMIT} + + export MERGE_REQUEST_FOUND=${MERGE_REQUEST_FOUND} + + export NEW_VERSION=${NEW_VERSION} + + export OLD_VERSION=${CURRENT_VERSION} + + export VERSION_BUMPED=${VERSION_BUMPED} + + EOF + + chmod +x artifacts/metadata.env; + + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/metadata.env \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/metadata.env"; + + fi; + + - | # Create Version Label + if [ "$CREATE_VERSION_LABEL" != "false" ]; then + + curl \ + --data "name=v${NEW_VERSION}&color=#eee600&description=Version%20that%20is%20affected" \ + --header "PRIVATE-TOKEN: $GIT_COMMIT_TOKEN" \ + "https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/labels" + + fi; + + - | # push git tag to origin + if [ "0$VERSION_BUMPED" == "00" ]; then + + git push --tags + + fi; + + artifacts: + untracked: false + when: always + expire_in: "3 days" + paths: + - "artifacts/*" + rules: + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "development" + && + $CI_PIPELINE_SOURCE == "push" + allow_failure: true + when: manual + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "master" + && + ( + $CI_PIPELINE_SOURCE == "push" + || + $CI_PIPELINE_SOURCE == "web" + ) + when: always + + - when: never + + +# Feature Branch / git tag +.ansible_collection_build: + stage: build + image: python:3.11-bookworm + before_script: + - | # Exit if mandatory variables not defined. On the first job in the pipeline for release. + if [ "$CI_COMMIT_TAG" ]; then + + if [ "0$ANSIBLE_GALAXY_UPLOAD_TOKEN" == "0" ]; then + + echo variable ANSIBLE_GALAXY_UPLOAD_TOKEN must be set; + exit 1; + + fi; + + if [ "0$ANSIBLE_GALAXY_NAMESPACE" == "0" ]; then + + echo variable ANSIBLE_GALAXY_NAMESPACE must be set; + exit 1; + + fi; + + if [ "0$ANSIBLE_GALAXY_PACKAGE_NAME" == "0" ]; then + + echo variable ANSIBLE_GALAXY_PACKAGE_NAME must be set; + exit 1; + + fi; + + fi + + - | # Install python deps + pip install \ + ansible==9.2.0 + + - | # Setup git to be on the tagged commit + if [ "${CI_COMMIT_TAG}" ]; then + + echo "setting up git to be on revision ${CI_COMMIT_TAG}"; + + git log -2; + + git fetch -fpvt; + + git pull origin development --rebase; + + git checkout tags/${CI_COMMIT_TAG} -b development; + + git log -2; + + fi; + + script: + + - | # Build the collection + ansible-galaxy collection build . --verbose --force --output-path artifacts/galaxy/ + + artifacts: + untracked: false + when: on_success + expire_in: "3 days" + paths: + - "artifacts/*" + rules: + + - if: $CI_COMMIT_TAG + when: on_success + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "development" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - if: + $CI_COMMIT_BRANCH != "development" + && + $CI_COMMIT_BRANCH != "master" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + + - when: never + + +# store built package in generic package registry +.ansible_collection_stage_package: + stage: prepare + image: curlimages/curl:latest + variables: + GIT_STRATEGY: none + environment: + name: Gitlab Package Registry + url: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/ + script: + - | # Store collection + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + --upload-file artifacts/galaxy/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz \ + "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz" + + - | # Fetch Release Notes + mkdir -p artifacts; + + curl \ + --header "JOB-TOKEN: $CI_JOB_TOKEN" \ + -o artifacts/release_notes.md \ + ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/release_notes.md + + echo "Release notes fetched"; + + ls -lR artifacts/ + + artifacts: + untracked: false + when: on_success + expire_in: "3 days" + paths: + - "artifacts/*" + rules: + + - if: $CI_COMMIT_TAG + when: on_success + + - when: never + + +# Only on git tag +.ansible_collection_release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + variables: + GIT_STRATEGY: none + script: + + - ls -lR artifacts/ + + release: + tag_name: $CI_COMMIT_TAG + description: ./artifacts/release_notes.md + name: $CI_COMMIT_TAG + assets: + links: + - name: 'Ansible Galaxy' + url: https://galaxy.ansible.com/ui/repo/published/${ANSIBLE_GALAXY_NAMESPACE}/${ANSIBLE_GALAXY_PACKAGE_NAME}/?version=${CI_COMMIT_TAG} + + - name: ${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz + url: https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz + link_type: package + + - name: 'Docker Image: ${DOCKER_IMAGE_PUBLISH_REGISTRY}/${DOCKER_IMAGE_PUBLISH_NAME}:${CI_COMMIT_TAG}' + url: ${DOCKER_IMAGE_PUBLISH_URL} + link_type: package + + - name: Documentation + url: https://nofusscomputing.com/${PAGES_ENVIRONMENT_PATH} + milestones: + - $CI_MERGE_REQUEST_MILESTONE + rules: + + - if: $CI_COMMIT_TAG + when: on_success + + - when: never + + +# Only on git tag +.ansible_collection_publish_galaxy: + stage: publish + image: python:3.11-bookworm + variables: + GIT_STRATEGY: none + ANSIBLE_GALAXY_SERVER_URL: https://galaxy.ansible.com + environment: + name: Ansible Galaxy + url: https://galaxy.ansible.com/ui/repo/published/${ANSIBLE_GALAXY_NAMESPACE}/${ANSIBLE_GALAXY_PACKAGE_NAME}/ + before_script: + + - | # Install python deps + pip install \ + ansible + + pip list; + + - | # Prepare filename for package + # mkdir -p artifacts/galaxy; + + # mv collection.tar.gz artifacts/galaxy/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz + + # echo "Prepare filename to be in the correct format"; + + ls -lR artifacts; + + script: + - | # Publish package to Ansible Galaxy + ansible-galaxy collection publish \ + --server ${ANSIBLE_GALAXY_SERVER_URL} \ + --token ${ANSIBLE_GALAXY_UPLOAD_TOKEN} \ + --verbose artifacts/galaxy/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz + artifacts: + untracked: false + when: on_success + expire_in: "3 days" + paths: + - "artifacts/*" + rules: + + - if: $CI_COMMIT_TAG + when: on_success + + - when: never \ No newline at end of file diff --git a/website-template/gitlab-ci/ansible/collection/ci-test.gitlab-ci.yml b/website-template/gitlab-ci/ansible/collection/ci-test.gitlab-ci.yml new file mode 100644 index 00000000..aa2e8599 --- /dev/null +++ b/website-template/gitlab-ci/ansible/collection/ci-test.gitlab-ci.yml @@ -0,0 +1,63 @@ +# Ansible Collection Unit Test: # what would the unit tests be?? + +# stage: test +# before_script: + +# - echo. #install deps + +# script: + +# - echo. # what???? + + +Ansible Collection Functional Test: + + stage: test + + # ToDo: refactor lint jobs to be individual so that pipeline linking can occur + # needs: + # - Ansible Collection CI Lint + + parallel: + matrix: + - NFC_CI_FUNCTIONAL_TEST: "push" + NFC_CI_FUNCTIONAL_TEST_BRANCH: feature + - NFC_CI_FUNCTIONAL_TEST: "merge" + NFC_CI_FUNCTIONAL_TEST_BRANCH: development + - NFC_CI_FUNCTIONAL_TEST: "release" + NFC_CI_FUNCTIONAL_TEST_BRANCH: development + - NFC_CI_FUNCTIONAL_TEST: "push" + NFC_CI_FUNCTIONAL_TEST_BRANCH: development + - NFC_CI_FUNCTIONAL_TEST: "merge" + NFC_CI_FUNCTIONAL_TEST_BRANCH: master + + script: + + - echo "to be created"; + + # ToDo: run ansible playbook to setup, run and wait for each stage + + # ToDo: create build artifact for use with creating a badge for tests, per branch + + artifacts: + untracked: true + when: on_success + expire_in: "90 days" + resource_group: ansible_collection_functional_test + rules: + # turn off until created + - when: never + + - if: # development/feature branch + $CI_COMMIT_BRANCH != "master" && + $CI_PIPELINE_SOURCE == "push" + changes: + paths: + - 'ansible/collection/*.yml' + compare_to: 'development' + when: always + + - if: # master branch + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + when: always diff --git a/website-template/gitlab-ci/automation/.gitlab-ci-ansible.yaml b/website-template/gitlab-ci/automation/.gitlab-ci-ansible.yaml new file mode 100644 index 00000000..0a0100ca --- /dev/null +++ b/website-template/gitlab-ci/automation/.gitlab-ci-ansible.yaml @@ -0,0 +1,174 @@ +--- +# This yaml is intended to run ansible jobs using nfc's ansible-ee image + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + + +.ansible_playbook: + image: + name: nofusscomputing/ansible-ee:dev + pull_policy: always + stage: chores + variables: + ansible_inventory: '' + ansible_playbook: '' + ansible_tags: '' + ANSIBLE_FORCE_COLOR: 'true' + script: + - if [ "0$ansible_inventory" != '0' ]; then ansible_inventory=-i $ansible_inventory; fi + - if [ "0$ansible_tags" != '0' ]; then ansible_tags=$(echo -n "--tags $ansible_tags"); fi + - echo "[DEBUG] ansible_inventory=$ansible_inventory" + - echo "[DEBUG] ansible_playbook=$ansible_playbook" + - echo "[DEBUG] ansible_tags=$ansible_tags" + - ansible-playbook $ansible_inventory $ANSIBLE_PLAYBOOK_DIR/$ansible_playbook $ansible_tags -vvv + rules: + # ToDo: at some stage redefine these rules so that the job can run if specified. + # - if: '$NFC_AUTO_JOBS == "false"' + # when: never + + # - if: '$CI_PIPELINE_SOURCE == "schedule" && $PIPELINE_RUN_SCHEDULE == "true"' + # exists: + # - ".nfc_automation.yaml" + # when: always + + # - if: + # ( + # $CI_PIPELINE_SOURCE == "api" + # || + # $CI_PIPELINE_SOURCE == "pipeline" + # || + # $CI_PIPELINE_SOURCE == "trigger" + # || + # $CI_PIPELINE_SOURCE == "parent_pipeline" + # ) && + # $PIPELINE_RUN_TRIGGER == "true" + # exists: + # - ".nfc_automation.yaml" + # when: always + + + # - if: # condition_dev_branch_push + # $CI_COMMIT_BRANCH == "development" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - ".nfc_automation.yaml" + # when: always + + # # this if for testing only + # # - if: '$CI_PIPELINE_SOURCE == "push"' + # # when: always + # # exists: + # # - ".nfc_automation.yaml" + - when: never + + +.ansible_playbook_git_submodule: + extends: .ansible_playbook + variables: + ansible_playbook: 'git_configuration.yaml' + ansible_tags: 'submodule' + rules: + - if: '$NFC_AUTO_JOBS == "false"' + when: never + + - if: '$CI_PIPELINE_SOURCE == "schedule" && $PIPELINE_RUN_SCHEDULE == "true"' + exists: + - ".nfc_automation.yaml" + when: always + + - if: + ( + $CI_PIPELINE_SOURCE == "api" + || + $CI_PIPELINE_SOURCE == "pipeline" + || + $CI_PIPELINE_SOURCE == "trigger" + || + $CI_PIPELINE_SOURCE == "parent_pipeline" + ) && + $PIPELINE_RUN_TRIGGER == "true" + exists: + - ".nfc_automation.yaml" + when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_TAG == null && + $CI_COMMIT_BRANCH == "development" && + $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && + $CI_PIPELINE_SOURCE != "push" + exists: + - ".nfc_automation.yaml" + when: always + + # this if for testing only + # - if: '$CI_PIPELINE_SOURCE == "push"' + # when: always + # exists: + # - ".nfc_automation.yaml" + - when: never + + +.submodule_update_trigger: + stage: publish + # trigger: + # project: $SUBMODULE_UPDATE_TRIGGER_PROJECT + # branch: development + # inherit: + # variables: false + script: + # use script to trigger pipeline instead of trigger keyword. + # this is due to trigger keyword not allowing environment keyword. + - export TRIGGER_PROJECT_PATH=$(python3 -c "import urllib.parse, sys; print('$SUBMODULE_UPDATE_TRIGGER_PROJECT'.replace('/', '%2F'))") + - echo "[DEBUG] TRIGGER_PROJECT_PATH=$TRIGGER_PROJECT_PATH" + - | + curl \ + --request POST \ + --form "token=$CI_JOB_TOKEN" \ + --form ref=development \ + --form "variables[GIT_CONFIG_SUBMODULE_NAME]=$GIT_CONFIG_SUBMODULE_NAME" \ + --form "variables[PIPELINE_RUN_TRIGGER]=$PIPELINE_RUN_TRIGGER" \ + --form "variables[GIT_COMMIT_TYPE]=$GIT_COMMIT_TYPE" \ + --form "variables[GIT_COMMIT_TYPE_CATEGORY]=$GIT_COMMIT_TYPE_CATEGORY" \ + "https://gitlab.com/api/v4/projects/$TRIGGER_PROJECT_PATH/trigger/pipeline" + environment: + name: $SUBMODULE_UPDATE_TRIGGER_PROJECT + url: https://gitlab.com/$SUBMODULE_UPDATE_TRIGGER_PROJECT + variables: + PIPELINE_RUN_TRIGGER: 'true' + GIT_CONFIG_SUBMODULE_NAME: $CI_PROJECT_NAME + rules: + - if: # condition_master_or_dev_push + ( + $CI_COMMIT_BRANCH == "master" || + $CI_COMMIT_BRANCH == "development" + ) && + $CI_PIPELINE_SOURCE == "push" && + $CI_COMMIT_TAG == null + when: on_success + + - when: never + + +.ansible_playbook_mr_from_issue_comment_patch: + extends: .ansible_playbook + variables: + ansible_playbook: 'git_configuration.yaml' + ansible_tags: 'gitlab_issue_patches' + PIPELINE_RUN_TRIGGER: 'false' + PIPELINE_RUN_SCHEDULE: 'false' + needs: [] + rules: + - if: '$NFC_AUTO_JOBS == "false"' + when: never + - if: + $CI_COMMIT_TAG == null && + $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" && + $CI_PIPELINE_SOURCE != "push" && + $CI_COMMIT_BRANCH != 'master' && + $CI_COMMIT_BRANCH != 'automated-tasks' && + $CI_COMMIT_BRANCH == 'development' + exists: + - ".nfc_automation.yaml" + when: always + - when: never diff --git a/website-template/gitlab-ci/automation/CHANGELOG.md b/website-template/gitlab-ci/automation/CHANGELOG.md new file mode 100644 index 00000000..57b5de2c --- /dev/null +++ b/website-template/gitlab-ci/automation/CHANGELOG.md @@ -0,0 +1,5 @@ +# Changelog + +2023-05-27 15:20:40 +0930 [f9af921](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f9af921e6b6ec10f9f77ec6a016c6cbb9559d1bf) - refactor(ansible_playbook): final logic adjustment for job +2023-05-27 14:04:10 +0930 [1f6ee9e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1f6ee9ea27824df1c82bf85e1e239f57f2145bdf) - refactor(automation): final logic changes +2023-05-26 16:29:23 +0930 [0d3eaa6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0d3eaa6ac2dc448505b18c6aecd4a72e28ffde83) - feat(automation): job to run ansible playbooks diff --git a/website-template/gitlab-ci/conventional_commits/.gitlab-ci.yml b/website-template/gitlab-ci/conventional_commits/.gitlab-ci.yml new file mode 100644 index 00000000..77fd2dc4 --- /dev/null +++ b/website-template/gitlab-ci/conventional_commits/.gitlab-ci.yml @@ -0,0 +1,78 @@ + +.conventional_commit: + variables: + DEFAULT_ROOT_DIR: './gitlab-ci' + image: python:3.6-slim + stage: validation + before_script: + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - if [ "0$MR_ACCESS_TOKEN" == "0" ]; then MR_ACCESS_TOKEN=$CI_JOB_TOKEN; fi + - echo "[DEBUG] MR_ACCESS_TOKEN[$MR_ACCESS_TOKEN]" + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - if [ "0$MY_PROJECT_ID" == "0" ]; then PROJECT_ID=$CI_PROJECT_ID; else PROJECT_ID=$MY_PROJECT_ID ; fi + - echo "[DEBUG] PROJECT_ID[$PROJECT_ID]" + - export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'` + - apt update + - apt install --no-install-recommends -y git + - python3 -m venv env + - . env/bin/activate + - pip install --upgrade pip + - pip install -r $ROOT_DIR/conventional_commits/requirements.txt + - echo "[DEBUG] CI_PROJECT_ID[$CI_PROJECT_ID]" + - echo "[DEBUG] CI_COMMIT_BRANCH[$CI_COMMIT_BRANCH]" + - git fetch --all + - git checkout --track origin/$CI_COMMIT_BRANCH + - git show-branch -a + - target_branch=$(git show-branch -a | awk 'BEGIN { FS="\n\s+*" } { print $1 }' | awk '{print $2}' | grep '\[' | sed 's/.*\[origin\/\(.*\)\].*/\1/' | grep -v '\[' | grep -v $(git rev-parse --abbrev-ref HEAD) | grep -vi 'HEAD' | awk 'BEGIN{ RS = "" ; FS = "\n" }{print $1}') + - echo "[DEBUG] Target Branch[$target_branch]" + - if [ -d "gitlab-ci" ]; then ls -la gitlab-ci; fi + - first_sha1=$(git log origin/$target_branch..$CI_COMMIT_BRANCH --format=format:%H | tail -1) + - echo "[DEBUG] First Commit SHA[$first_sha1]" + - echo "[DEBUG] artifacts directory [$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME]" + after_script: + - ls -lR "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE" + - cd .. + - rm -Rf check + artifacts: + expire_in: 3 days + when: always + paths: + - "$CI_PROJECT_DIR/artifacts/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml" + rules: + - if: '$JOB_STOP_CONVENTIONAL_COMMITS' + when: never + + - if: # condition_any_branch_push + $CI_COMMIT_BRANCH != null && + $CI_COMMIT_TAG == null && + $CI_PIPELINE_SOURCE == "push" && + $CI_COMMIT_BRANCH != 'master' + exists: + - .cz.yaml + when: always + + - when: never + + +MR Title: + extends: + - .conventional_commit + script: + - MR_TITLE=$($ROOT_DIR/conventional_commits/scripts/commit.py --token "$MR_ACCESS_TOKEN" --project $PROJECT_ID --title --branch $CI_COMMIT_BRANCH) + - echo "[DEBUG] MR_TITLE[$MR_TITLE]" + - cz_exit=0 && cz check --message "$MR_TITLE" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$? + - . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml" + + +Commit Messages: + extends: + - .conventional_commit + script: + - if [ "$(git log $first_sha1..HEAD --format=format:%H | wc -l)" -eq 0 ]; then echo "[DEBUG] Single Commit"; cz_exit=0 && cz check -m "$(git log HEAD --format=format:%B -1)" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?; fi + - if [ "$(git log $first_sha1..HEAD --format=format:%H | wc -l)" -gt 0 ]; then echo "[DEBUG] Commit range"; cz_exit=0 && cz check --rev-range $first_sha1..HEAD > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?; fi + - . $ROOT_DIR/conventional_commits/scripts/cz_junit.sh > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME-cz.junit.xml" diff --git a/website-template/gitlab-ci/conventional_commits/CHANGELOG.md b/website-template/gitlab-ci/conventional_commits/CHANGELOG.md new file mode 100644 index 00000000..b282b76e --- /dev/null +++ b/website-template/gitlab-ci/conventional_commits/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-21 01:48:53 +0930 [088c9fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/088c9fb04c80961f4de8d2b129955ae8cd0b9529) - feat(conventional_commits): ensure .cz.yaml exists +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2023-05-15 09:32:15 +0930 [93931cb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/93931cb9076e0db238f4e297abe3d8f37bd71b80) - feat(conventional): job not to run when bot pushes change +2023-05-15 09:23:02 +0930 [76db5b1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/76db5b17578d8585ed31e0728dbfb37ea2fae153) - fix(conventional_commits): never run on git tag +2023-05-14 14:10:06 +0930 [02e9e5f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/02e9e5f4f4cc0b93ae92c7ba3a2cfb38305af64c) - refactor(ci): inconsistant tabs +2023-05-14 12:11:42 +0930 [d389d14](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d389d14192e1e483fbd48fa9b5c5bee25db14a20) - fix: validation jobs on all except merge +2023-05-14 09:56:35 +0930 [934a401](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/934a401a9620891b09a5fe9c9b0e50a97b43fa9b) - fix(ci): specify the commitizen version +2023-05-13 15:35:28 +0930 [408e4ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - refactor: move docs as part of restructure +2023-05-13 11:47:21 +0930 [9e7d357](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9e7d357bab2b92704d37ad5621df9fe8d1e31a26) - feat(conventional_commits): ability to disable job with variable +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-16 00:09:42 +0000 [1ef6c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef6c41818c40183f8019ea5cde48b4278e4d694) - build(version): bump version 0.4.0 → 0.5.0 +2022-01-16 09:02:02 +0930 [31517b4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/31517b4bf00c1f177ef925d09b1a6714577f62c5) - ci(MR_Title): save the merge request title as a variable and debug output in job log. +2022-01-16 08:48:24 +0930 [73918f2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/73918f2f5e19440d0e300da3a20712739c316d88) - fix(commit.py): filter merge request search to 'opened' and on current branch. +2022-01-15 03:53:53 +0000 [5c9000a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c9000a74859504ed64bbefa1fd193f80a2b69c2) - build(version): bump version 0.3.1 → 0.4.0 +2022-01-15 13:14:58 +0930 [e5531fc](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e5531fc77b5bdb1ccc0741e388df2d8d25ba6ade) - feat(commit.py): throw an error if no token was supplied. i.e. empty variable. +2022-01-15 13:07:56 +0930 [6b7ad95](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6b7ad95fc0ccccf79ff645bad3f86660f5096a4e) - feat(commit.py): confirm a merge request was found, if not output 'ci: No Merge Request found' +2022-01-15 13:05:30 +0930 [c543c47](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c543c47af8c7c386ae57f5a7a50904d396758c3a) - feat(commit.py): try to us `CI_JOB_TOKEN` before the specified token, if any. +2022-01-15 12:29:23 +0930 [99bdc2a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/99bdc2a0929d4e7036e50e8ce22ce9b0f90f0736) - fix(commit.py): fix typo that caused exception +2022-01-15 12:23:54 +0930 [d03d9fe](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d03d9fefc916dd6730d9ffa778c11d48d621318e) - fix(conventional_commits): fetch all branches prior to check for parent branch +2022-01-15 12:18:15 +0930 [b01550e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b01550e09f273edc8a57f4ad4b41ee2d67705d41) - feat(commit.py): removed ability to fetch first commit or target branch +2022-01-15 12:04:07 +0930 [42ad02e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/42ad02ee5db65c3c6c33ad14fe0371c9916897bf) - fix(conventional_commits): use git show-branch to find origin branch +2022-01-11 07:03:09 +0000 [7751fd9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7751fd9494f610fff0ea16bd303bfe62d0034eec) - build(version): bump version 0.3.0 → 0.3.1 +2021-08-12 03:32:36 +0000 [389bc08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/389bc08d7686153fb374aa83d440c35c9b4eac90) - build(version): bump version 0.3.0rc1 → 0.3.0 +2021-08-12 12:47:23 +0930 [3360a15](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3360a15fde12682edfd9044d2541dc819615b838) - fix(commit_message): fixed commit message check if there is only one commit to the branch +2021-08-11 13:47:34 +0930 [def31ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/def31ef562c0002713401652657d59320548ee85) - style(yaml_lint): fixed yaml lint errors +2021-08-04 03:23:08 +0000 [eb5cc8a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb5cc8a0e2885a9ed16a8d1a81611aec4d5a4d31) - build(version): bump version 0.3.0rc0 → 0.3.0rc1 +2021-08-04 03:13:54 +0000 [09dcb65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/09dcb65b090f59e9f8a6bea5eba4bb98bddbad3d) - build(version): bump version 0.2.1 → 0.3.0rc0 +2021-08-04 02:49:45 +0000 [4453b43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4453b433c8966a334f02af592a6ce8092f2ac9de) - build(version): bump version 0.2.0 → 0.2.1 +2021-08-04 02:24:12 +0000 [856f2e1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/856f2e1770d0bda823996122ee70916dc0fe455b) - build(version): bump version 0.1.0 → 0.2.0 +2021-08-04 01:33:47 +0000 [6d34977](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d349774269bcd7c6e406cfe72c78b99f246df7b) - build(version): bump version 0.0.1 → 0.1.0 +2021-08-03 13:26:05 +0930 [392a200](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/392a200fd469c4161dbab5f2b59031a7a64f20a2) - feat(conventional_commits): Added conventional commit job diff --git a/website-template/gitlab-ci/conventional_commits/requirements.txt b/website-template/gitlab-ci/conventional_commits/requirements.txt new file mode 100644 index 00000000..0e5f2a2c --- /dev/null +++ b/website-template/gitlab-ci/conventional_commits/requirements.txt @@ -0,0 +1,3 @@ +python-gitlab +requests +commitizen==2.21.0 diff --git a/website-template/gitlab-ci/conventional_commits/scripts/commit.py b/website-template/gitlab-ci/conventional_commits/scripts/commit.py new file mode 100755 index 00000000..1bc1f571 --- /dev/null +++ b/website-template/gitlab-ci/conventional_commits/scripts/commit.py @@ -0,0 +1,100 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- + + +#import gitlab +import os +import sys +import getopt +import json +import requests + +get_mr_title = False +project_id = '' + +try: + opts, args = getopt.getopt(sys.argv[1:],"hi:t:ti:p:b",["token=", "title", "project=", "branch="]) + +except getopt.GetoptError: + print('test.py [-c | --commit] [-t | --token {token}]') + sys.exit(2) + +for opt, arg in opts: + + #print('[DEBUG] {0} {1}'.format(opt, arg)) + if opt == '-h': + print('[commit.py] -i -o ') + sys.exit() + elif opt in ("-t", "--token"): + if arg is None: + raise ValueError('Token switch was specified, however no token was supplied.') + ci_job_token = arg + elif opt in ("-ti", "--title"): + get_mr_title = True + elif opt in ("-p", "--project"): + project_id = str(arg) + elif opt in ("-b", "--branch"): + git_branch = arg + + +# private token or personal token authentication +#gl = gitlab.Gitlab('https://gitlab.com', private_token=ci_job_token) + + +url = 'https://gitlab.com/api/v4/projects/' + project_id + '/merge_requests?state=opened&source_branch=' + git_branch + +merge_requests = "" + +try: + + if os.environ['CI_JOB_TOKEN'] is not None: + + headers = {'JOB_TOKEN': os.environ['CI_JOB_TOKEN']} + + if os.environ['CI_JOB_TOKEN'] == ci_job_token: + + headers = {'JOB_TOKEN': os.environ['CI_JOB_TOKEN']} + + merge_requests = requests.get(url, headers=headers, data='') + merge_requests = merge_requests.json() + +except: + pass + + +if not isinstance(merge_requests, list): + headers = {'PRIVATE-TOKEN': ci_job_token} + + merge_requests = requests.get(url, headers=headers, data='') + + merge_requests = merge_requests.json() + + +#print('\n\nmerge_requests=[-{0}-][]\n\n\n\n\n'.format(merge_requests)) + + +#project_mrs = project.mergerequests.list() +#mrs = gl.mergerequests.list() + + +mr_title = 'failed to fetch Merge Request title' +mr_first_commit = '' +target_branch = '' + +if isinstance(merge_requests, list): + + if len(merge_requests) > 0: + + for mr in merge_requests: + + if mr['source_branch'] == git_branch and str(mr['target_project_id']) == str(project_id) and str(mr['state']) == 'opened': + mr_title = mr['title'] + + if get_mr_title: + + print('{0}'.format(mr_title)) + + else: + + print('ci: No Merge Request found, MR count "0"') + diff --git a/website-template/gitlab-ci/conventional_commits/scripts/cz_junit.sh b/website-template/gitlab-ci/conventional_commits/scripts/cz_junit.sh new file mode 100755 index 00000000..0465fe2d --- /dev/null +++ b/website-template/gitlab-ci/conventional_commits/scripts/cz_junit.sh @@ -0,0 +1,58 @@ +#!/bin/bash + +# to use ensure cz_exit=0 is set prior to the cz command so that if the command is successfull, this script works +# this script must be run with '. {script-name}' so that vars set in cli are available + +cz_command=$(cat "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log") + + +if [ "f${cz_exit}" == "f" ]; then +echo "[DEBUG] environmental variable cz_exit must be set" +exit 255 +fi + +if [ "${cz_exit}" == "0" ]; then +error_count=0 +system_err='' + +cat < + + +EOF + +else +error_count=1 +system_err="ERROR: $cz_command" + + +cat < + + + + $cz_command + + + + + + + + + + + +EOF + +fi + +#echo boo; + +#echo "output:[$cz_command]" +#echo "[DEBUG] cz_exit[$cz_exit]" + + + + +exit $cz_exit diff --git a/website-template/gitlab-ci/docker/CHANGELOG.md b/website-template/gitlab-ci/docker/CHANGELOG.md new file mode 100644 index 00000000..5e179e61 --- /dev/null +++ b/website-template/gitlab-ci/docker/CHANGELOG.md @@ -0,0 +1,6 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-21 01:47:15 +0930 [f604c6e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f604c6e27d2e7704491f4c78979db40cf89764c0) - fix(docker): ensure qemu binfmt is loaded +2023-05-17 15:41:09 +0930 [a90ccb8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a90ccb81772e295cebe89d7a9c32ab700e19884d) - refactor(docker): move docker jobs to their own file diff --git a/website-template/gitlab-ci/docker/build.gitlab-ci.yaml b/website-template/gitlab-ci/docker/build.gitlab-ci.yaml new file mode 100644 index 00000000..a68123fd --- /dev/null +++ b/website-template/gitlab-ci/docker/build.gitlab-ci.yaml @@ -0,0 +1,133 @@ +--- + +variables: + # 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 + DOCKER_IMAGE_BUILD_REGISTRY: $CI_REGISTRY_IMAGE + DOCKER_IMAGE_BUILD_TAG: $CI_COMMIT_SHA + + # DOCKER_IMAGE_PUBLISH_NAME: $CI_PROJECT_NAME + # DOCKER_IMAGE_PUBLISH_REGISTRY: docker.io/nofusscomputing + # DOCKER_IMAGE_PUBLISH_URL: https://hub.docker.com/r/nofusscomputing/$DOCKER_IMAGE_PUBLISH_NAME + # JOB_STOP_CONVENTIONAL_COMMITS: 'any_value' + # 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' + + +.build_docker_container: + stage: build + image: + name: nofusscomputing/docker-buildx-qemu:dev + pull_policy: always + services: + - name: docker:23-dind + entrypoint: ["env", "-u", "DOCKER_HOST"] + command: ["dockerd-entrypoint.sh"] + variables: + DOCKER_HOST: tcp://docker:2375/ + DOCKER_DRIVER: overlay2 + DOCKER_DOCKERFILE: dockerfile + # See https://github.com/docker-library/docker/pull/166 + DOCKER_TLS_CERTDIR: "" + before_script: + - git submodule foreach git submodule update --init + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - docker info + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + #- pip3 install -r gitlab-ci/gitlab_release/requirements.txt + - pip3 install setuptools wheel + - pip install -r $ROOT_DIR/conventional_commits/requirements.txt + - pip3 install gitlab-ci/gitlab_release/python-module/cz_nfc/. + # see: https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/1861 + # on why this `docker run` is required. without it multiarch support doesnt work. + - docker run --rm --privileged multiarch/qemu-user-static --reset -p yes + - update-binfmts --display + - update-binfmts --enable # Important: Ensures execution of other binary formats is enabled in the kernel + - docker buildx create --driver=docker-container --driver-opt image=moby/buildkit:v0.11.6 --use + - docker buildx inspect --bootstrap + + + # --label org.opencontainers.image.url="$CI_PROJECT_URL/-/releases/$(cz -n cz_nfc version --project)" \ + # --label org.opencontainers.image.version="$(cz -n cz_nfc version --project)" \ + script: + - update-binfmts --display + - | + + if [ "0$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS" != "0" ]; then + + echo "[DEBUG] building multiarch/specified arch image"; + + docker buildx build --platform=$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS . \ + --label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \ + --label org.opencontainers.image.documentation="$CI_PROJECT_URL" \ + --label org.opencontainers.image.source="$CI_PROJECT_URL" \ + --label org.opencontainers.image.revision="$CI_COMMIT_SHA" \ + --push \ + --build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --build-arg CI_PROJECT_ID=$CI_PROJECT_ID --build-arg CI_API_V4_URL=$CI_API_V4_URL \ + --file $DOCKER_DOCKERFILE \ + --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + # during docker multi platform build there are >=3 additional unknown images added to gitlab container registry. cleanup + + DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG" --format "{{ range .Manifest.Manifests }}{{ if ne (print .Platform) \"&{unknown unknown [] }\" }}$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG@{{ println .Digest }}{{end}} {{end}}"); + + docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + else + + echo "[DEBUG] building image"; + + docker build . \ + --label org.opencontainers.image.created="$(date '+%Y-%m-%d %H:%M:%S%:z')" \ + --label org.opencontainers.image.documentation="$CI_PROJECT_URL" \ + --label org.opencontainers.image.source="$CI_PROJECT_URL" \ + --label org.opencontainers.image.url="$CI_PROJECT_URL/-/releases/$(cz -n cz_nfc version --project)" \ + --label org.opencontainers.image.version="$(cz -n cz_nfc version --project)" \ + --label org.opencontainers.image.revision="$CI_COMMIT_SHA" \ + --build-arg CI_JOB_TOKEN=$CI_JOB_TOKEN --build-arg CI_PROJECT_ID=$CI_PROJECT_ID --build-arg CI_API_V4_URL=$CI_API_V4_URL \ + --file $DOCKER_DOCKERFILE \ + --tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + docker push $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + fi + rules: + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{dockerfile,dockerfile.j2}' + when: on_success + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{dockerfile,dockerfile.j2}' + changes: + paths: + - '{dockerfile,dockerfile.j2,includes/**/*}' + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{dockerfile,dockerfile.j2}' + changes: + paths: + - '{dockerfile,dockerfile.j2,includes/**/*}' + compare_to: 'development' + when: always + + - when: never diff --git a/website-template/gitlab-ci/docker/publish.gitlab-ci.yaml b/website-template/gitlab-ci/docker/publish.gitlab-ci.yaml new file mode 100644 index 00000000..d5b1c77e --- /dev/null +++ b/website-template/gitlab-ci/docker/publish.gitlab-ci.yaml @@ -0,0 +1,130 @@ +--- +# variables: +# # 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 +# DOCKER_IMAGE_BUILD_REGISTRY: $CI_REGISTRY_IMAGE +# DOCKER_IMAGE_BUILD_TAG: $CI_COMMIT_SHA + + +.publish-docker-hub: + stage: publish + image: docker:23-dind + services: + - docker:23-dind + before_script: + - | + + docker login $CI_REGISTRY -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD; + + if [ "0$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS" != "0" ]; then + + for i in ${DOCKER_IMAGE_BUILD_TARGET_PLATFORMS//,/ } + do + + docker buildx imagetools inspect $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + #DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG" --format "{{ range .Manifest.Manifests }}{{ if ne (print .Platform) \"&{unknown unknown [] }\" }}$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG@{{ println .Digest }}{{end}} {{end}}") + DOCKER_MULTI_ARCH_IMAGES=$(docker buildx imagetools inspect "$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG" --format "{{ range .Manifest.Manifests }}$DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG@{{ println .Digest }} {{end}}") + + + echo "[DEBUG] DOCKER_MULTI_ARCH_IMAGES=$DOCKER_MULTI_ARCH_IMAGES"; + + done; + + else + + docker pull $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG; + + fi + + #docker logout $CI_REGISTRY; # commented out to test if for private repo remaining logged in works to allow pulling image + + script: + - docker login docker.io -u $NFC_DOCKERHUB_USERNAME -p $NFC_DOCKERHUB_TOKEN + - docker image ls + - | + DOCKER_HUB_TAG=dev + + echo "[DEBUG] default: DOCKER_HUB_TAG=$DOCKER_HUB_TAG"; + + if [ "0$CI_COMMIT_TAG" != "0" ]; then + + DOCKER_HUB_TAG=latest + + echo "[DEBUG] stable: DOCKER_HUB_TAG=$DOCKER_HUB_TAG"; + + if [[ "0$CI_COMMIT_TAG" == *"rc"* ]]; then + + DOCKER_HUB_TAG=dev + + echo "[DEBUG] dev: DOCKER_HUB_TAG=$DOCKER_HUB_TAG"; + + fi + + fi + + echo "[DEBUG] DOCKER_IMAGE_PUBLISH_NAME=$DOCKER_IMAGE_PUBLISH_NAME"; + echo "[DEBUG] final: DOCKER_HUB_TAG=$DOCKER_HUB_TAG"; + + if [ "0$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS" != "0" ]; then + + echo "[DEBUG] DOCKER_MULTI_ARCH_IMAGES=$DOCKER_MULTI_ARCH_IMAGES"; + + docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES --tag $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$DOCKER_HUB_TAG; + + if [ "0$CI_COMMIT_TAG" != "0" ]; then + + docker buildx imagetools create $DOCKER_MULTI_ARCH_IMAGES --tag $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$CI_COMMIT_TAG; + + fi + + else + + docker image tag $DOCKER_IMAGE_BUILD_REGISTRY/$DOCKER_IMAGE_BUILD_NAME:$DOCKER_IMAGE_BUILD_TAG $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$DOCKER_HUB_TAG; + + docker push $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$DOCKER_HUB_TAG; + + if [ "0$CI_COMMIT_TAG" != "0" ]; then + + docker image tag $DOCKER_IMAGE_BUILD_NAME/$DOCKER_IMAGE_BUILD_REGISTRY:$DOCKER_IMAGE_BUILD_TAG $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$CI_COMMIT_TAG; + + docker push $DOCKER_IMAGE_PUBLISH_REGISTRY/$DOCKER_IMAGE_PUBLISH_NAME:$CI_COMMIT_TAG; + + fi + + fi + + - docker logout docker.io + environment: + name: DockerHub + url: $DOCKER_IMAGE_PUBLISH_URL + rules: + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{dockerfile,dockerfile.j2}' + when: on_success + + # - if: # condition_master_branch_push + # $CI_COMMIT_BRANCH == "master" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - '{dockerfile,dockerfile.j2}' + # when: on_success + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{dockerfile,dockerfile.j2}' + changes: + paths: + - '{dockerfile,dockerfile.j2,includes/**/*}' + compare_to: 'master' + allow_failure: true + when: on_success + + - when: never diff --git a/website-template/gitlab-ci/docs/articles/index.md b/website-template/gitlab-ci/docs/articles/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/docs/contact.md b/website-template/gitlab-ci/docs/contact.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/docs/index.md b/website-template/gitlab-ci/docs/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/docs/operations/index.md b/website-template/gitlab-ci/docs/operations/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/ansible/collection.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/ansible/collection.md new file mode 100644 index 00000000..265513db --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/ansible/collection.md @@ -0,0 +1,284 @@ +--- +title: Ansible Collection +description: How to use No Fuss Computings gitlab-ci job for running Ansible Collection CI/CD Pipelines +date: 2024-02-16 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This CI/CD template contains all of the CI jobs required for a pipeline for an Ansible Collection Project. + + +## Requirements + +The following requirements are needed to run these CI/CD jobs. As we use [commitizen](https://commitizen-tools.github.io/commitizen/) for the versioning system, your commits will be required to be in [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/). The configuration for commitizen is within a `.cz.yaml` file which you will need to add to your repository root directory. + + +### Gitlab Features + +| Feature | Setting | Notes | +|:---|:---:|:---| +| Package Registry | On | Storage of pipeline artifacts and the built package. | +| Releases | On | Gitlab releases are created as part of the pipeline. | + + +### Variables + +To be able to upload to Ansible Galaxy, you will be required to provide the jobs, the following Variables That should be set as CI/CD variables (` -> Settings -> CI/CD Settings -> Variables`). + +| Variable | Settings | Notes | +|:---|:---:|:---| +| `ANSIBLE_GALAXY_UPLOAD_TOKEN` | `masked`, `protected` | | +| `VERSION_BUMP_INCREMENT` | `major`, `minor`, `patch` | Used for manual run of the job. After setting the variable, that type of version bump will occur. | + +Within your `.gitlab-ci.yml` file there are varibales to be set, please see below. + + +### .gitlab-ci.yaml Changes + +To include these jobs in your CI/CD Project add our gitlab-ci project as a submodule to your project `git submodule add https://gitlab.com/nofusscomputing/projects/gitlab-ci/`. Then update your projects `.gitlab-ci.yml` file to include the following: + +``` yaml +variables: + ANSIBLE_GALAXY_SERVER_URL: https://galaxy.ansible.com # Optional, default=(as displayed)String. URL to the Galaxy server for uploads + ANSIBLE_GALAXY_NAMESPACE: "" # Mandatory, String. The ansible galaxy upload namespace + ANSIBLE_GALAXY_PACKAGE_NAME: "" # Mandatory, String. The Ansible Galaxy package name + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: # branch, git tag, commit etc + file: + - .gitlab-ci_common.yaml + - template/ansible-collection.gitlab-ci.yaml +``` + + +## CI/CD Jobs + +This template contains the following CI/CD Jobs + +- `Create Release` + +- `Ansible Lint` + +- `Ansible Lint (galaxy.yml)` + +- `Build Collection` + +- `Stage Collection` + +- `Gitlab Release` + +- `Ansible Galaxy` + +for a detail description of each job, please see below. + + +### Create Release + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `manual` + + - **merge to**: `manual` + +- **master branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **git tag**: `never` + +Create a release. It's only triggered on merge to the `development` and `master` branches. The last stage of this job is to create a git tag which matches the version to be released. The creation of the git tag, starts the remainder of the release cycle. On the `development` branch (when the job is triggered as it's a manual job) an `alpha` release is created and on the `master` branch, a full release is created. + + +### Ansible Lint + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `manual` + + - **merge to**: `manual` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `never` + +Lints the yaml files in directories `meta`, `playbooks` and `roles`. This job will not fail the pipeline. There are XUnit test reports created for thyis job so you can see any liniting errors. + + +### Ansible Lint (galaxy.yml) + +Triggered: + +- **Feature branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **development branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Lints the `galaxy.yml` file. This job is designed to fail the pipeline, as an incorrectly formated `galaxy.yml` file can prevent an upload of the collection to Ansible Galaxy. There is a XUnit test report created for thyis job so you can see any liniting errors. + + +### Build Collection + +Triggered: + +- **Feature branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **development branch**: + + - **push**: `always` + + - **merge to**: `always` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Builds the collection. + +### Stage Collection + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Adds the collection to Gitlab Packages Regsitry as a generic package. This location is used to store the package. + + +### Gitlab Release + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Creates a Gitlab release. + + +### Ansible Galaxy + +Triggered: + +- **Feature branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **development branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **master branch**: + + - **push**: `never` + + - **merge to**: `never` + +- **git tag**: `always` + +Uploads the package to Ansible Galaxy. + + +## CI Tests + +Still to be developed + + +## Definition + +``` yaml title="template/ansible-collection.gitlab-ci.yaml" linenums="1" + +--8<-- "template/ansible-collection.gitlab-ci.yaml" + +``` + +---- + +``` yaml title=".gitlab-ci_common.yaml" linenums="1" + +--8<-- ".gitlab-ci_common.yaml" + +``` diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/ansible_playbook.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/ansible_playbook.md new file mode 100644 index 00000000..da2847b3 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/ansible_playbook.md @@ -0,0 +1,171 @@ +--- +title: Ansible Playbook +description: How to use No Fuss Computings gitlab-ci job for running Ansible Playbooks +date: 2023-05-29 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This job enables you to run an Ansible playbook within the Gitlab CI/CD environment. + + +There is also an additional job defined that enables you to specify a project to run an automated update of it's git submodules. This is useful if the project you create the job in, is used as a git submodule in another project. On pushing to the development branch, this job triggers the `Git.Submodules.Update.Chores` job that updates the specified projects git submodules. + + + +## your .gitlab-ci.yml changes + +- **Mandatory** In addition to the previous dependency, this requirement is for the project specified in the trigger job. The following must be added to the `.gitlab-ci.yml` file in that project. + +``` yaml +include: + - project: nofusscomputing/projects/gitlab-ci + ref: master + file: + - .gitlab-ci_common.yaml + - automation/template/automagic.gitlab-ci.yaml +``` + +To use the ansible playbook job add the following to your `.gitlab-ci.yml` file. + +``` yaml + +stages: + - chores + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: master + file: + - automation/.gitlab-ci-ansible.yaml + +Ansible Job: + extends: .ansible_playbook + variables: + ansible_playbook: 'git_configuration.yaml' + ansible_tags: 'submodule' + PIPELINE_RUN_TRIGGER: 'false' + PIPELINE_RUN_SCHEDULE: 'false' + +``` + +To run the trigger job to update another projects git submodules. add the following to your `.gitlab-ci.yml` file + +``` yaml + +stages: + - publish + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: master + file: + - automation/.gitlab-ci-ansible.yaml + +Docker_Mail.Submodule.Deploy: + extends: .submodule_update_trigger + variables: + SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-mail + +``` + +!!! Tip + In addition to the variables below, you can also specify any additional Environment variables for use by Ansible within the container. Refer to the [Ansible configuration documentation](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#common-options) for further details + + +## Job: `.ansible_playbook` + +This job runs an Ansible playbook using the `nofusscomputing/ansible-ee:dev` Docker image. + + +### Stage: Chores + +This job is responsible for executing an Ansible playbook. It can be customized by setting the following variables: + + +#### Variables + +- `ansible_inventory`: The Ansible inventory file. + +- `ansible_playbook`: The name of the Ansible playbook file. + +- `ansible_tags`: The tags to be applied during playbook execution. + + +### Rules + +- Rule 1: If the `NFC_AUTO_JOBS` variable is set to `"false"`, the job will never run. + +- Rule 2: If the pipeline is triggered by a schedule and `PIPELINE_RUN_SCHEDULE` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists. + +- Rule 3: If the pipeline is triggered by an API call, another pipeline, a trigger, or a parent pipeline, and `PIPELINE_RUN_TRIGGER` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists. + +- Rule 4: If the pipeline is triggered by a push to the `development` branch, the job will run only if the `.nfc_automation.yaml` file exists. see [Documentation](../git_configuration/submodule/) for file details. + +- Rule 5: This rule prevents the job from running under any circumstances. + + +## Job: `.ansible_playbook_git_submodule` + +This job extends the `.ansible_playbook` job and is specifically used for running the `git_configuration.yaml` playbook with the `submodule` tags. + + +### Stage: Chores + +This job is responsible for executing the `git_configuration.yaml` playbook with the `submodule` tags. + + +#### Variables + +- `ansible_playbook`: The name of the Ansible playbook file (`git_configuration.yaml`). + +- `ansible_tags`: The tags to be applied during playbook execution (`submodule`). + + +### Rules + +- Rule 1: If the `NFC_AUTO_JOBS` variable is set to `"false"`, the job will never run. + +- Rule 2: If the pipeline is triggered by a schedule and `PIPELINE_RUN_SCHEDULE` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists. + +- Rule 3: If the pipeline is triggered by an API call, another pipeline, a trigger, or a parent pipeline, and `PIPELINE_RUN_TRIGGER` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists. see [Documentation](../git_configuration/submodule/) for file details. + +- Rule 4: If the pipeline is triggered by a push to the `development` branch, the job will run only if the `.nfc_automation.yaml` file exists. + +- Rule 5: This rule prevents the job from running under any circumstances. + + +## Job: `.submodule_update_trigger` + +This job triggers a pipeline in another project. + + +### Stage: Publish + +This job is responsible for triggering a pipeline in another project. + + +#### Variables + +- `PIPELINE_RUN_TRIGGER`: The flag to indicate if the triggered pipeline should run (`true`). + + +### Rules + +- Rule 1: If the pipeline is triggered by a push to the `master` or `development` branch, and there is no associated tag, the job will run on successful completion. + +- Rule 2: This rule prevents the job from running under any other circumstances. + + +## Artifacts + +- None + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "automation/.gitlab-ci-ansible.yaml" + +``` diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/conventional_commits.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/conventional_commits.md new file mode 100644 index 00000000..741e5b34 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/conventional_commits.md @@ -0,0 +1,157 @@ +--- +title: Conventional Commits +description: How to use No Fuss Computings gitlab-ci job for Conventional Commits +date: 2021-08-03 +template: project.html +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. + + +#### fixing commit messages (suggestion) + +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 | +|:-----:| +| *As you have changed the commit SHA1(s), when you next push your changes upstream, you must force push. `git push --force`* | + +| :octagonal_sign: **WARNING** | +|:-----:| +| *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 CI Template - `.conventional_commit` + +This GitLab CI template, named `.conventional_commit`, is designed to validate conventional commits within a GitLab CI/CD pipeline. It follows predefined rules to ensure that commit message conventions are met. + + +### 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}" + +stages: + - validation + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/conventional_commits/.gitlab-ci.yml + +``` + + +### Job Description + +The `.conventional_commit` job performs various tasks related to validating conventional commits. It runs in the `validation` stage of the pipeline and uses the `python:3.6-slim` Docker image. + + +### Variables + +- `DEFAULT_ROOT_DIR`: The default root directory is set as `./gitlab-ci`. + +- `MR_ACCESS_TOKEN`: The access token for the merge request. If not defined, it falls back to `CI_JOB_TOKEN`. + +- `JOB_ROOT_DIR`: The root directory for the job. If not defined, it falls back to `DEFAULT_ROOT_DIR`. + +- `MY_PROJECT_ID`: The custom project ID. If not defined, it falls back to `CI_PROJECT_ID`. + + +### Stages + +- `validation`: The job is assigned to the `validation` stage. + + +### Script + +The script section contains the actions performed during the job execution. These actions include creating directories, setting up variables, preparing the Python environment, and executing commands related to validating conventional commits. + +The complete script can be found in the GitLab CI template file. + + +### Artifacts + +The job generates artifacts that are stored for a period of 3 days. The artifacts include the following paths: + +- `$CI_PROJECT_DIR/artifacts/*` + +- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml` + + +### Rules + +The job follows certain rules to determine when it should be executed: + +- If the variable `$JOB_STOP_CONVENTIONAL_COMMITS` is true, the job will not run. + +- If the branch is pushed and a commit is made, and there is no tag associated with the commit, and the pipeline source is "push", the job will run if `.cz.yaml` file exists. + +- In all other cases, the job will not run. + +This GitLab CI template provides a convenient way to validate conventional commits and enforce commit message conventions within your CI/CD pipelines. + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "conventional_commits/.gitlab-ci.yml" + +``` diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/docker_build.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/docker_build.md new file mode 100644 index 00000000..6e051573 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/docker_build.md @@ -0,0 +1,56 @@ +--- +title: docker build Gitlab CI/CD jobs Template +description: How to use No Fuss Computings gitlab-ci template for auto creation of CI/CD joobs. +date: 2023-06-10 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This documentation provides an overview and explanation of the GitLab CI/CD YAML template. The template defines a job named `.build_docker_container` that builds a Docker container using the specified configuration. + + +### Stage: build + +This job builds a Docker container using the `nofusscomputing/docker-buildx-qemu:dev` image and the `docker:23-dind` service. + + +#### Variables + +- `DOCKER_IMAGE_BUILD_NAME`: The name of the Docker image to be built (`$CI_PROJECT_NAME`). + +- `DOCKER_IMAGE_BUILD_REGISTRY`: The registry where the Docker image will be pushed (`$CI_REGISTRY_IMAGE`). + +- `DOCKER_IMAGE_BUILD_TAG`: The tag to be applied to the Docker image (`$CI_COMMIT_SHA`). + + +#### Rules + +- Rule 1: The job runs if the pipeline is triggered by a git tag and a `dockerfile` or `dockerfile.j2` file exists. + +- Rule 2: The job runs if the pipeline is triggered by a push to the `development` branch and a `dockerfile` or `dockerfile.j2` file exists. It also checks for changes in the `dockerfile`, `dockerfile.j2`, or `includes/` directory compared to the `master` branch. + +- Rule 3: The job runs if the pipeline is triggered by a push to a branch other than `master` or `development` and a `dockerfile` or `dockerfile.j2` file exists. It also checks for changes in the `dockerfile`, `dockerfile.j2`, or `includes/` directory compared to the `development` branch. + +- Rule 4: The job never runs. + + +#### Script + +The script performs the following steps: + +1. Updates the binary formats and enables execution of other binary formats in the kernel. + +2. Creates a Docker buildx builder and sets it as the active builder. + +3. Builds a multi-arch Docker image if the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is specified. It applies labels to the image and pushes it to the specified registry. It also inspects the image and performs cleanup by removing additional unknown images from the container registry. + +4. Builds a Docker image if the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is not specified. It applies labels to the image and pushes it to the specified registry. + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "docker/build.gitlab-ci.yaml" + +``` diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/docker_publish.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/docker_publish.md new file mode 100644 index 00000000..8353b3ac --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/docker_publish.md @@ -0,0 +1,102 @@ +--- +title: docker publish Gitlab CI/CD jobs Template +description: How to use No Fuss Computings gitlab-ci job template to publish a docker image to docker hub. +date: 2023-06-10 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This GitLab CI template is designed to publish Docker images to Docker Hub. It contains a job called "Publish Docker Image to Docker Hub" that handles the image publishing process. + + +## Stage + +- `publish` + + +## Variables + +The following variables are used in the job: + +- `DOCKER_IMAGE_BUILD_NAME`: The name of the Docker image to build. By default, it uses the GitLab CI project name. + +- `DOCKER_IMAGE_BUILD_REGISTRY`: The registry for the Docker image build. By default, it uses the GitLab CI registry image. + +- `DOCKER_IMAGE_BUILD_TAG`: The tag for the Docker image build. By default, it uses the GitLab CI commit SHA. + +- `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS`: A comma-separated list of available platforms for the Docker image build. Supported platforms include: `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`. + +- `CI_REGISTRY_USER`: The username for logging in to the GitLab CI registry. + +- `CI_REGISTRY_PASSWORD`: The password for logging in to the GitLab CI registry. + +- `NFC_DOCKERHUB_USERNAME`: The username for logging in to Docker Hub. + +- `NFC_DOCKERHUB_TOKEN`: The access token or password for logging in to Docker Hub. + +- `DOCKER_IMAGE_PUBLISH_REGISTRY`: The registry for publishing the Docker image to Docker Hub. + +- `DOCKER_IMAGE_PUBLISH_NAME`: The name of the Docker image for publishing to Docker Hub. + +- `DOCKER_IMAGE_PUBLISH_URL`: The URL to access the published Docker image on Docker Hub. + + +## Services + +- `docker:23-dind`: Runs Docker in Docker (DinD) service with version 23. + + +## Script + +The job executes the following steps in the `script` section: + +1. Logs in to the GitLab CI registry using the provided credentials (`CI_REGISTRY_USER` and `CI_REGISTRY_PASSWORD`). + +2. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is specified, it iterates over the platforms and inspects the Docker image using `docker buildx imagetools inspect`. + +3. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is not specified, it pulls the Docker image from the specified registry. + +4. Logs in to Docker Hub using the provided credentials (`NFC_DOCKERHUB_USERNAME` and `NFC_DOCKERHUB_TOKEN`). + +5. Lists the Docker images using `docker image ls`. + +6. Determines the appropriate tag for the Docker image based on the pipeline source and commit tag. + +7. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is specified, it creates multi-arch images using `docker buildx imagetools create` and tags them with the appropriate tag. + +8. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is not specified, it tags the Docker image with the appropriate tag based on the pipeline source and commit tag. + +9. Pushes the Docker image to Docker Hub. + +10. Logs out of Docker Hub. + + +## Environment + +The job sets the following environment variables: + +- **Name**: DockerHub + +- **URL**: The URL to access the published Docker image on Docker Hub. + + +## Rules + +The job is controlled by the following rules: + +- Runs when the pipeline is triggered by a Git tag and there is no associated branch. + +- Runs when the pipeline is triggered by a push to the `master` branch and there is a Dockerfile present. + +- Runs when the pipeline is triggered by a push to the `development` branch, there are changes in the Dockerfile or the `includes/` directory compared to the `master` branch, and it allows failure. + +- Never runs explicitly. + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "docker/build.gitlab-ci.yaml" + +``` diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/git_mirror.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/git_mirror.md new file mode 100644 index 00000000..7c21c654 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/git_mirror.md @@ -0,0 +1,88 @@ +--- +title: Git push mirror +description: How to use No Fuss Computings gitlab-ci job for repository mirrororing +date: 2021-08-03 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This job does a git push to a remote git repo. + + +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: + - sync + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/git_push_mirror/.gitlab-ci.yml + +Github (Push --mirror): + variables: + GIT_SYNC_URL: "https://${username variable}:${pasword variable}@github.com/NoFussComputing/gitlab-ci.git" + extends: + - .git_push_mirror + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| GIT_SYNC_URL | this is the remote git repositories https clone address.
***Note:** if the remote repository requires authentication, you will need to build the url. like above.* | + + +## Job Workflow + +- 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" + extends: + - .git_push_mirror + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + when: never + - if: '$CI_COMMIT_BRANCH == "development"' + when: always + +``` + +This will cause the job to only run on the `development` branch. + + +## Artifacts + +- None + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "git_push_mirror/.gitlab-ci.yml" + +``` + +!!! Note + Docs Still under development diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/gitlab_release.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/gitlab_release.md new file mode 100644 index 00000000..8cfbf9b4 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/gitlab_release.md @@ -0,0 +1,216 @@ +--- +title: Gitlab Release / Commit Footer References +description: How to use No Fuss Computings gitlab-ci job for Gitlab Releases and commit footer messages +date: 2021-08-03 +template: project.html +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*). + + +### fixing 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 | +|:-----:| +| *As you have changed the commit SHA1(s), when you next push your changes upstream, you must force push. `git push --force`* | + +| :octagonal_sign: **WARNING** | +|:-----:| +| *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 CI Template - Developer Manual + + +## Job: gitlab_release + +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. + +!!! Alert + *If prior to merging to the master branch you do a version increment, and there are no commits prior to merging. the job will not increment the version and the job will fail. it is recommended that you only do a version increment on the `development` branch if you are going to commit further changes to the `development` branch* + + +### Stage + +`release` + + +### Image + +The job uses the `registry.gitlab.com/gitlab-org/release-cli:latest` image. + + +### Variables + +The job does not use any additional variables. + + +### Explanation + +The `gitlab_release` job is responsible for creating releases and tags for the GitLab repository. It follows a specific release workflow and utilizes the `release-cli` tool to automate the release process. + + +### Steps + +1. Set ROOT_DIR variable: Sets the `ROOT_DIR` variable based on the value of `JOB_ROOT_DIR`. + +2. Create necessary directories: Creates necessary directories for storing artifacts and tests. + +3. Install dependencies: Updates the package manager and installs Git and Python 3. Sets up the Python environment by installing required packages. + +4. Clone repository: Clones the repository using the provided authentication token and checks out the `development` branch. + +5. Configure Git: Configures Git settings for the release process. + +6. Perform release steps: Executes release-related steps, such as running a custom command (`$MY_COMMAND`), generating the release changelog, and tagging the release. + +7. Push changes: Pushes the changes to the GitLab repository. + +8. Cleanup: Removes the cloned repository. + + +### Rules + +- The job is never triggered when `$JOB_STOP_GITLAB_RELEASE` is true. + +- The job is never triggered when the commit author is `nfc_bot `. + +- If the commit is pushed to the `master` branch, the job is only triggered on successful pipeline execution and failure is not allowed. + +- If the commit is pushed to the `development` branch, the job is triggered manually and failure is allowed. + + +### 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 + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/gitlab_release/.gitlab-ci.yml + +Gitlab Release: + variables: + 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}`. + + +## Job: commit_footer_refs + + +### Stage + +`validation` + + +### Image + +The job uses the `python:3.6-slim` image. + + +### Variables + +- `DEFAULT_ROOT_DIR`: The default root directory path. + + +### Explanation + +The `commit_footer_refs` job validates the commit footer references in the GitLab repository. It checks if the commit messages adhere to the conventional commit format and generates a JUnit XML report. + + +### Conventional Commits + +Conventional commits follow a specific format for commit messages, consisting of a type, optional scope, and a message. The format is as follows: + +``` +(): +``` + +- The `` represents the nature of the changes, such as `feat` for a new feature, `fix` for a bug fix, `docs` for documentation changes, and so on. + +- The `` (optional) provides additional context for the commit, indicating the module, component, or area of code being modified. + +- The `` contains a concise and descriptive summary of the changes. + +The commit footer can contain additional information, such as references to issues, feature requests, or pull requests. + + +### Steps + +1. Create necessary directories: Creates necessary directories for storing artifacts and test results. + +2. Set ROOT_DIR variable: Sets the `ROOT_DIR` variable based on the value of `JOB_ROOT_DIR`. + +3. Install dependencies: Updates the package manager and installs Git and the required Python packages for the commit footer validation. + +4. Clone repository: Clones the repository and checks out the specified branch. + +5. Run commit_footer script: Executes the `commit_footer` script to validate the commit footer references. + +6. Generate artifacts: Generates a JUnit XML report for the test results. + + +### Rules + +- The job is never triggered when `$JOB_STOP_CONVENTIONAL_COMMITS` is true. + +- The job is never triggered when `CHANGELOG_FOOTER_REFERENCES` is false. + +- The job is always triggered when the commit is not pushed to the master or development branch, and a .cz.yaml file is present, indicating the usage of conventional commits. + +- The job is never triggered otherwise. + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "gitlab_release/.gitlab-ci.yml" + +``` diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/index.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/index.md new file mode 100644 index 00000000..726998b8 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/index.md @@ -0,0 +1,111 @@ +--- +title: No Fuss Computings Gitlab-CI Project +description: How to use No Fuss Computings gitlab-ci project within your CI/CD pipelines +date: 2023-05-22 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +!!! Note + Docs Still under development + + +## Docs ToDo + +- Templates folder is for `gitlab-ci.yaml` that automagically create the jobs if included + +- other sub folders are for `` which **DO NOT** automagically create jobs, but are pure definitions only. + +- notate how each of the stages run and under what circumstance. *i.e. gitlab-ci.yml rules.exist/rules.changes* + +## CI Stages + +The CI stages for these jobs are as follows, and in the order expected by the jobs: + +- chores + > automated tasks + +- validation + > validation of files, commits, Merge Request titles, code quality, license checks. + +- build + > build any binaries or files that would be used in the later stages . + +- prepare + > any jobs that must run after build but before testing. for example a docker image build that includes artifacts from the build job + +- test + > unit, functional, integration and any other tests. + +- release + > git tagging and creating a gitlab release. Also includes adding build artifacts to gitlab registry. + +- sync + > repository synchronization, i.e. push mirror to github. + +- publish + > placement of build objects to external sources + + +## Git Sub-Module setup + +It is recommended that you set-up this repo as a git sub-module to your repo and that you configure it to a set commit/tag. This ensures that any change to `gitlab-ci` repo, does not effect your CI/CD jobs. + +run the following commands: + +``` bash + +git submodule add -b {ref} https://gitlab.com/nofusscomputing/projects/gitlab-ci.git gitlab-ci +git submodule update --remote + +``` + +!!! Tip + NOTE: `{ref}` should be replaced with the branch name, `master` is the stable branch and recommended. by default the sub-module will be created in folder `gitlab-ci`, it is recommended that you **don't** change this folder name. + + You can also substitute the gitlab url with the github url `https://github.com/NoFussComputing/gitlab-ci.git` for the submodule if you desire. this repo is auto-synced with github on each change to the repo. + +After each `git submodule update --remote` you will have to commit the sub-module update to your repo. Suggested commands as follows: + +``` bash + +git add .gitmodules + +git add gitlab-ci + +git commit -m "ci(gitlab-ci): updated to use version x + +{your reason here or explain what is provided/changed}" + +``` + +Then push the changes to your source. + + +## .gitlab-ci.yaml example + +example: + +``` yaml + +include: + - project: nofusscomputing/projects/gitlab-ci + ref: master + file: + - .gitlab-ci_common.yaml + - $JOB_ROOT_DIR/{filepath to include here and is relative to the gitlab-ci repo root} + +variables: + MY_PROJECT_ID: "{your_project_id}" + +``` + +!!! Tip + Use a project import in your `.gitlab-ci.yml` file that is tied to a specific `ref`. for example a branch, commit or tag. Also ensure that the `gitlab-ci` `git sub-module` and the `ref` as part of the includes matches.* + + +## Artifacts + +Any artifacts by jobs will be created in folders named after the stage. + +preference is placed on jobs to output JUnit.xml test reports. This is because they are visible in merge requests. diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/markdown_lint.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/markdown_lint.md new file mode 100644 index 00000000..71c49ef9 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/markdown_lint.md @@ -0,0 +1,74 @@ +--- +title: Markdown File Linting +description: How to use No Fuss Computings gitlab-ci job for markdown linting +date: 2021-08-11 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This job lints markdown files as part of the validation CI stage. It is designated to run on all branches. If any errors are found, the generated JUnit test report will let you know what errors were found. + +You can include your linting rules in `.markdownlint.json` which should be within the root of your repository. for the available rules please see the [docs](https://github.com/DavidAnson/markdownlint/blob/main/README.md#rules--aliases). + +This job provides the following badge: + +- _None_ + + +## Dependencies + +- **Optional** file `.markdownlint.json` in repository root with any rules you wish to specify + + +## your .gitlab-ci.yml changes + +To use this job add the following to your `.gitlab-ci.yml` file + +``` yaml + +stages: + - validation + +include: + - local: CI/validation/.gitlab-ci.yml + +Markdown Linting: + extends: + - .Lint_Markdown + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| MDLINT_PATH | **Optional** specifies the path to lint. defaults to `"**/*.md"` | +| MDLINT_EXCLUDE_PATHS | **optional** Specifies the paths to exclude from linting. Defaults to `"!gitlab-ci"` | +| MD_LINT_CONFIG-PATH | **Optional** Specifies a path whenre the lint config file is. defaults to none. this variable enables you to specify a config that will be copied to the project root folder. ***Note:** if specified, the file will be deleted at the end of the linting job.* + + +## Job Workflow + +1. installs the required job dependencies + +1. Lints any markdow file found in `$MDLINT_PATH`, excluding paths `$MDLINT_EXCLUDE_PATHS` + + +## Artifacts + +- JUnit test report located at `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml` + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "lint/markdown.gitlab-ci.yaml" + +``` + +!!! Note + Docs Still under development diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/mkdocs-build.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/mkdocs-build.md new file mode 100644 index 00000000..bb7e9033 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/mkdocs-build.md @@ -0,0 +1,81 @@ +--- +title: MKDocs Static Site Build +description: How to use No Fuss Computings gitlab-ci job for MKDocs Static Site Build +date: 2021-08-11 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + + +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: + +- _None_ + +## Dependencies + +- **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 + +include: + - local: CI/build/.gitlab-ci.yml + +MKDocs build: + variables: + MKDOCS_BUILD_PATH: "build" + extends: + - .MKDocs_Build + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| MKDOCS_BUILD_PATH | **Mandatory, if different from default** The path where MKDocs places the build files. Defaults to `build` | +| MKDOCS_INCLUDE_SOURCE | **Optional** Include the build source files in the artifacts. Default is Not set. Any value in this variable, will include the source files. | +| MKDOCS_SOURCE_PATH | **Optional, if source files are not to be included** Set to the path where mkdocs uses to build the static html. | + + +## Job Workflow + +1. install mkdocs + + 1. if file `requirements.txt` exists in the repository root directory, use this fill to also install additional dependencies. + + 1. if no `requirements.txt` file exists, only install mkdocs. + +1. run mkdocs to build the static pages + +1. if variable `$MKDOCS_INCLUDE_SOURCE` is set, then copy `$MKDOCS_SOURCE_PATH` to the artifacts location. + +1. copy directory `$MKDOCS_BUILD_PATH` to the artifacts location. + + +## Artifacts + +- files in `"$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME"` + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "mkdocs/.gitlab-ci.yml" + +``` + +!!! Note + Docs Still under development diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/python.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/python.md new file mode 100644 index 00000000..6484c219 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/python.md @@ -0,0 +1,120 @@ +--- +title: Python +description: How to use No Fuss Computings gitlab-ci job for Python +date: 2021-08-11 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + + +This folder (`python`) covers jobs for python development + + +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} + +%2F-%2Fjobs%2Fartifacts%2F + +{branch} + +%2Fraw%2Fartifacts%2Fvalidation%2FPyLint%2Fbadge_pylint.json%3Fjob%3D + +{Job Name} + +)](https://gitlab.com/ + +{project path} + +/-/jobs/artifacts/ + +{branch} + +/file/ + +artifacts/validation/tests/gl-code-quality-report.html + +?job= + +{Job Name} +) + +``` + +| Variable | Description | +|:----|:----| +| `{project path}` | *project path, what's after gitlab.com/* | +| `{branch}` | *git branch to fetch the score from* | +| `{Job Name}` | *name of the gitlab-ci job for the linting* | + + +## Dependencies + +- None + + +## your .gitlab-ci.yml changes + +To add the `PyLint` job, add the following to your `.gitlab-ci.yml` file + +``` yaml + +stages: + - validation + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/master/python/.gitlab-ci.yml + +PyLint: + variables: + PYLINT_PATH: "/*/*.py" + PYLINT_RC_PATH: "." + extends: + - .PyLint + image: python:3.6-slim + +``` + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| PYLINT_PATH | *The path you wish the linter to search for python files* | +| PYLINT_RC_PATH | *The path to your `.pylintrc` file.* | + + +## Job Workflow + +- 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/gl-code-quality-report.json` - Gitlab code quality report (displays in merge request) + +- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html` - html code quality report + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "python/.gitlab-ci.yml" + +``` + +!!! Note + Docs Still under development diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/ansible_roles.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/ansible_roles.md new file mode 100644 index 00000000..0cfc2e8f --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/ansible_roles.md @@ -0,0 +1,64 @@ +--- +title: Ansible +description: How to use No Fuss Computings gitlab-ci job for ansible +date: 2021-08-03 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This job does ansible role/playbook linting when any commit is pushed to any branch. + + +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 + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/ansible/.gitlab-ci.yml + +Ansible Lint (python 3.6): + variables: + ANSIBLE_LINT_PATH: "roles/" + extends: + - .ansible_linter_defaults + image: python:3.6-slim + +``` + +> You can use any python version you wish. + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| ANSIBLE_LINT_PATH | *The path you wish the linter to search for ansible roles/playbooks* | + + +## Job Workflow + +- 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 diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/automagic.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/automagic.md new file mode 100644 index 00000000..bfae8d68 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/automagic.md @@ -0,0 +1,28 @@ +--- +title: Automatic Gitlab CI/CD jobs Template +description: How to use No Fuss Computings gitlab-ci template for auto creation of CI/CD joobs. +date: 2023-05-22 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This template is designed to autodetect which jobs should be created. By including it within your project, the jobs will be automagically created for the pipeline. + + +## Docs ToDo + +- document variables `PIPELINE_RUN_TRIGGER: 'false'` and `PIPELINE_RUN_SCHEDULE: 'false'` as being used as a gate to enable the jobs to run by the specified source. + + +!!! Note + Docs Still under development + + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "template/automagic.gitlab-ci.yaml" + +``` diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/docker_container.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/docker_container.md new file mode 100644 index 00000000..fb263956 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/docker_container.md @@ -0,0 +1,37 @@ +--- +title: Docker Container CI Template +description: How to use No Fuss Computings gitlab-ci template for docker containers +date: 2023-05-13 +template: project.html +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 + +- notate that resource groups are used. also mention that the resource group allows the git tag pipeline as forced to wait for the previous pipeline, tag push to build the image first + +``` 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 + DOCKER_IMAGE_BUILD_REGISTRY: $CI_REGISTRY_IMAGE + DOCKER_IMAGE_BUILD_TAG: $CI_COMMIT_SHA + + # DOCKER_IMAGE_PUBLISH_NAME: $CI_PROJECT_NAME + # DOCKER_IMAGE_PUBLISH_REGISTRY: docker.io/nofusscomputing + # DOCKER_IMAGE_PUBLISH_URL: https://hub.docker.com/r/nofusscomputing/$DOCKER_IMAGE_PUBLISH_NAME + # JOB_STOP_CONVENTIONAL_COMMITS: 'any_value' + # 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' + +``` + +!!! Note + Docs Still under development diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/documentation_mkdocs.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/documentation_mkdocs.md new file mode 100644 index 00000000..45630b71 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/documentation_mkdocs.md @@ -0,0 +1,33 @@ +--- +title: mkdocs documentation Gitlab CI/CD Template +description: How to use No Fuss Computings gitlab-ci template for building docs with mkdocs +date: 2023-05-22 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +This template creates the jobs applicable to publishing pages to a website. The website in question is a static site built by MKDocs. + + +## Docs ToDo + +- notate that var `PAGES_ENVIRONMENT_PATH:` can be set to the slug of the page to show and is used for launching the environment to the url that contains the docs index page. + +- notate that resource groups are used. + +## Dependencies + +- **Mandatory** file `docs/index.md` this is the index page of your dcoumentation. + + +!!! Note + Docs Still under development + + +## gitlab-ci.yml definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "template/mkdocs-documentation.gitlab-ci.yaml" + +``` \ No newline at end of file diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/index.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/index.md new file mode 100644 index 00000000..6d5d0ca3 --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/templates/index.md @@ -0,0 +1,18 @@ +--- +title: Gitlab-CI Job Templates +description: How to use No Fuss Computings gitlab-ci project within your CI/CD pipelines +date: 2023-05-22 +template: project.html +about: https://gitlab.com/nofusscomputing/projects/gitlab-ci +--- + +As part of our Gitlab CI job definitions we also have gitlab-ci.yaml templates that are specifically designed for inclusion and will automagically add the required jobs. + +## Docs ToDo + +- all templates are in the template folder. + +- explain `.gitlab-ci_common.yaml` is for inclusion by all, _suggested._ and will never create jobs, only specify defaults. is also included in all templates + +!!! Note + Docs Still under development diff --git a/website-template/gitlab-ci/docs/projects/gitlab-ci/yaml_lint.md b/website-template/gitlab-ci/docs/projects/gitlab-ci/yaml_lint.md new file mode 100644 index 00000000..c4ca22af --- /dev/null +++ b/website-template/gitlab-ci/docs/projects/gitlab-ci/yaml_lint.md @@ -0,0 +1,79 @@ +--- +title: YAML Linting +description: How to use No Fuss Computings gitlab-ci job for YAML Linting +date: 2021-08-11 +template: project.html +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 + + +## Dependencies + +- None + + +## your .gitlab-ci.yml changes + +To use this job add the following to your `.gitlab-ci.yml` file + +``` yaml + +stages: + - validation + +include: + - remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/master/yaml_lint/.gitlab-ci.yml + +Yaml Lint (python 3.6): + variables: + YAML_LINT_PATH: "." + YAML_LINT_EXTRA_ARGS: "{ extends: $ROOT_DIR/yaml_lint/.yamllint.yaml, ignore: [gitlab-ci/*] }" + extends: + - .yaml_linter_defaults + image: python:3.6-slim + +``` + +> You can use any python version you wish. + + +## CI/CD Variables required + +| var name | Description | +|:----:|:----| +| YAML_LINT_PATH | *The path you wish the linter to search for yaml files, defaults to `.`* | +| YAML_LINT_EXTRA_ARGS | *configuration in yaml format., defaults to `{ extends: $ROOT_DIR/yaml_lint/.yamllint.yaml, ignore: [gitlab-ci/*] }` for further info see the [YAML Lint docs](https://yamllint.readthedocs.io/en/stable/configuration.html?highlight=exclude#custom-configuration-without-a-config-file)* | + + +## Job Workflow + +- 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 + + +## Gitlab job Definition + +When you include this definition the following makes up the job definition + +``` yaml title=".gitlab-ci.yml" linenums="1" + +--8<-- "lint/yaml.gitlab-ci.yaml" + +``` + +!!! Note + Docs Still under development diff --git a/website-template/gitlab-ci/docs/projects/index.md b/website-template/gitlab-ci/docs/projects/index.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/docs/tags.md b/website-template/gitlab-ci/docs/tags.md new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/git_push_mirror/.gitlab-ci.yml b/website-template/gitlab-ci/git_push_mirror/.gitlab-ci.yml new file mode 100644 index 00000000..172f9bda --- /dev/null +++ b/website-template/gitlab-ci/git_push_mirror/.gitlab-ci.yml @@ -0,0 +1,32 @@ + +.git_push_mirror: + image: alpine:latest + stage: sync + before_script: + - apk update + - apk add git + script: + - if [ "0$GIT_SYNC_URL" == "0"]; then echo "[ERROR] you must define variable GIT_SYNC_URL for mirroring this repository."; fi + - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.com/$CI_PROJECT_PATH --mirror $CI_PROJECT_NAME + - cd $CI_PROJECT_NAME + - git remote add destination $GIT_SYNC_URL + - echo "https://gitlab.com/ $CI_PROJECT_PATH / $CI_PROJECT_NAME .git" + - git push destination --mirror + artifacts: + expire_in: 1 day + rules: + - if: '$JOB_STOP_GIT_PUSH_MIRROR' + when: never + + - if: $GIT_SYNC_URL == null + when: never + + - if: # condition_master_or_dev_push + ( + $CI_COMMIT_BRANCH == "master" || + $CI_COMMIT_BRANCH == "development" + ) && + $CI_PIPELINE_SOURCE == "push" + when: always + + - when: never diff --git a/website-template/gitlab-ci/git_push_mirror/CHANGELOG.md b/website-template/gitlab-ci/git_push_mirror/CHANGELOG.md new file mode 100644 index 00000000..41994a24 --- /dev/null +++ b/website-template/gitlab-ci/git_push_mirror/CHANGELOG.md @@ -0,0 +1,23 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2023-05-14 11:41:18 +0930 [1db2209](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1db2209dfb36fbdda28d68388aec9f62f85b57bc) - feat(git_push_mirror): always sync git tag +2023-05-13 15:35:28 +0930 [408e4ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - refactor: move docs as part of restructure +2023-05-13 11:47:56 +0930 [81445c0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/81445c06e43bce10761e3a7fbad7df97f82d6bc2) - feat(git_push_mirror): ability to disable job with variable +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-16 00:09:42 +0000 [1ef6c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef6c41818c40183f8019ea5cde48b4278e4d694) - build(version): bump version 0.4.0 → 0.5.0 +2022-01-15 03:53:53 +0000 [5c9000a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c9000a74859504ed64bbefa1fd193f80a2b69c2) - build(version): bump version 0.3.1 → 0.4.0 +2022-01-11 07:03:09 +0000 [7751fd9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7751fd9494f610fff0ea16bd303bfe62d0034eec) - build(version): bump version 0.3.0 → 0.3.1 +2021-08-12 03:32:36 +0000 [389bc08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/389bc08d7686153fb374aa83d440c35c9b4eac90) - build(version): bump version 0.3.0rc1 → 0.3.0 +2021-08-11 13:47:34 +0930 [def31ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/def31ef562c0002713401652657d59320548ee85) - style(yaml_lint): fixed yaml lint errors +2021-08-04 03:23:08 +0000 [eb5cc8a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb5cc8a0e2885a9ed16a8d1a81611aec4d5a4d31) - build(version): bump version 0.3.0rc0 → 0.3.0rc1 +2021-08-04 03:13:54 +0000 [09dcb65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/09dcb65b090f59e9f8a6bea5eba4bb98bddbad3d) - build(version): bump version 0.2.1 → 0.3.0rc0 +2021-08-04 02:49:45 +0000 [4453b43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4453b433c8966a334f02af592a6ce8092f2ac9de) - build(version): bump version 0.2.0 → 0.2.1 +2021-08-04 02:24:12 +0000 [856f2e1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/856f2e1770d0bda823996122ee70916dc0fe455b) - build(version): bump version 0.1.0 → 0.2.0 +2021-08-04 01:33:47 +0000 [6d34977](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d349774269bcd7c6e406cfe72c78b99f246df7b) - build(version): bump version 0.0.1 → 0.1.0 +2021-08-03 14:44:28 +0930 [247264e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/247264e36bc0b6c86d2f06f8dae09ff7447fc156) - docs(README.md): Added readme for the repo +2021-08-03 14:40:17 +0930 [7ffb204](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7ffb20418cfa8e6fa20cca60e42155171961d1ce) - docs(git_push_mirror): Update workflow and typos +2021-08-03 14:28:43 +0930 [9b28ae5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9b28ae5952adfb3d61e660814074ad3c7b42ff61) - feat(git_push_mirror): Added a job that syncs to a remote git repo diff --git a/website-template/gitlab-ci/gitlab_release/.gitlab-ci.yml b/website-template/gitlab-ci/gitlab_release/.gitlab-ci.yml new file mode 100644 index 00000000..fa3044e0 --- /dev/null +++ b/website-template/gitlab-ci/gitlab_release/.gitlab-ci.yml @@ -0,0 +1,124 @@ +.gitlab_release: + stage: release + image: registry.gitlab.com/gitlab-org/release-cli:latest + before_script: + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - apk update + - apk add git + - apk add --update --no-cache python3 && ln -sf python3 /usr/bin/python + - python -m ensurepip && ln -sf pip3 /usr/bin/pip + - pip install --upgrade pip + - pip install -r $ROOT_DIR/gitlab_release/requirements.txt + - pip install $ROOT_DIR/gitlab_release/python-module/cz_nfc/. + - 'CLONE_URL="https://gitlab-ci-token:$GIT_COMMIT_TOKEN@gitlab.com/$CI_PROJECT_PATH.git"' + - echo "[DEBUG] CLONE_URL[$CLONE_URL]" + - git clone -b development $CLONE_URL repo + - cd repo + - git branch + - git config --global user.email "helpdesk@nofusscomputing.com" + - git config --global user.name "nfc_bot" + - git push --set-upstream origin development + - RELEASE_VERSION_CURRENT=$(cz -n cz_nfc version --project) + script: + - "$MY_COMMAND" + - if [ "$CI_COMMIT_BRANCH" == "development" ] ; then RELEASE_CHANGELOG=$(cz -n cz_nfc bump --changelog --changelog-to-stdout --prerelease rc); else RELEASE_CHANGELOG=$(cz -n cz_nfc bump --changelog --changelog-to-stdout); fi + - RELEASE_VERSION_NEW=$(cz -n cz_nfc version --project) + - RELEASE_TAG=$RELEASE_VERSION_NEW + - echo "[DEBUG] RELEASE_VERSION_CURRENT[$RELEASE_VERSION_CURRENT]" + - echo "[DEBUG] RELEASE_CHANGELOG[$RELEASE_CHANGELOG]" + - echo "[DEBUG] RELEASE_VERSION_NEW[$RELEASE_VERSION_NEW]" + - echo "[DEBUG] RELEASE_TAG[$RELEASE_TAG]" + - RELEASE_TAG_SHA1=$(git log -n1 --format=format:"%H") + - echo "[DEBUG] RELEASE_TAG_SHA1[$RELEASE_TAG_SHA1]" + - if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No tag to delete, version was not bumped"; else git tag -d $RELEASE_TAG; fi + + - if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No push will be conducted, version was not bumped"; else git push; fi + - if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No release will be created, version was not bumped"; else release-cli create --name "Release $RELEASE_TAG" --tag-name "$RELEASE_TAG" --tag-message "$RELEASE_CHANGELOG" --ref "$RELEASE_TAG_SHA1" --description "$RELEASE_CHANGELOG"; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git checkout master; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git push --set-upstream origin master; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git merge --no-ff development; fi + - if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git push origin master; fi + after_script: + - rm -Rf repo + rules: + - if: '$JOB_STOP_GITLAB_RELEASE' + when: never + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + allow_failure: false + when: on_success + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + when: manual + allow_failure: true + + # for testing + # - if: '$CI_COMMIT_BRANCH != "master"' + # when: always + # allow_failure: true + - when: never + + +commit footer refs: + stage: validation + image: python:3.6-slim + variables: + DEFAULT_ROOT_DIR: './gitlab-ci' + before_script: + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - if [ "0$JOB_ROOT_DIR" == "0" ]; then export ROOT_DIR=$DEFAULT_ROOT_DIR; else export ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - apt update + - apt install --no-install-recommends -y git + - pip install -e $ROOT_DIR/gitlab_release/python-module/commit_footer/. + - git clone --depth 150 -b development $CI_REPOSITORY_URL check + - cd check + - git remote rm origin + - git remote add origin $CI_REPOSITORY_URL + - git fetch --all + - git checkout --track origin/$CI_COMMIT_BRANCH + script: + - commit_footer > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME.junit.xml" + artifacts: + expire_in: 1 days + when: always + paths: + - "$CI_PROJECT_DIR/artifacts/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml" + rules: + - if: '$JOB_STOP_CONVENTIONAL_COMMITS' + when: never + + - if: $CHANGELOG_FOOTER_REFERENCES == "False" + when: never + + # - if: '$CI_COMMIT_BRANCH == "development" || $CI_COMMIT_BRANCH == "master"' + # when: never + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" && + $CI_COMMIT_TAG == null + exists: + - .cz.yaml + changes: + paths: + - "**/**" + compare_to: development + when: always + + - when: never diff --git a/website-template/gitlab-ci/gitlab_release/CHANGELOG.md b/website-template/gitlab-ci/gitlab_release/CHANGELOG.md new file mode 100644 index 00000000..5b7a2186 --- /dev/null +++ b/website-template/gitlab-ci/gitlab_release/CHANGELOG.md @@ -0,0 +1,60 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-21 01:48:53 +0930 [088c9fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/088c9fb04c80961f4de8d2b129955ae8cd0b9529) - feat(conventional_commits): ensure .cz.yaml exists +2023-05-15 10:25:48 +0930 [18a2808](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18a280878799fe077efa0ed5b11bceedd53eb5c8) - fix(gitlab_release): allow skip on dev branch +2023-05-15 10:19:49 +0930 [d89941d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d89941df05bfed4b0ad1277e715b224d232e7949) - feat(gitlab_release): dont automagic run on dev +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2023-05-14 11:46:28 +0930 [e06ffef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e06ffef66c4a0ba1f48f109c175239560909e698) - feat(gitlab_release): run on merge to development +2023-05-14 11:45:24 +0930 [199ea1f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/199ea1f23c6a3df2b40ae3d9a5668719301500d9) - feat(gitlab_release): never run on merge or git tag +2023-05-14 11:44:20 +0930 [a745cea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a745ceac5ebce458b46593311e5285f40dcba349) - fix(gitlab_release): fixed rule to match nfc_bot +2023-05-14 11:41:47 +0930 [1fa7fec](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1fa7fec38a54b7ddf460b1394a7024ef161fab24) - refactor(gitlab_release): show debug before command +2023-05-14 11:39:53 +0930 [e76378d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e76378dd068e200a1198f1811efb9d3bec7878f5) - fix(gitlab_release): only run on master on_success +2023-05-14 09:56:35 +0930 [934a401](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/934a401a9620891b09a5fe9c9b0e50a97b43fa9b) - fix(ci): specify the commitizen version +2023-05-13 15:35:28 +0930 [408e4ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - refactor: move docs as part of restructure +2023-05-13 11:49:52 +0930 [8d512a9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8d512a9a4bd7f4895645436f057c4bab3efb864e) - feat(commit_footer_refs): ability to disable job with variable +2023-05-13 11:48:47 +0930 [a37acbf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a37acbfc7d3ea20ece7cb76e15a14858b26f8508) - feat(gitlab_release): ability to disable job with variable +2022-02-12 10:27:01 +0000 [9a7ae71](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9a7ae7106e80a038b31cdc9fc172bb1f974ecb94) - refactor: set correct commit details for nfc_bot +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-16 00:09:42 +0000 [1ef6c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef6c41818c40183f8019ea5cde48b4278e4d694) - build(version): bump version 0.4.0 → 0.5.0 +2022-01-16 09:02:44 +0930 [82c6c9f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/82c6c9f5d53594544cea9a7bc59a10ab1e9ebedd) - feat(commit_footer_refs): never run on development or master. +2022-01-15 03:53:53 +0000 [5c9000a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c9000a74859504ed64bbefa1fd193f80a2b69c2) - build(version): bump version 0.3.1 → 0.4.0 +2022-01-11 07:03:09 +0000 [7751fd9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7751fd9494f610fff0ea16bd303bfe62d0034eec) - build(version): bump version 0.3.0 → 0.3.1 +2021-08-12 14:46:26 +0930 [2ac22c0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2ac22c0e914016a8944ff9b94640f3e87f409069) - fix(commit_footer): fix bug introduced in code quality commit +2021-08-12 14:42:16 +0930 [ccc601f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ccc601f641a9b07b63a160d779c5037481316e75) - style(cz_nfc): code quality on cz_nfc.py +2021-08-12 14:27:41 +0930 [5676c5e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5676c5ee376f574a8581e8c8f4810eb5a7c511ba) - style(commit_footer): code quality on setup.py +2021-08-12 14:26:43 +0930 [3d69e57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3d69e57714cd529b13ddc9c575c2dc955a350dd9) - style(commit_footer): code quality on __main__.py +2021-08-12 14:21:34 +0930 [c093c31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c093c31cbd12989f7109dbcb6fd4f029c42a3919) - style(commit_footer): code quality on commits.py +2021-08-12 03:32:36 +0000 [389bc08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/389bc08d7686153fb374aa83d440c35c9b4eac90) - build(version): bump version 0.3.0rc1 → 0.3.0 +2021-08-11 13:47:34 +0930 [def31ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/def31ef562c0002713401652657d59320548ee85) - style(yaml_lint): fixed yaml lint errors +2021-08-11 12:17:50 +0930 [63af1ef](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/63af1efb4fd92a9f8755f766728a18d8f390b805) - fix(commit_footer_refs): Use the current git branch for comparison. +2021-08-08 15:57:50 +0930 [dc13d4f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/dc13d4f2841038c085dcf29dfb0b0c5d2f00f099) - docs(gitlab_release): Added user docs to fix errors from ci job 'commit footer refs' +2021-08-08 15:28:00 +0930 [22136f7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/22136f7dd22b9487d362a7ed63ca1b76e52b9cc7) - feat(gitlab_release): Toggle var added to enable switching changelog references. +2021-08-08 15:18:11 +0930 [eb0bf4c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb0bf4c1740dbd7a47ceb031c0d1c854899a1e40) - refactor(gitlab_release): file link to be in local repository for helping fix commit footer ref check failures +2021-08-08 15:05:35 +0930 [8177622](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/81776223c5cb392c12c7ca63488a1df10290e9d1) - refactor(gitlab_release): use a name for failed test to denote the issue +2021-08-08 15:03:12 +0930 [756b940](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/756b9406dde8cf0bf0030ac72855a054ece3a883) - feat(gitlab_release): be able to toggle commit footer check job +2021-08-08 14:51:57 +0930 [7cb676e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7cb676eb98a7de30d47a6b49a87067116684cfd2) - ci(gitlab_release): Add a validation job to check if commit messages contain a gitlab reference in the footer +2021-08-08 14:50:34 +0930 [11e1566](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/11e156619d0d820e534897bafd5f39e6f9defcbf) - feat(gitlab_release): python module to check if a commit message has gitlab references in the footer +2021-08-07 17:11:17 +0930 [8699c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8699c41219d70e6f41f42dc7f2c1bcf542b3f723) - feat(gitlab_release): Add commit footer to changelog +2021-08-07 14:56:51 +0930 [5f273ce](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5f273ce23a331eaf11623207ec4aba8b856c14f0) - docs(gitlab_release): Updated docs with new instructions on version incrementing +2021-08-07 14:31:19 +0930 [f76cabe](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f76cabeeb04b028a231dc1c232862db5fcad4345) - fix(gitlab_release): Adjust release workflow +2021-08-04 03:23:08 +0000 [eb5cc8a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eb5cc8a0e2885a9ed16a8d1a81611aec4d5a4d31) - build(version): bump version 0.3.0rc0 → 0.3.0rc1 +2021-08-04 03:13:54 +0000 [09dcb65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/09dcb65b090f59e9f8a6bea5eba4bb98bddbad3d) - build(version): bump version 0.2.1 → 0.3.0rc0 +2021-08-04 12:39:01 +0930 [3e8c3ce](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3e8c3ce7cd64a6e9110818d32c15c3602fefb76c) - feat(gitlab_release): On the development brnach, releases to be 'rc' to denote considered non-stable +2021-08-04 12:24:02 +0930 [cc3fabd](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/cc3fabdaa28f97c3e1600e4a0d95a05bb547e772) - refactor(gitlab_release): Use Short commit SHA1 in main changelog link to gitlab +2021-08-04 02:49:45 +0000 [4453b43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4453b433c8966a334f02af592a6ce8092f2ac9de) - build(version): bump version 0.2.0 → 0.2.1 +2021-08-04 12:05:01 +0930 [588698d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/588698df2668853a97fe60901ab324310f34f279) - fix(gitlab_release): Correctly fetch the CI_PROJECT_URL for the environment +2021-08-04 02:24:12 +0000 [856f2e1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/856f2e1770d0bda823996122ee70916dc0fe455b) - build(version): bump version 0.1.0 → 0.2.0 +2021-08-04 11:50:41 +0930 [287b4c9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/287b4c954dddfaaf0a66af387676ea438cc80e61) - feat(gitlab_release): Include code refactor as part of the changelog +2021-08-04 11:48:28 +0930 [eebe8e3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/eebe8e30dcb11cd239f35fcb98216b2ae4d20ece) - docs(gitlab_release): Include custom command instructions +2021-08-04 11:29:22 +0930 [7a69685](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7a69685b53cbe5bd7341a176bf63fd17d36bc7f0) - refactor(gitlab_release): Dont conduct any release, git push or tag delete if the version was not bumped +2021-08-04 11:16:44 +0930 [72e8b6c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/72e8b6c84defdb903c5741e3469651987769713f) - refactor(gitlab_release): build gitlab commit url for changelog so that there is a weblink to the changes +2021-08-04 01:33:47 +0000 [6d34977](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d349774269bcd7c6e406cfe72c78b99f246df7b) - build(version): bump version 0.0.1 → 0.1.0 +2021-08-04 11:00:19 +0930 [80ca361](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/80ca3618ee56d0f2a2c012416cb6206599a4f3f6) - fix(gitlab_release): A 'feat' commit must do a MINOR bump to version +2021-08-04 10:46:25 +0930 [ed5be7f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ed5be7fd3c16e86d48e179a2cded53a38f79e1d9) - fix(gitlab_release): ci image is alpine, use '/bin/sh' and add the changlogs to git cache for commiting +2021-08-04 10:44:57 +0930 [2035ed2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2035ed27af7fc1f3f5b2c42aa5874219fc5fe323) - refactor(gitlab_release): use 'git log' to get current commit hash +2021-08-04 10:43:25 +0930 [7706085](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7706085b09f3cd9b7c09f7f93b182fd425f6525a) - fix(gitlab_release): All tasks run as part of script including user custom script +2021-08-04 10:40:46 +0930 [1446c28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1446c28ed2bfe2efec99bc2fc83b111717bcb2af) - fix(gitlab_release): Use a user token to access the git repo for pushing commits back +2021-08-03 15:48:35 +0930 [6678a3d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6678a3dbab2763addc185e766cbaffbc074a6e98) - feat(git_release): Migrated from ansible-roles diff --git a/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/__main__.py b/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/__main__.py new file mode 100644 index 00000000..93466abb --- /dev/null +++ b/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/__main__.py @@ -0,0 +1,6 @@ +#-*- coding: utf-8 -*- + +import cli + +if __name__ == '__main__': + cli.main() diff --git a/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/cli.py b/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/cli.py new file mode 100644 index 00000000..dcfad25e --- /dev/null +++ b/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/cli.py @@ -0,0 +1,14 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- + +import sys +from commits import Commits + +def main(): + + commits = Commits() + + if commits.check(): + sys.exit(0) + else: + sys.exit(1) diff --git a/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/commits.py b/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/commits.py new file mode 100644 index 00000000..d1e447cb --- /dev/null +++ b/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/commits.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- + +import os +import re +import git + +class Commits: + + + def __init__(self): + + self._repository = git.Repo(os.getcwd()) + + self._failed = [] + merge_base = self._repository.merge_base('development', self._repository.active_branch) + self._merge_base = str(merge_base[0]) + + self.fetch_all() + + + def fetch_all(self) -> bool: # get the commits and filter to only the current branch + + commits = list(self._repository.iter_commits(self._repository.active_branch)) + + clean = True + branch_commits = [] + for remove in commits: + + if str(remove).lower() == self._merge_base.lower(): + + clean = False + + if clean: + + branch_commits.append(remove) + + self._commits = branch_commits + + + def fetch(self, sha1:str) -> str: # fetch a single git message + + for commit in self._commits: + + if str(commit).lower() == sha1.lower(): + + return commit.message + + return '' + + # Get the last line of the commit message if has more than 2 lines + def footer(self, git_message:str) -> list: + footer = None + + if git_message.count("\n") > 2: + + footer_line = git_message.split("\n") + footer_line = footer_line[(len(footer_line)-1)] + + commit_footer = re.findall(r"([\!|\#][\d|not]+)", str(git_message)) + + if len(commit_footer) > 0: + footer = commit_footer + else: + footer = False + + return footer + + + def junit(self) -> bool: + + junit_testsuites = ''''''.format(len(self._failed), len(self._commits)) + + junit_testsuite = ''''''.format(len(self._failed), len(self._commits)) + + junit_testcase = '' + for commit in self._failed: + for key in commit: + junit_testcase += ''' + + {1} + + + + + + + '''.format(key, str(commit[key]), os.environ['ROOT_DIR']) + + + if junit_testcase == '': + junit_testcase = '''''' + + junit_close = '' + print(str(junit_testsuites)) + print(str(junit_testsuite)) + print(str(junit_testcase)) + print(str(junit_close)) + + + def check(self) -> bool: + check = True + + for commit in self._commits: + + if commit.message.count('\n') < 3: + continue + footer = self.footer(commit.message) + + if footer is False: + failed = {str(commit): str(commit.message)} + self._failed.append(failed) + continue + + self.junit() + + if len(self._failed) > 0: + check = False + + return check diff --git a/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/setup.py b/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/setup.py new file mode 100644 index 00000000..df83c8d0 --- /dev/null +++ b/website-template/gitlab-ci/gitlab_release/python-module/commit_footer/setup.py @@ -0,0 +1,13 @@ +from setuptools import setup + +setup( + name='NFC commit footer validation', + version='0.1.0', + py_modules=['main'], + license='MIT', + long_description='this is a long description', + install_requires=['gitpython'], + entry_points = { + 'console_scripts': ['commit_footer=cli:main'], + }, +) diff --git a/website-template/gitlab-ci/gitlab_release/python-module/cz_nfc/cz_nfc.py b/website-template/gitlab-ci/gitlab_release/python-module/cz_nfc/cz_nfc.py new file mode 100755 index 00000000..ba8bef78 --- /dev/null +++ b/website-template/gitlab-ci/gitlab_release/python-module/cz_nfc/cz_nfc.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python3 +#-*- coding: utf-8 -*- + +import os +import re + +import git as Git + +from commitizen import git +from commitizen.cz.base import BaseCommitizen + + +class NoFussCz(BaseCommitizen): + bump_pattern = r"^(break|new|fix|feat|hotfix|ci|docs)" + bump_map = { + "break": "MAJOR", + "new": "MINOR", + "feat": "MINOR", + "fix": "PATCH", + "hotfix": "PATCH", + "ci": "PATCH", + "docs": "PATCH" + } + + changelog_pattern = "^(break|new|fix|feat|hotfix|refactor|ci|docs)" + change_type_order = [ + "BREAKING CHANGE", + "feat", + "fix", + "refactor", + "perf", + "docs", + "ci" + ] + + change_type_map = { + "feat": "Features", + "fix": "Bug Fixes", + "refactor": "Code Refactor", + "perf": "Performance improvements", + "docs": "Documentaton / Guides", + "ci": "Continious Integration" + } + + commit_parser = r"^(?Pfeat|fix|refactor|perf|BREAKING CHANGE|refactor|ci|docs)(?:\((?P[^()\r\n]*)\)|\()?(?P!)?:\s(?P.*)?" + + + def changelog_message_builder_hook(self, parsed_message: dict, commit: git.GitCommit) -> dict: + rev = commit.rev + rev_short = str(rev)[0:8] + repo = Git.Repo(os.getcwd()) + + tree = list(repo.iter_commits(repo.active_branch)) + + footer_references = '' + for item in tree: + + if item.message.count("\n") > 2 and str(item).lower() == rev.lower(): + footer_line = item.message.split("\n") + footer_line = footer_line[(len(footer_line)-1)] + footer = re.findall(r"([\!|\#][0-9]+)", str(item.message)) + + try: + + for reference in footer: + + if '#' in reference: + + footer_references += ' ' + str( + '[{0}]({1}/-/issues/{2})'.format( + reference, + os.environ['CI_PROJECT_URL'], + reference.replace('#', '') + ) + ) + + if '!' in reference: + footer_references += ' ' + str( + '[{0}]({1}/-/merge_requests/{2})'.format( + reference, + os.environ['CI_PROJECT_URL'], + reference.replace('!', '') + ) + ) + + except Exception: + pass + + add_references = True + try: + + if os.environ['CHANGELOG_FOOTER_REFERENCES'] == 'False': + add_references = False + + except KeyError: # continue if the os var doesn't exist + add_references = True + + if footer_references != '' and add_references: + footer_references = ' [' + footer_references + ' ]' + else: + footer_references = '' + + msg = parsed_message["message"] + project_url = os.environ['CI_PROJECT_URL'] + parsed_message["message"] = f"[{rev_short}]({project_url}/-/commit/{rev}) - {msg}{footer_references}" + + return parsed_message + + + def questions(self) -> list: + raise NotImplementedError("Not Implemented yet") + + def message(self, answers: dict) -> str: + raise NotImplementedError("Not Implemented yet") + + +discover_this = NoFussCz diff --git a/website-template/gitlab-ci/gitlab_release/python-module/cz_nfc/setup.py b/website-template/gitlab-ci/gitlab_release/python-module/cz_nfc/setup.py new file mode 100644 index 00000000..15d0c43d --- /dev/null +++ b/website-template/gitlab-ci/gitlab_release/python-module/cz_nfc/setup.py @@ -0,0 +1,10 @@ +from setuptools import setup + +setup( + name='NFC commitizen Custom Bump Map and changelog', + version='0.1.0', + py_modules=['cz_nfc'], + license='MIT', + long_description='this is a long description', + install_requires=['commitizen', 'gitpython'] +) diff --git a/website-template/gitlab-ci/gitlab_release/requirements.txt b/website-template/gitlab-ci/gitlab_release/requirements.txt new file mode 100644 index 00000000..e46e7c52 --- /dev/null +++ b/website-template/gitlab-ci/gitlab_release/requirements.txt @@ -0,0 +1 @@ +commitizen==2.21.0 diff --git a/website-template/gitlab-ci/lint/.markdownlint-cli2.jsonc b/website-template/gitlab-ci/lint/.markdownlint-cli2.jsonc new file mode 100644 index 00000000..01f98e38 --- /dev/null +++ b/website-template/gitlab-ci/lint/.markdownlint-cli2.jsonc @@ -0,0 +1,5 @@ +{ + "outputFormatters": [ + [ "markdownlint-cli2-formatter-junit", { "name": "markdown.junit.xml" } ] + ] +} diff --git a/website-template/gitlab-ci/lint/.yamllint.yaml b/website-template/gitlab-ci/lint/.yamllint.yaml new file mode 100644 index 00000000..ba30e877 --- /dev/null +++ b/website-template/gitlab-ci/lint/.yamllint.yaml @@ -0,0 +1,26 @@ +--- +extends: default + +rules: + braces: {max-spaces-inside: 1, level: error} + brackets: {max-spaces-inside: 1, level: error} + colons: {max-spaces-after: -1, level: error} + commas: {max-spaces-after: -1, level: error} + comments: disable + comments-indentation: disable + document-start: disable + empty-lines: + max: 2 + max-start: 1 + max-end: 1 + level: error + hyphens: {level: error} +# indentation: disable + indentation: + spaces: consistent + key-duplicates: enable + line-length: disable + new-line-at-end-of-file: disable + new-lines: {type: unix} + trailing-spaces: disable + truthy: disable diff --git a/website-template/gitlab-ci/lint/CHANGELOG.md b/website-template/gitlab-ci/lint/CHANGELOG.md new file mode 100644 index 00000000..a40a4fca --- /dev/null +++ b/website-template/gitlab-ci/lint/CHANGELOG.md @@ -0,0 +1,14 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-23 13:40:13 +0930 [e26f590](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e26f590ebcf284be949be4e1d337e1f587755446) - fix(md_linting): must lint on git tag +2023-05-23 09:10:19 +0930 [7c385b7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7c385b7552945699eb87ec3ec43169df0cb77297) - refactor(docs): pages dir renamed to docs +2023-05-22 13:43:28 +0930 [065bcbf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/065bcbf51717e6a29205ced8859a053a2915acd7) - chore(lint): correct lint errors +2023-05-22 13:05:21 +0930 [18af7f8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18af7f831ad2399a6ae9809c51e87f19450db1a7) - fix(markdown_lint): use new lint path +2023-05-22 13:04:11 +0930 [12d3a41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/12d3a412ac73baff16b77488db143efd7311b542) - fix(markdown_lint): typo in config variable +2023-05-22 12:57:08 +0930 [4fa90d4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4fa90d4c4249ed8929e7dde2e7bd0e8581d0d8a7) - feat(template): use md lint config from website-template +2023-05-22 12:00:25 +0930 [38d4690](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/38d469007a388312c71a61916275d6a12aad8bbd) - feat(markdown_lint): enable specifying the lint config path +2023-05-22 11:50:28 +0930 [bce7396](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bce7396d8bbf5ec6600a3a34a05198a87c4fcc70) - refactor(markdown_lint): move md linting to lint folder +2023-05-15 15:27:13 +0930 [a754aa8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a754aa81edf1570b4e8e2e7d4a23025c8b99f314) - fix(lint): use correct path for requirements.txt +2023-05-15 15:06:11 +0930 [539e40e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/539e40e3008e24411f62f439d394db4b5e69a066) - refactor: move ansible and yaml lint job to linting folder diff --git a/website-template/gitlab-ci/lint/ansible.gitlab-ci.yaml b/website-template/gitlab-ci/lint/ansible.gitlab-ci.yaml new file mode 100644 index 00000000..24794865 --- /dev/null +++ b/website-template/gitlab-ci/lint/ansible.gitlab-ci.yaml @@ -0,0 +1,81 @@ + +.ansible_linter_defaults: + stage: validation + variables: + ANSIBLE_LINT_PATH: defaults/ handlers/ meta/ tasks/ templates/ + before_script: + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'` + - apt update + - apt install --no-install-recommends -y git + - python3 -m venv env + - . env/bin/activate + - pip install --upgrade pip + - pip install -r $ROOT_DIR/lint/requirements.txt + - mkdir $PYTHON_VERSION + script: + - ansible-lint -q --nocolor --parseable $ANSIBLE_LINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-ansible-lint.log" 1>&1 || ANSIBLE_LINT=$? + - cat "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-ansible-lint.log" | ansible-lint-to-junit-xml > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-ansible-lint.junit.xml" 1>&1 || ANSIBLE_LINT_JUNIT=$? + - ls -la $PYTHON_VERSION + - if [ $ANSIBLE_LINT_JUNIT > 0 ]; then echo "Error ANSIBLE_LINT_JUNIT failed with $ANSIBLE_LINT_JUNIT"; fi + - if [ $ANSIBLE_LINT -ge 3 ]; then echo "ansible lint failed with $ANSIBLE_LINT"; exit $ANSIBLE_LINT; fi # don't fail the job?? 1=failed test, 2=failed command i.e. switch/flag + - | # Force failure if test must pass set TEST_MUST_PASS=yes + if [ "0$TEST_MUST_PASS" == "0yes" ]; then + + echo "Trace TEST_MUST_PASS[${TEST_MUST_PASS}]"; + + echo "ansible lint failed with $ANSIBLE_LINT"; + + exit $ANSIBLE_LINT; + + fi + + after_script: + - echo deactivate + artifacts: + expire_in: 3 days + when: always + paths: + - "artifacts/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml" + rules: + + - if: '$JOB_STOP_ANSIBLE_LINT' + when: never + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + exists: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + changes: + paths: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + changes: + paths: + - "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}" + compare_to: 'development' + when: always + + - when: never diff --git a/website-template/gitlab-ci/lint/markdown.gitlab-ci.yaml b/website-template/gitlab-ci/lint/markdown.gitlab-ci.yaml new file mode 100644 index 00000000..dc2cc79b --- /dev/null +++ b/website-template/gitlab-ci/lint/markdown.gitlab-ci.yaml @@ -0,0 +1,102 @@ +.Lint_Markdown: + image: node:alpine3.14 + stage: validation + variables: + MDLINT_PATHS: "**/*.md **/**/*.md **/**/**/*.md **/**/**/**/*.md **/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci" + DEFAULT_ROOT_DIR: "./gitlab-ci" + MD_LINT_CONFIG_PATH: "" + before_script: + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown" + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - if [ "0$MD_LINT_CONFIG_PATH" != "0" ]; then cp "$MD_LINT_CONFIG_PATH/.markdownlint.json" $CI_PROJECT_DIR/.markdownlint.json; fi + - cp -f "$ROOT_DIR/lint/.markdownlint-cli2.jsonc" "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc" + - npm install markdownlint-cli2 --global + - npm install markdownlint-cli2-formatter-junit --global + script: + - echo "[DEBUG] MDLINT_PATHS=$MDLINT_PATHS" + - markdownlint-cli2 $MDLINT_PATHS 1>&1 || EXITCODE=$? + - echo DEBUG EXITCODE[$EXITCODE] + - rm -f "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc" + - if [ "0$MD_LINT_CONFIG-PATH" != "0" ]; then rm -f "$CI_PROJECT_DIR/.markdownlint.json"; fi + - mv *.junit.xml "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown/markdown_lint.junit.xml" + artifacts: + expire_in: 24 hrs + when: always + paths: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown/*.junit.xml" + rules: + - if: '$JOB_STOP_LINT_MARKDOWN' + when: never + + - if: # condition_any_branch_push + $CI_COMMIT_BRANCH != null && + $CI_COMMIT_TAG == null && + $CI_PIPELINE_SOURCE == "push" + exists: + # - "**.md" + # - "**/**.md" + - '{!docs/**,!pages/**,!gitlab-ci/**,!website-template/**,**}/*.md' + when: always + - when: never + + +.Lint_Markdown_Docs: + variables: + MDLINT_PATHS: "docs/*.md docs/**/*.md docs/**/**/*.md docs/**/**/**/*.md docs/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci !website-template" + MD_LINT_CONFIG_PATH: "$CI_PROJECT_DIR/website-template" + extends: .Lint_Markdown + rules: + - if: '$JOB_STOP_LINT_MARKDOWN_DOCS' + when: never + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{docs/**,pages/**}/*.md' + when: always + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' + when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + ( + $CI_PIPELINE_SOURCE == "pipeline" + || + $CI_PIPELINE_SOURCE == "push" + || + $CI_PIPELINE_SOURCE == "schedule" + ) + # See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE + exists: + - '{docs/**,pages/**}/*.md' + # No changes check # See nofusscomputing/projects/gitlab-ci#34 + # changes: + # paths: + # - '{docs/**,pages/**}/*.md' + # compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' # works + changes: + paths: + #- '{docs/*,pages/*}*.md' + - '{docs/**,pages/**}/*.md' + compare_to: 'development' + when: always + + - when: never diff --git a/website-template/gitlab-ci/lint/requirements.txt b/website-template/gitlab-ci/lint/requirements.txt new file mode 100644 index 00000000..5e254c3e --- /dev/null +++ b/website-template/gitlab-ci/lint/requirements.txt @@ -0,0 +1,11 @@ + +pipenv==2022.1.8 +wheel +ansible +setuptools_rust +Rust +ansible-lint==6.15.0 +yamllint==1.31.0 +lxml +ansible-lint-junit==0.17.7 +ansible-lint-to-junit-xml==0.1.0 diff --git a/website-template/gitlab-ci/lint/yaml.gitlab-ci.yaml b/website-template/gitlab-ci/lint/yaml.gitlab-ci.yaml new file mode 100644 index 00000000..1f493cc3 --- /dev/null +++ b/website-template/gitlab-ci/lint/yaml.gitlab-ci.yaml @@ -0,0 +1,97 @@ + +.yaml_lint_defaults: + variables: + YAML_LINT_PATH: "." + YAML_LINT_EXTRA_ARGS: "{ extends: $ROOT_DIR/lint/.yamllint.yaml, ignore: [gitlab-ci/*, website-template/*] }" + stage: validation + before_script: + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'` + - apt update + - apt install --no-install-recommends -y git + - python3 -m venv env + - . env/bin/activate + - pip install --upgrade pip + - pip install -r $ROOT_DIR/lint/requirements.txt + - mkdir $PYTHON_VERSION + script: + - echo "[DEBUG] YAML_LINT_PATH[$YAML_LINT_PATH]" + - echo "[DEBUG] YAML_LINT_CONFIG[$YAML_LINT_CONFIG]" + - yamllint $YAML_LINT_PATH -f parsable -d "$(echo $YAML_LINT_EXTRA_ARGS)" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-yaml-lint.log" 1>&1 || YAML_LINT=$? + - cat "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-yaml-lint.log" | ansible-lint-to-junit-xml > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-yaml-lint.junit.xml" + - if [ $YAML_LINT > 0 ]; then echo "YAML lint failed with $YAML_LINT"; exit $YAML_LINT; fi + after_script: + - echo deactivate + artifacts: + expire_in: 3 days + when: always + paths: + - "artifacts/*" + reports: + junit: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml" + rules: + - if: '$JOB_STOP_YAML_LINT' + when: never + + - if: '$CI_COMMIT_BRANCH == "master" && + ( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline")' + when: always + + - if: '$CI_COMMIT_BRANCH && + ( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline")' + exists: + - '{!gitlab-ci/**/*,!website-template/**/*,!.gitlab-ci,!*gitlab-ci*,**/*,**}.{yml,yaml}' + # - ".gitlab-ci*" + # - "**/*gitlab-ci*" + changes: + paths: + - '{!gitlab-ci/**/*,!website-template/**/*,!.gitlab-ci,!*gitlab-ci*,**/*,**}.{yml,yaml}' + compare_to: 'master' + when: always + + - when: never + + +.Gitlab_CI.Lint.YAML: + variables: + YAML_LINT_PATH: ".gitlab-ci* ./**/*gitlab-ci*" + YAML_LINT_EXTRA_ARGS: "{ extends: lint/.yamllint.yaml,ignore: [gitlab-ci/*,website-template/*] }" + extends: + - .yaml_lint_defaults + rules: + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{*,**/**,**}/*gitlab-ci*' + when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{*,**/**,**}/*gitlab-ci*' + changes: + paths: + - '{*,**/**,**}/*gitlab-ci*' + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{*,**/**,**}/*gitlab-ci*' + changes: + paths: + - '{*,**/**,**}/*gitlab-ci*' + compare_to: 'development' + when: always + + - when: never diff --git a/website-template/gitlab-ci/mkdocs.yml b/website-template/gitlab-ci/mkdocs.yml new file mode 100644 index 00000000..fbab0f56 --- /dev/null +++ b/website-template/gitlab-ci/mkdocs.yml @@ -0,0 +1,75 @@ +INHERIT: website-template/mkdocs.yml + +docs_dir: 'docs' + +repo_name: Gitlab-CI +repo_url: https://gitlab.com/nofusscomputing/projects/gitlab-ci +edit_uri: '/-/ide/project/nofusscomputing/projects/gitlab-ci/edit/development/-/docs/' + +nav: +- Home: index.md + +- Articles: + + - articles/index.md + +- Projects: + + - projects/index.md + + - Gitlab CI: + + - Ansible: + + - projects/gitlab-ci/ansible/collection.md + + - Build: + + - projects/gitlab-ci/docker_build.md + + - projects/gitlab-ci/mkdocs-build.md + + - Chores: + + - projects/gitlab-ci/ansible_playbook.md + + - Linting: + + - projects/gitlab-ci/markdown_lint.md + + - projects/gitlab-ci/yaml_lint.md + + - Publish: + + - projects/gitlab-ci/docker_publish.md + + - Templates: + + - projects/gitlab-ci/templates/index.md + + - projects/gitlab-ci/templates/ansible_roles.md + + - projects/gitlab-ci/templates/automagic.md + + - projects/gitlab-ci/templates/docker_container.md + + - projects/gitlab-ci/templates/documentation_mkdocs.md + + - Validation: + + - projects/gitlab-ci/conventional_commits.md + + - projects/gitlab-ci/index.md + + - projects/gitlab-ci/git_mirror.md + + - projects/gitlab-ci/gitlab_release.md + + - projects/gitlab-ci/python.md + +- Operations: + + - operations/index.md + +- Contact Us: contact.md + diff --git a/website-template/gitlab-ci/mkdocs/.gitkeep b/website-template/gitlab-ci/mkdocs/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/website-template/gitlab-ci/mkdocs/.gitlab-ci.yml b/website-template/gitlab-ci/mkdocs/.gitlab-ci.yml new file mode 100644 index 00000000..f5ee0b71 --- /dev/null +++ b/website-template/gitlab-ci/mkdocs/.gitlab-ci.yml @@ -0,0 +1,134 @@ +.MKDocs_Build: + image: python:3.11.2-bullseye + stage: build + variables: + GIT_DEPTH: 0 + MKDOCS_BUILD_PATH: build + MKDOCS_SOURCE_PATH: docs + DEFAULT_ROOT_DIR: './gitlab-ci' + before_script: + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - if [ ! -f "requirements.txt" ]; then pip install --upgrade pip -r $ROOT_DIR/mkdocs/requirements.txt; fi + - if [ -f "requirements.txt" ]; then pip install --upgrade pip -r $ROOT_DIR/mkdocs/requirements.txt; pip install -r requirements.txt; fi + - if [ -f "website-template/requirements.txt" ]; then pip install --upgrade pip -r $ROOT_DIR/mkdocs/requirements.txt; pip install -r website-template/requirements.txt; fi + script: + - mkdocs build --clean --strict + - mv "$MKDOCS_BUILD_PATH" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$MKDOCS_BUILD_PATH" + - if [ "0$MKDOCS_INCLUDE_SOURCE" != "0" ]; then cp $MKDOCS_SOURCE_PATH "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$MKDOCS_SOURCE_PATH"; fi + - ls -laR "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + artifacts: + expire_in: 24 hrs + paths: + - "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + rules: + + - if: '$JOB_STOP_MKDOCS_BUILD' + when: never + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - 'mkdocs.{yaml,yml}' + when: always + + # - if: # condition_master_branch_push + # $CI_COMMIT_BRANCH == "master" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - 'mkdocs.{yaml,yml}' + # when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + ( + $CI_PIPELINE_SOURCE == "pipeline" + || + $CI_PIPELINE_SOURCE == "push" + || + $CI_PIPELINE_SOURCE == "schedule" + ) + # See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE + exists: + - 'mkdocs.{yaml,yml}' + # No changes check # See nofusscomputing/projects/gitlab-ci#34 + # changes: + # paths: + # - '{docs/**,pages/**}/*.md' + # compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - 'mkdocs.{yaml,yml}' + changes: + paths: + - '{docs/**,pages/**}/*.md' + compare_to: 'development' + when: always + + - when: never + + +.MKDocs_Build_Docs: + extends: .MKDocs_Build + variables: + MKDOCS_SOURCE_PATH: docs + rules: + - if: '$JOB_STOP_MKDOCS_BUILD' + when: never + + # Build docs on tag so they can be downloaded from the tag job and are always available. + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{docs/**,pages/**}/*.md' + when: always + + # - if: # condition_master_branch_push + # $CI_COMMIT_BRANCH == "master" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - '{docs/**,pages/**}/*.md' + # when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + ( + $CI_PIPELINE_SOURCE == "pipeline" + || + $CI_PIPELINE_SOURCE == "push" + || + $CI_PIPELINE_SOURCE == "schedule" + ) + # See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE + exists: + - 'mkdocs.{yaml,yml}' + # No changes check # See nofusscomputing/projects/gitlab-ci#34 + # changes: + # paths: + # - '{docs/**,pages/**}/*.md' + # compare_to: 'master' + when: always + + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' + changes: + paths: + - '{docs/**,pages/**}/*.md' + compare_to: 'development' + when: always + + - when: never + \ No newline at end of file diff --git a/website-template/gitlab-ci/mkdocs/CHANGELOG.md b/website-template/gitlab-ci/mkdocs/CHANGELOG.md new file mode 100644 index 00000000..fe248804 --- /dev/null +++ b/website-template/gitlab-ci/mkdocs/CHANGELOG.md @@ -0,0 +1,19 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-23 09:46:43 +0930 [7a9aca3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7a9aca3a54b1faacb7e286bade84aff0ff4fd2e5) - fix(mkdocs): default to docs directory as root +2023-05-22 18:05:24 +0930 [71a335c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/71a335c2667505c199bd67446327cd8794de5f52) - feat(mkdocs): install website-template requirements +2023-05-22 13:20:27 +0930 [a0b6d05](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a0b6d05a0f3f0fa84c825007f6ec9f28c945f3ef) - feat(mkdocs_build): always build +2023-05-22 13:01:18 +0930 [6d2e50e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6d2e50e947839576f098bd7700e00b9d6ab4be1e) - feat(mkdocs_build): add manual build +2023-05-21 15:59:14 +0930 [dacb9f2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/dacb9f22dd9aee1ff741c7ac8078912d9a2b0dbf) - refactor(mkdocs): use locked version from website repo +2023-05-21 15:43:45 +0930 [5556a57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5556a57ea5588d4f0cd1434bfdde5cd77e3b4f5c) - feat(mkdocs): only run on success +2023-05-21 15:41:05 +0930 [1ec2666](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ec2666e8565d5206aefaf5462f0f83f74fbbcb7) - docs(mkdocs): moved to pages folder +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-24 14:08:14 +0930 [a2d705d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a2d705deb1f3898b6d5fa4d55bd995b1a7ad4b68) - ci(mkdcos): mkdocs requirements.txt had a '\n' in the filename. renamed. +2022-01-23 05:31:06 +0000 [906f09e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/906f09e2d3285681bd982d65eda3f56cf5a5169e) - feat(mkdocs_build): use a pip file for job so that licence scanning can function. +2022-01-23 05:18:27 +0000 [18c2e23](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/18c2e2312896aa0ba07050d28155c7aaca2aee5c) - chore(mkdocs): move mkdocs jobs to its own directory. +2022-01-23 04:25:35 +0000 [5a41962](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5a41962a994a54d99a3e7ab1bc0d7379ea14c1c2) - feat(mkdocs_build): move ci job dependencies to a pip file so that the ci dependency job can check versions. +2022-01-23 04:22:38 +0000 [7665e51](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7665e512a5d6e5aab3f8c0a8241d4182f3362442) - chore: add mkdocs dir for pip file. diff --git a/website-template/gitlab-ci/mkdocs/requirements.txt b/website-template/gitlab-ci/mkdocs/requirements.txt new file mode 100644 index 00000000..d1e75433 --- /dev/null +++ b/website-template/gitlab-ci/mkdocs/requirements.txt @@ -0,0 +1,11 @@ +mkdocs==1.5.3 +mkdocstrings==0.25.1 +mkdocstrings-python==1.10.3 +mkdocs-minify-plugin==0.8.0 +mkdocs-material-extensions==1.3.1 +wheel +mkdocs-material==9.5.6 +./website-template/custom-plugins/mkdocs-plugin-tags +mkdocs-git-revision-date-localized-plugin==1.2.2 +pymdown-extensions==10.7 +Jinja2==3.1.3 diff --git a/website-template/gitlab-ci/python/.gitlab-ci.yml b/website-template/gitlab-ci/python/.gitlab-ci.yml new file mode 100644 index 00000000..f8204038 --- /dev/null +++ b/website-template/gitlab-ci/python/.gitlab-ci.yml @@ -0,0 +1,85 @@ + +.pylint_badge: &pylint_badge | + echo "{ + \"PyLintScore\": \"$PyPIScore\" + }" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/badge_pylint.json" + +.PyLint: + variables: + PYLINT_PATH: "/*/python-module/*/*.py" + PYLINT_RC_PATH: "/python/.pylintrc" + stage: validation + before_script: + - if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi + - echo "[DEBUG] ROOT_DIR[$ROOT_DIR]" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME" + - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests" + - export PYTHON_VERSION=`python -c 'import sys; version=sys.version_info[:3]; print("{0}.{1}.{2}".format(*version))'` + - apt update + - apt install --no-install-recommends -y git + - python3 -m venv env + - . env/bin/activate + - pip install --upgrade pip + - pip install -r $ROOT_DIR/python/requirements.txt + - mkdir $PYTHON_VERSION + script: + - PYLINT_PATH=$ROOT_DIR$PYLINT_PATH + - echo "[DEBUG] PYLINT_PATH[$PYLINT_PATH]" + - PYLINT_RC_PATH=$ROOT_DIR$PYLINT_RC_PATH + - echo "[DEBUG] PYLINT_RC_PATH[$PYLINT_RC_PATH]" + - python3 -m pylint --rcfile $PYLINT_RC_PATH --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.json" + + - python3 -m pylint --rcfile $PYLINT_RC_PATH --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html" + + - PyPIScore=$(python3 -m pylint --rcfile $PYLINT_RC_PATH --exit-zero $PYLINT_PATH | sed -n 's/^Your code has been rated at \([-0-9./]*\).*/\1/p') + + - *pylint_badge + + after_script: + - echo deactivate + artifacts: + expire_in: 1 days + when: always + paths: + - "artifacts/*" + reports: + codequality: "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.json" + rules: + + - if: # condition_master_branch_push + $CI_COMMIT_BRANCH == "master" && + $CI_PIPELINE_SOURCE == "push" + exists: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + when: always + + - if: # condition_development_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + changes: + paths: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + changes: + paths: + #- '{**/,*,!gitlab-ci/**,!website-template/**}*.py' + - '{**/,*}*.py' + compare_to: 'development' + when: always + + - when: never + diff --git a/website-template/gitlab-ci/python/.pylintrc b/website-template/gitlab-ci/python/.pylintrc new file mode 100644 index 00000000..83182234 --- /dev/null +++ b/website-template/gitlab-ci/python/.pylintrc @@ -0,0 +1,5 @@ +[MASTER] +disable= + C0114, # missing-module-docstring + C0115, # missing-class-docstring + C0116, # missing-function-docstring diff --git a/website-template/gitlab-ci/python/CHANGELOG.md b/website-template/gitlab-ci/python/CHANGELOG.md new file mode 100644 index 00000000..60149018 --- /dev/null +++ b/website-template/gitlab-ci/python/CHANGELOG.md @@ -0,0 +1,16 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-15 00:18:38 +0000 [a3fdca8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a3fdca83bf7acb58d47792a66d1cd0728747361c) - build(version): bump version 0.6.1rc0 → 0.6.1rc1 +2023-05-13 15:35:28 +0930 [408e4ea](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/408e4eab9e1f61004f1e38af6d1531747b7da99b) - refactor: move docs as part of restructure +2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0 +2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0 +2022-01-16 00:09:42 +0000 [1ef6c41](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1ef6c41818c40183f8019ea5cde48b4278e4d694) - build(version): bump version 0.4.0 → 0.5.0 +2022-01-15 03:53:53 +0000 [5c9000a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/5c9000a74859504ed64bbefa1fd193f80a2b69c2) - build(version): bump version 0.3.1 → 0.4.0 +2022-01-11 07:03:09 +0000 [7751fd9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7751fd9494f610fff0ea16bd303bfe62d0034eec) - build(version): bump version 0.3.0 → 0.3.1 +2021-08-12 15:06:07 +0930 [4b6cc31](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4b6cc3176fc4acc3b7dbb954162802af9cbb4c68) - fix(pylint): install the required packages for files being checked +2021-08-12 14:49:00 +0930 [936299a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/936299aefc6eadf9cbfec3152b352b321969cfab) - fix(pylint): fix bug introduced in code quality commit +2021-08-12 14:04:32 +0930 [73e061e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/73e061e649e8fbeee34c6d18cf1f901b394a1f26) - build(pylint): added .pylintrc to exclude some rules +2021-08-12 03:32:36 +0000 [389bc08](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/389bc08d7686153fb374aa83d440c35c9b4eac90) - build(version): bump version 0.3.0rc1 → 0.3.0 +2021-08-11 15:51:45 +0930 [d610562](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d61056243804728e059b99fce1644a8cc37230bb) - feat(python_linting): added ci job, python linting, code quality and scoring diff --git a/website-template/gitlab-ci/python/requirements.txt b/website-template/gitlab-ci/python/requirements.txt new file mode 100644 index 00000000..703669b9 --- /dev/null +++ b/website-template/gitlab-ci/python/requirements.txt @@ -0,0 +1,4 @@ +pylint==2.9.6 +pylint-gitlab==0.3.0 +gitpython==3.1.18 +commitizen==2.17.13 diff --git a/website-template/gitlab-ci/sub-folder_changlog.sh b/website-template/gitlab-ci/sub-folder_changlog.sh new file mode 100755 index 00000000..a4eac1f2 --- /dev/null +++ b/website-template/gitlab-ci/sub-folder_changlog.sh @@ -0,0 +1,20 @@ +#!/bin/sh + +for D in *; do + if [ -d "${D}" ]; then + + if [ "0${D}" != "0website-template" ] && [ "0${D}" != "0docs" ]; then + echo "[DEBUG] Creating changelog for sub-folder: ${D}" + + CHANGELOG_DATA=$(git log --pretty="format:%ci [%h](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/%H) - %s " --follow -- "${D}") + + echo "# Changelog" > ${D}/CHANGELOG.md + + echo "" >> ${D}/CHANGELOG.md + echo "$CHANGELOG_DATA" >> ${D}/CHANGELOG.md + + git add ${D}/CHANGELOG.md + + fi + fi +done diff --git a/website-template/gitlab-ci/template/CHANGELOG.md b/website-template/gitlab-ci/template/CHANGELOG.md new file mode 100644 index 00000000..28b8393e --- /dev/null +++ b/website-template/gitlab-ci/template/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +2023-05-28 10:31:26 +0930 [bade89c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bade89c5333ca853844e224f46a2d3dafab7179d) - fix(scheduled_pipelines): if scheduled pipeline only run schedualable jobs +2023-05-27 15:24:21 +0930 [19dde28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/19dde28526d5e3f7694da3246505537aa2e19c10) - chore: fix linting error +2023-05-27 15:21:27 +0930 [c5d27e8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c5d27e832e100156cb99c5ca580fd5a8eb600e0f) - feat(auto_jobs): created initial template to auto-create jobs +2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2 +2023-05-23 12:37:40 +0930 [bef7684](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bef76847ec686fcff92229d7b9be0bcfc7b267da) - feat(template_website): enable specifying the url slug +2023-05-23 09:10:19 +0930 [7c385b7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7c385b7552945699eb87ec3ec43169df0cb77297) - refactor(docs): pages dir renamed to docs +2023-05-22 13:45:03 +0930 [0b9e737](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0b9e7375c911d65e06b0d801755449ab31cb45ea) - fix(template): use correct path for build artifact +2023-05-22 13:43:28 +0930 [065bcbf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/065bcbf51717e6a29205ced8859a053a2915acd7) - chore(lint): correct lint errors +2023-05-22 13:20:54 +0930 [8e2a233](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8e2a233814bd76ebff3dd8ed5a79afe307a84755) - feat(template): always deploy to pages on dev manual other +2023-05-22 13:13:59 +0930 [1b59d62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1b59d62348465cc9cc069d5ee23e759316fa9b3c) - refactor(template_website): adjust names of jobs +2023-05-22 12:57:08 +0930 [4fa90d4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4fa90d4c4249ed8929e7dde2e7bd0e8581d0d8a7) - feat(template): use md lint config from website-template +2023-05-22 11:50:28 +0930 [bce7396](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bce7396d8bbf5ec6600a3a34a05198a87c4fcc70) - refactor(markdown_lint): move md linting to lint folder +2023-05-21 16:40:44 +0930 [16d47d5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/16d47d5e350e1c78f72c97780ed1732a43927fcc) - feat(website): add pages job for website +2023-05-21 15:53:54 +0930 [91a50eb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/91a50eb15bd92ca65481a73c6f095681281941fe) - feat(template): created website job template +2023-05-17 15:41:09 +0930 [a90ccb8](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/a90ccb81772e295cebe89d7a9c32ab700e19884d) - refactor(docker): move docker jobs to their own file +2023-05-17 15:38:11 +0930 [c34e382](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c34e382a22cd39874abd8fb5116e831e888db8af) - refactor: use name that makes sense diff --git a/website-template/gitlab-ci/template/ansible-collection.gitlab-ci.yaml b/website-template/gitlab-ci/template/ansible-collection.gitlab-ci.yaml new file mode 100644 index 00000000..b82e88d3 --- /dev/null +++ b/website-template/gitlab-ci/template/ansible-collection.gitlab-ci.yaml @@ -0,0 +1,101 @@ + +include: + - local: $JOB_ROOT_DIR/ansible/collection/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/lint/ansible.gitlab-ci.yaml + + +Create Release: + extends: .ansible_collection_merge + needs: [] + + +Ansible Lint: + extends: .ansible_linter_defaults + image: python:3.11-slim + variables: + ANSIBLE_LINT_PATH: meta/ playbooks/ roles/ + needs: [] + rules: + + - if: $CI_COMMIT_TAG + when: always + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "development" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - if: + $CI_COMMIT_BRANCH != "development" + && + $CI_COMMIT_BRANCH != "master" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - when: never + + +# ToDo: add lint for README.md as ansible Galaxy doesn't seem to like html in the md document. 16 Feb 24. + + +Ansible Lint (galaxy.yml): + extends: .ansible_linter_defaults + image: python:3.11-slim + variables: + ANSIBLE_LINT_PATH: galaxy.yml + TEST_MUST_PASS: 'yes' + needs: [] + rules: + + - if: $CI_COMMIT_TAG + when: always + + - if: "$CI_COMMIT_AUTHOR =='nfc_bot '" + when: never + + - if: # Occur on merge + $CI_COMMIT_BRANCH == "development" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - if: + $CI_COMMIT_BRANCH != "development" + && + $CI_COMMIT_BRANCH != "master" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - when: never + + +Build Collection: + extends: .ansible_collection_build + needs: + - Ansible Lint + - Ansible Lint (galaxy.yml) + + +Stage Collection: + extends: .ansible_collection_stage_package + needs: + - Build Collection + + +Gitlab Release: + extends: .ansible_collection_release + needs: + - Stage Collection + + +Ansible Galaxy: + extends: .ansible_collection_publish_galaxy + needs: + - Stage Collection + - Gitlab Release diff --git a/website-template/gitlab-ci/template/ansible-role.gitlab-ci.yaml b/website-template/gitlab-ci/template/ansible-role.gitlab-ci.yaml new file mode 100644 index 00000000..ffeb81db --- /dev/null +++ b/website-template/gitlab-ci/template/ansible-role.gitlab-ci.yaml @@ -0,0 +1,29 @@ +# This gitlab-ci file is used for creating docker images. +# by including this file, the jobs will be autocreated. + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + - local: $JOB_ROOT_DIR/lint/ansible.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml + + +Ansible Lint (python 3.11): + variables: + ANSIBLE_LINT_PATH: defaults/ handlers/ meta/ tasks/ templates/ + extends: + - .ansible_linter_defaults + image: python:3.11-slim + resource_group: build + needs: [] + + +Gitlab Release: + extends: + - .gitlab_release + + +Github (Push --mirror): + extends: + - .git_push_mirror \ No newline at end of file diff --git a/website-template/gitlab-ci/template/automagic.gitlab-ci.yaml b/website-template/gitlab-ci/template/automagic.gitlab-ci.yaml new file mode 100644 index 00000000..7d3d04f8 --- /dev/null +++ b/website-template/gitlab-ci/template/automagic.gitlab-ci.yaml @@ -0,0 +1,52 @@ +# This gitlab-ci file is used for the autocreation of ci jobs. +# by including this file, the jobs will be autocreated if they are detected as required. + +variables: + NFC_AUTO_JOBS: 'true' + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + + # Chore + - local: $JOB_ROOT_DIR/automation/.gitlab-ci-ansible.yaml + + # Validation + - local: $JOB_ROOT_DIR/lint/ansible.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml + + # sync + - local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml + + # release + - local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml + + # templates + - local: $JOB_ROOT_DIR/template/ansible-role.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/template/docker-image.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/template/mkdocs-documentation.gitlab-ci.yaml + + +# +# Chores +# +Update Git Submodules: + extends: .ansible_playbook_git_submodule + +Search Issues for git patches: + extends: .ansible_playbook_mr_from_issue_comment_patch + +# +# Release +# +Gitlab Release: + extends: + - .gitlab_release + + +# +# Sync +# +Github (Push --mirror): + extends: + - .git_push_mirror + needs: [] diff --git a/website-template/gitlab-ci/template/docker-image.gitlab-ci.yaml b/website-template/gitlab-ci/template/docker-image.gitlab-ci.yaml new file mode 100644 index 00000000..dae241a0 --- /dev/null +++ b/website-template/gitlab-ci/template/docker-image.gitlab-ci.yaml @@ -0,0 +1,85 @@ +# This gitlab-ci file is used for creating docker images. +# by including this file, the jobs will be autocreated. + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + - local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/docker/build.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/docker/publish.gitlab-ci.yaml + - local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml + + +variables: + # 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 + DOCKER_IMAGE_BUILD_REGISTRY: $CI_REGISTRY_IMAGE + DOCKER_IMAGE_BUILD_TAG: $CI_COMMIT_SHA + + # DOCKER_IMAGE_PUBLISH_NAME: $CI_PROJECT_NAME + # DOCKER_IMAGE_PUBLISH_REGISTRY: docker.io/nofusscomputing + # DOCKER_IMAGE_PUBLISH_URL: https://hub.docker.com/r/nofusscomputing/$DOCKER_IMAGE_PUBLISH_NAME + # JOB_STOP_CONVENTIONAL_COMMITS: 'any_value' + # 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' + + +Docker Container: + extends: .build_docker_container + resource_group: build + needs: [] + + +Docker.Hub.Branch.Publish: + extends: .publish-docker-hub + needs: [ "Docker Container" ] + resource_group: build + rules: # rules manually synced from docker/publish.gitlab-ci.yaml removing git tag + + # - if: # condition_master_branch_push + # $CI_COMMIT_BRANCH == "master" && + # $CI_PIPELINE_SOURCE == "push" + # exists: + # - '{dockerfile,dockerfile.j2}' + # when: always + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{dockerfile,dockerfile.j2}' + changes: + paths: + - '{dockerfile,dockerfile.j2,includes/**/*}' + compare_to: 'master' + allow_failure: true + when: on_success + + - when: never + + +Docker.Hub.Tag.Publish: + extends: .publish-docker-hub + resource_group: build + rules: # rules manually synced from docker/publish.gitlab-ci.yaml only keeping git tag + + - if: # condition_git_tag + $CI_COMMIT_TAG != null && + $CI_COMMIT_BRANCH == null + exists: + - '{dockerfile,dockerfile.j2}' + when: always + + - when: never + + +Gitlab Release: + extends: + - .gitlab_release + + +Github (Push --mirror): + extends: + - .git_push_mirror \ No newline at end of file diff --git a/website-template/gitlab-ci/template/mkdocs-documentation.gitlab-ci.yaml b/website-template/gitlab-ci/template/mkdocs-documentation.gitlab-ci.yaml new file mode 100644 index 00000000..6010c445 --- /dev/null +++ b/website-template/gitlab-ci/template/mkdocs-documentation.gitlab-ci.yaml @@ -0,0 +1,63 @@ +# This gitlab-ci file is used for creating building pages directories for nofusscomputing.com. +# by including this file, the jobs will be autocreated and only for pages jobs. + +include: + - local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml + - local: $JOB_ROOT_DIR/mkdocs/.gitlab-ci.yml + - local: $JOB_ROOT_DIR/lint/markdown.gitlab-ci.yaml + + +Documentation.Lint: + extends: .Lint_Markdown_Docs + needs: [] + + +Documentation.Build: + extends: .MKDocs_Build_Docs + needs: [ 'Documentation.Lint' ] + resource_group: Documentation + +# this name must always be called 'pages' so that gitlab pages work +pages: + stage: deploy + resource_group: Documentation + variables: + GIT_STRATEGY: none + script: + - mv "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build" public + needs: [ 'Documentation.Build' ] + environment: + name: Gitlab Pages + url: $CI_PAGES_URL/$PAGES_ENVIRONMENT_PATH + artifacts: + paths: + - public + rules: + - if: '$JOB_STOP_GITLAB_PAGES' + when: never + + - if: # condition_dev_branch_push + $CI_COMMIT_BRANCH == "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' + changes: + paths: + - '{docs/**,pages/**}/*.md' + compare_to: 'master' + when: always + + - if: # condition_not_master_or_dev_push + $CI_COMMIT_BRANCH != "master" && + $CI_COMMIT_BRANCH != "development" && + $CI_PIPELINE_SOURCE == "push" + exists: + - '{docs/**,pages/**}/*.md' + changes: + paths: + - '{docs/**,pages/**}/*.md' + compare_to: 'development' + allow_failure: true + when: manual + + - when: never diff --git a/website-template/gitlab-ci/test/.gitlab-ci.yml b/website-template/gitlab-ci/test/.gitlab-ci.yml new file mode 100644 index 00000000..64e3b992 --- /dev/null +++ b/website-template/gitlab-ci/test/.gitlab-ci.yml @@ -0,0 +1,99 @@ +# This gitlab-ci file is for testing job rules + + +API Only: + stage: test + needs: [] + script: + - echo should only run on + rules: + - if: + $CI_PIPELINE_SOURCE == "api" + when: always + + - when: never + + +Push Only: + stage: test + needs: [] + script: + - echo testing rules + rules: + - if: + $CI_COMMIT_BRANCH != "" + && + $CI_PIPELINE_SOURCE == "push" + when: always + + - when: never + + +MR-On Merging Only: + stage: test + needs: [] + script: + - echo should only run on merging a MR + rules: + - if: + $CI_MERGE_REQUEST_IID == "" + && + $CI_PIPELINE_SOURCE == "merge_request_event" + when: always + + - when: never + + +MR-Not On Merging: + stage: test + needs: [] + script: + - echo should never run on merging a MR + rules: + - if: + $CI_MERGE_REQUEST_IID != "" + && + $CI_PIPELINE_SOURCE == "merge_request_event" + when: always + + - when: never + + +MR-Merge Request Event: + stage: test + needs: [] + script: + - echo should only run on merge event + rules: + - if: + $CI_PIPELINE_SOURCE == "merge_request_event" + when: always + + - when: never + + +Trigger Only: + stage: test + needs: [] + script: + - echo should only run on trigger event + rules: + - if: + $CI_PIPELINE_SOURCE == "trigger" + when: always + + - when: never + + +Web Only: + stage: test + needs: [] + script: + - echo should only run on web only trigger + rules: + - if: + $CI_PIPELINE_SOURCE == "web" + when: always + + - when: never + diff --git a/website-template/mkdocs.yml b/website-template/mkdocs.yml new file mode 100644 index 00000000..28c7c81f --- /dev/null +++ b/website-template/mkdocs.yml @@ -0,0 +1,123 @@ +site_name: No Fuss Computing +site_description: "Here at No Fuss Computing we predominately do research and development into, making your computing experience a more enjoyable one." +site_url: https://nofusscomputing.com + +site_author: No Fuss Computing +copyright: Copyright © No Fuss Computing 2021 + +#site_favicon: favicon.ico + +docs_dir: 'pages' +site_dir: build + + +theme: + name: material + logo: assets/logo.png + custom_dir: website-template/theme-overrides + icon: + repo: fontawesome/brands/gitlab # (1)! + locale: en + font: false + features: + - navigation.tracking + - navigation.tabs + - navigation.tabs.sticky + - navigation.indexes + - search.highlight + - toc.integrate + - navigation.top + - header.autohide + - navigation.sections + - content.code.annotate + + palette: + - media: "(prefers-color-scheme: light)" + scheme: default + primary: indigo + accent: indigo + toggle: + icon: material/lightbulb-outline + name: Switch to dark mode + - media: "(prefers-color-scheme: dark)" + scheme: slate + primary: indigo + accent: indigo + toggle: + icon: material/lightbulb + name: Switch to light mode + +extra_css: + - stylesheets/extra.css + + +plugins: + nfc_tags: + filename: tags.md + folder: pages + css_name: ".tags" + search: + lang: en + + git-revision-date-localized: + type: iso_date + enable_creation_date: true + exclude: + - index.md + - tags.md + # minify: + # minify_html: true + + + +extra: + homepage: https://nofusscomputing.com + version: 1.0 + social: + - link: https://hub.docker.com/u/nofusscomputing + name: DockerHub + icon: fontawesome/brands/docker + + - link: https://facebook.com/NoFussComputing + name: Facebook + icon: fontawesome/brands/facebook + + - link: https://gitlab.com/nofusscomputing + name: Gitlab + icon: fontawesome/brands/gitlab + + - link: https://github.com/NoFussComputing + name: Github + icon: fontawesome/brands/github + blog: + dir: articles + author: jon_nfc + author_image: https://gitlab.com/uploads/-/system/user/avatar/4125177/avatar.png + words_read_per_minute: 300 + list_length: 25 + extended_preview: true + + +markdown_extensions: + - def_list + - pymdownx.tasklist: + custom_checkbox: true + - meta + - attr_list + - admonition + - pymdownx.details + - pymdownx.highlight: + anchor_linenums: true + - pymdownx.inlinehilite + - pymdownx.snippets + - md_in_html + - pymdownx.superfences + - pymdownx.tabbed: + alternate_style: true + - tables + # - pymdownx.emoji: + # emoji_index: !!python/name:material.extensions.emoji.twemoji + # emoji_generator: !!python/name:material.extensions.emoji.to_svg + # options: + # custom_icons: + # - .icons diff --git a/website-template/stylesheets/extra.css b/website-template/stylesheets/extra.css new file mode 100644 index 00000000..22ec1c8a --- /dev/null +++ b/website-template/stylesheets/extra.css @@ -0,0 +1,121 @@ +html .md-social a[title="DockerHub"] { + color: #0DB7ED; +} + +html .md-social a[title="Facebook"] { + color: #3B5998; + +} + +html .md-social a[title="Github"] { + color: #F5F5F5; +} + +html .md-social a[title="Gitlab"] { + color: #fc6d26; +} + +.docker { + color: #0DB7ED; +} + +.facebook { + color: #3B5998; +} + +.github { + color: #333; +} + +.gitlab { + color: #fc6d26; +} + +.tags { + background-color: #4051B5; + border-radius: 10px; + font-size: 12px; + color: white; + padding: 3px 6px; + text-align: center; + +} + +a.tags:hover { + color: #FFFF00; +} + +.tags:link { + color: white; +} + +.tags:visited { + color: white; +} + + +/* Blog Styles */ +.mdx-author { + display: flex; + font-size: 13.6px; +} +.mdx-author img { + height: 40px; + border-radius: 100%; +} +.mdx-author p:first-child { + flex-shrink: 0; + margin-right: 16px; +} +.mdx-author p > span { + display: block; +} + + +.container{ + width: 100%; +} +.container .row { + width: 95%; + margin: 0 auto; + height: fit-content; +} + +.container .row:after { + content: ""; + display: table; + clear: both; +} +.container .column { + float: left; + width: 50%; + padding-top: 30px; + +} + +.container .column .mdx-author { + padding-left: 30px; +} + +.container .column h2 { + margin: 0px; + text-align: center; +} + +.container .column ul { + margin: 0px; +} + +.container .column h3 { + margin: 0px; +} + +.container .column img { + height: 22px; +} +@media screen and ( max-width: 700px ) { + .container .column { + float: none; + width: 100%; + } +} diff --git a/website-template/theme-overrides/.icons/brand/docker.svg b/website-template/theme-overrides/.icons/brand/docker.svg new file mode 100644 index 00000000..c4b13198 --- /dev/null +++ b/website-template/theme-overrides/.icons/brand/docker.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/website-template/theme-overrides/article.html b/website-template/theme-overrides/article.html new file mode 100644 index 00000000..789df7b7 --- /dev/null +++ b/website-template/theme-overrides/article.html @@ -0,0 +1,27 @@ +{% extends "base.html" %} + +{% block content %} + + {% if page.meta.type == "blog" %} + + {% elif page.meta.type == "article" %} + + {% endif %} + +

{{ page.title }}

+ {% include "partials/article_metadata.html" %} +
+ {{ page.content }} + + + Published by: {{ config.site_name }}, + + {% if page.meta.copyrightHolder %} +
+ + Copyright {{ page.meta.copyrightHolder }} + + {% endif %} + {% if page.meta.type %}
{% endif %} +
+{% endblock %} diff --git a/website-template/theme-overrides/article_list.html b/website-template/theme-overrides/article_list.html new file mode 100644 index 00000000..dbe7cfc1 --- /dev/null +++ b/website-template/theme-overrides/article_list.html @@ -0,0 +1,38 @@ +{% extends "base.html" %} + +{% block content %} + {{ page.content }} + {% set article_posts = [] %} + {% for page in nav.pages %} + {% if page.url.startswith(config.extra.blog.dir) and page.meta.date is defined %} + + {{ article_posts.append( page ) or "" }} + {% endif %} + {% endfor %} + + {% for page in (article_posts|sort(attribute="meta.date", reverse=True))[:config.extra.blog.list_length] %} + {% if page.meta.type == "blog" %} + + {% elif page.meta.type == "article" %} + + {% endif %} +

+
+ {% include "partials/article_metadata.html" %} +

+ {{ page.meta.description }} +

+ + {% if config.extra.blog.extended_preview %} + + + {% include ".icons/octicons/arrow-right-24.svg" %} + + Continue reading +
+
+ {% endif %} + {% if page.meta.type %}
{% endif %} + {% endfor %} +
+{% endblock %} diff --git a/website-template/theme-overrides/home.html b/website-template/theme-overrides/home.html new file mode 100644 index 00000000..127f090f --- /dev/null +++ b/website-template/theme-overrides/home.html @@ -0,0 +1,68 @@ +{% extends "base.html" %} + +{% block content %} +
+ {{ page.content }} + {% set article_posts = [] %} + {% for page in nav.pages %} + {% if page.url.startswith(config.extra.blog.dir) and page.meta.date is defined %} + + {{ article_posts.append( page ) or "" }} + {% endif %} + {% endfor %} + +
+
+
+ +
    + {% for page in (article_posts|sort(attribute="meta.date", reverse=True))[:config.extra.blog.list_length] %} + {% if page.meta.type == "blog" %} +
  • + {% elif page.meta.type == "article" %} +
  • + {% else %} +
  • + {% endif %} +

    +

    + +

    +
  • + {% endfor %} +
+
+
+

Quick Links

+ +
+
+
+ +
+{% endblock %} diff --git a/website-template/theme-overrides/itil_runbook.html b/website-template/theme-overrides/itil_runbook.html new file mode 100644 index 00000000..ae498f1f --- /dev/null +++ b/website-template/theme-overrides/itil_runbook.html @@ -0,0 +1,63 @@ +{% extends "base.html" %} + +{% block content %} + +{% if page.edit_url %} + + {% include ".icons/material/pencil.svg" %} + +{% endif %} + + + + +

{{ page.title }}

+ +
+ + + {{ page.content }} + + + + + +
+

About:

+

This page is part of our Project {{ config.repo_name }}.

+

+

Page Metadata
+ Version: ToDo: place files short git commit here
+ Date Created: {{ page.meta.date.strftime("%Y-%m-%d") }}
+ {% if page.meta.git_revision_date_localized %}Date Edited: {{ page.meta.git_revision_date_localized.replace("\n", "").replace("\r", "") }}
{% endif %} +

+ +
Contribution:
+

Would You like to contribute to our {{ config.repo_name }} project? You can assist in the following ways:

+ +

 

+

ToDo: Add the page list of contributors

+ +
+ +
+ +{% endblock %} diff --git a/website-template/theme-overrides/manual.html b/website-template/theme-overrides/manual.html new file mode 100755 index 00000000..1a73d657 --- /dev/null +++ b/website-template/theme-overrides/manual.html @@ -0,0 +1,63 @@ +{% extends "base.html" %} + +{% block content %} + +{% if page.edit_url %} + + {% include ".icons/material/pencil.svg" %} + +{% endif %} + + + + + +

{{ page.title }}

+ +
+ + + {{ page.content }} + + + + +
+ +
+

About:

+

This page forms part of our Operations Manual.

+

+

Page Metadata
+ Version: ToDo: place files short git commit here
+ Date Created: {{ page.meta.date.strftime("%Y-%m-%d") }}
+ {% if page.meta.git_revision_date_localized %}Date Edited: {{ page.meta.git_revision_date_localized.replace("\n", "").replace("\r", "") }}
{% endif %} +

+ +
Contribution:
+

Would You like to contribute to our Operations Manual? You can assist in the following ways:

+ +

 

+

ToDo: Add the page list of contributors

+ +
+ +
+ +{% endblock %} diff --git a/website-template/theme-overrides/partials/article_extended_preview.html b/website-template/theme-overrides/partials/article_extended_preview.html new file mode 100644 index 00000000..085d23bf --- /dev/null +++ b/website-template/theme-overrides/partials/article_extended_preview.html @@ -0,0 +1,7 @@ + + + {% include ".icons/octicons/arrow-right-24.svg" %} + + Continue reading +
+
diff --git a/website-template/theme-overrides/partials/article_metadata.html b/website-template/theme-overrides/partials/article_metadata.html new file mode 100644 index 00000000..e11a4717 --- /dev/null +++ b/website-template/theme-overrides/partials/article_metadata.html @@ -0,0 +1,32 @@ + diff --git a/website-template/theme-overrides/partials/article_social.html b/website-template/theme-overrides/partials/article_social.html new file mode 100644 index 00000000..cad4111b --- /dev/null +++ b/website-template/theme-overrides/partials/article_social.html @@ -0,0 +1,17 @@ +{% if config.extra.social %} + {% set ns = namespace() %} + {% for social in config.extra.social %} + {% set title = social.name %} + {% if not title and "//" in social.link %} + {% set _,url = social.link.split("//") %} + {% set title = url.split("/")[0] %} + {% endif %} + {% if ns.line_break is defined %} + {{ ns.line_break }} + {% endif %} + + {% include ".icons/" ~ social.icon ~ ".svg" %} + + {% set ns.line_break = " · " %} + {% endfor %} +{% endif %} \ No newline at end of file diff --git a/website-template/theme-overrides/partials/footer.html b/website-template/theme-overrides/partials/footer.html new file mode 100644 index 00000000..caa78b0e --- /dev/null +++ b/website-template/theme-overrides/partials/footer.html @@ -0,0 +1,14 @@ +{#- + This file was automatically generated - do not edit +-#} +
+ + +
diff --git a/website-template/theme-overrides/project.html b/website-template/theme-overrides/project.html new file mode 100644 index 00000000..4822f38e --- /dev/null +++ b/website-template/theme-overrides/project.html @@ -0,0 +1,63 @@ +{% extends "base.html" %} + +{% block content %} + +{% if page.edit_url %} + + {% include ".icons/material/pencil.svg" %} + +{% endif %} + + + + +

{{ page.title }}

+ +
+ + + {{ page.content }} + + + + + +
+

About:

+

This page forms part of our Project {{ config.repo_name }}.

+

+

Page Metadata
+ Version: ToDo: place files short git commit here
+ Date Created: {{ page.meta.date.strftime("%Y-%m-%d") }}
+ {% if page.meta.git_revision_date_localized %}Date Edited: {{ page.meta.git_revision_date_localized.replace("\n", "").replace("\r", "") }}
{% endif %} +

+ +
Contribution:
+

Would You like to contribute to our {{ config.repo_name }} project? You can assist in the following ways:

+ +

 

+

ToDo: Add the page list of contributors

+ +
+ +
+ +{% endblock %} diff --git a/website-template/theme-overrides/sitemap.xml b/website-template/theme-overrides/sitemap.xml new file mode 100644 index 00000000..81bc0170 --- /dev/null +++ b/website-template/theme-overrides/sitemap.xml @@ -0,0 +1,12 @@ + + +{%- for file in pages -%} + {% if not file.page.is_link %} + + {% if file.page.canonical_url %}{{ file.page.canonical_url|e }}{% else %}{{ file.page.abs_url|e }}{% endif %} + {% if file.page.meta.git_revision_date_localized %}{{ file.page.meta.git_revision_date_localized.replace("\n", "").replace("\r", "").replace('', '').replace('','') }}{% endif %} + weekly + + {%- endif -%} +{% endfor %} + \ No newline at end of file