67 Commits

Author SHA1 Message Date
46cc1fbb6a build(version): bump version 0.5.0 → 0.6.0 2022-01-24 06:33:24 +00:00
Jon
d71def2f2a Merge branch '12-15-mkdocs-build-markdown-linting' into 'development'
feat: Markdown linting and mkdocs build

Closes #15 and #12

See merge request nofusscomputing/projects/gitlab-ci!15
2022-01-24 05:45:45 +00:00
3096d7ee0a ci(markdown_lint): Added Linting of Markdown for files in this repository.
THis is required as the md files will be used for docs.

MR !15
2022-01-24 14:49:36 +09:30
Jon
b6dcb47b1d docs(markdown_lint): removed no longer needed requirement.
MR !15
2022-01-24 05:14:54 +00:00
a2d705deb1 ci(mkdcos): mkdocs requirements.txt had a '\n' in the filename. renamed.
this name was added using the gitlab interface. it should have been sanitized.

MR !15
2022-01-24 14:08:14 +09:30
39a76a0869 ci(dependency_scanning): delete all python 'requirements.txt' files that are not the specified one to be scanned.
Due to a bug reported in gitlab-org/gitlab#350949, variable 'PIP_REQUIREMENTS_FILE'
does not set the pipfile to be scanned, as a consequence, the first found
pipfile is scanned.

MR !15
2022-01-24 14:07:59 +09:30
4e1da5e872 ci(dependency_scanning): python 3.7 not available for dependecy scanning.
Disable the updates for ansible modules that are only available for
python 3.7/3.8 and above.

MR !15
2022-01-24 13:37:23 +09:30
a6afa76600 ci(dependency_scanning): increase python version to 3.7
MR !15
2022-01-24 13:25:15 +09:30
7153f9b425 ci(dependency_scanning): check python version as pillow 9.0 reported as not found.
MR !15
2022-01-24 13:22:28 +09:30
996ee64ab4 ci(dependency_scanning): scanner set to use python 3.6
MR !15
2022-01-24 13:17:38 +09:30
Jon
725bfaf829 ci: debug logging for dep scanning
MR !15
2022-01-23 08:56:58 +00:00
Jon
b844083207 chore: test wich path works for specifying pip file.
MR !15
2022-01-23 07:56:05 +00:00
Jon
41c5e0ca82 chore: remove dependency scan rules not required
MR !15
2022-01-23 07:50:01 +00:00
Jon
2fffa866d8 ci(python_dependency_scan): disabled main job and manual setup for all ci jobs.
Python dependency scan does not work for multiple pip files. Had to setup manual jobs.

MR !15
2022-01-23 07:36:49 +00:00
Jon
6668c2fb8d refactor: test specifying must equal.
MR !15
2022-01-23 07:14:32 +00:00
Jon
fd48316ae7 docs(markdown_lint): updated docs on how to use and view rules.
MR !15
2022-01-23 06:53:57 +00:00
Jon
9ab336fbdd feat(markdown_lint): include junit configuration file '.markdownlint-cli2.jsonc' in ci job.
MR !15
2022-01-23 06:48:42 +00:00
Jon
e46dc57b16 chore(markdown_lint): add empty junit test file.
MR !15
2022-01-23 06:39:23 +00:00
Jon
0df60b12db fix(ansible): remove duplicate lines that last code review didn't remove.
MR !15
2022-01-23 06:12:35 +00:00
Jon
484d98792a fix(ansible): fix typo in job pip file
MR !15
2022-01-23 05:57:43 +00:00
Jon
e1894ec0c4 fix(dependency_scanning): upgraded versions from vulnerability scan.
MR !15
2022-01-23 05:46:31 +00:00
Jon
906f09e2d3 feat(mkdocs_build): use a pip file for job so that licence scanning can function.
MR !15
2022-01-23 05:31:06 +00:00
Jon
18c2e23128 chore(mkdocs): move mkdocs jobs to its own directory.
MR ;15
2022-01-23 05:18:27 +00:00
Jon
83cce72af2 ci(licence_finder): set to recursive scan so all licence's can be detected.
MR !15
2022-01-23 05:02:52 +00:00
Jon
5a41962a99 feat(mkdocs_build): move ci job dependencies to a pip file so that the ci dependency job can check versions.
MR !15
2022-01-23 04:25:35 +00:00
Jon
7665e512a5 chore: add mkdocs dir for pip file.
MR !15
2022-01-23 04:22:38 +00:00
Jon
fc816192be ci(scanners): Added dependency and licence scanners
MR !15
2022-01-23 04:16:34 +00:00
Jon
5c872f163e ci: Added a test stage for gitlab specific tests.
MR !15
2022-01-23 04:10:03 +00:00
Jon
2115964317 chore: review fixes.
MR !1
2022-01-23 03:21:43 +00:00
Jon
e0d8885d52 ci(artifacts): markdown lint and mkdocs build artifacts to expire after 24 hours
MR !15
2022-01-23 03:19:58 +00:00
Jon
347597e3c1 docs(mkdocs_build): include mandatory vars in template ci file.
MR !15
2022-01-23 03:18:34 +00:00
1ef0e2245f docs(mkdocs): Completed the mkdocs build readme
fixes #15 !15
2022-01-23 11:07:47 +09:30
6363ea377c docs(markdown_lint): completed the job docs.
fixes #12
2022-01-23 11:05:07 +09:30
5c05ed7605 docs(mkdocs): initial adding of mkdocs build readme.
MR !15 #5
2022-01-23 10:55:42 +09:30
6383cde3bf docs(markdown_lint): initial adding of the docs
MR !15 #12
2022-01-23 10:43:54 +09:30
50b5e8542b feat(build): initial add of mkdocs build job
builds a mkdocs static pages using the repositories requirements.txt
for extensions and ONLY if a mkdocs.yml file is present in the root directory
of the repository.

MR !15 #15
2022-01-23 10:31:14 +09:30
954aa28dbf feat(validation): Added a Markdown linting validation job.
MR !15 #12
2022-01-23 10:03:02 +09:30
bc67e939fa chore: initial add of build and validation jobs for mkdocs and markdown linting
copied from nofusscomputing/infrastructure/website/3dd3130a037b4ee7c3b55d3961e68703c5e5d49c

MR !15 #12 #15
2022-01-23 09:52:30 +09:30
1ef6c41818 build(version): bump version 0.4.0 → 0.5.0 2022-01-16 00:09:42 +00:00
Jon
1093b380cb Merge branch '6-fix-merging-jobs-failing' into 'development'
fix: merge jobs failing

See merge request nofusscomputing/projects/gitlab-ci!13
2022-01-16 00:05:29 +00:00
f4670844cc docs(README.md): Added project header template
MR !13
2022-01-16 09:23:54 +09:30
140985c3a4 feat(.yaml_lint_defaults): Always run on all branches as this denotes quality.
must run on all branches as quality is an expectation that should be displayed
for all branches.

MR !13
2022-01-16 09:04:52 +09:30
82c6c9f5d5 feat(commit_footer_refs): never run on development or master.
this job checks for gitlab references in the commit footer. It
has been stopped from running on dev and master as checks are already
done on the developers branch that is being worked on prior to the
merging to dev or master branches.

MR !13
2022-01-16 09:02:44 +09:30
31517b4bf0 ci(MR_Title): save the merge request title as a variable and debug output in job log.
job now stores the fetched MR title in a variable that is output to the
job log for end user to view in job log.

MR !13
2022-01-16 09:02:02 +09:30
73918f2f5e fix(commit.py): filter merge request search to 'opened' and on current branch.
Merge request search now filters to 'opened' and to ones on the current branch.
if none were found, outputs 'ci: No Merge Request found, MR count "0"'

any other error with finding the merge request will output
'failed to fetch Merge Request title' this enables further debugging for
potential errors.

fixes #6 !13
2022-01-16 08:48:24 +09:30
5c9000a748 build(version): bump version 0.3.1 → 0.4.0 2022-01-15 03:53:53 +00:00
Jon
745622c214 Merge branch '6-10-11-fix-bugs' into 'development'
fix: numerous bugs

See merge request nofusscomputing/projects/gitlab-ci!12
2022-01-15 03:50:56 +00:00
e5531fc77b feat(commit.py): throw an error if no token was supplied. i.e. empty variable.
A check is done on the supplied token,
if 'None', throws an error that can be viewed in the output log and
in the job output.

fixes #11 !12
2022-01-15 13:14:58 +09:30
6b7ad95fc0 feat(commit.py): confirm a merge request was found, if not output 'ci: No Merge Request found'
issue #11 !12
2022-01-15 13:07:56 +09:30
c543c47af8 feat(commit.py): try to us CI_JOB_TOKEN before the specified token, if any.
issue #11 !12
2022-01-15 13:05:30 +09:30
99bdc2a092 fix(commit.py): fix typo that caused exception
issue #6 !12
2022-01-15 12:29:23 +09:30
d03d9fefc9 fix(conventional_commits): fetch all branches prior to check for parent branch
issue #6 !12
2022-01-15 12:23:54 +09:30
b01550e09f feat(commit.py): removed ability to fetch first commit or target branch
no longer required due to fix on #6.

issue #6 !12
2022-01-15 12:18:15 +09:30
d5782d95e8 fix(ci): added variable 'GIT_SUBMODULE_STRATEGY' to be 'recursive'
fixes #10 !12
2022-01-15 12:04:16 +09:30
42ad02ee5d fix(conventional_commits): use git show-branch to find origin branch
using git branch then filtering after '* [current-branch]' with branches
that contain 'origin/' and removing 'HEAD' and 'current-branch' leaves the
parent branch

fixes #6 !11
2022-01-15 12:04:07 +09:30
7751fd9494 build(version): bump version 0.3.0 → 0.3.1 2022-01-11 07:03:09 +00:00
Jon
49a2e1185b Merge branch 'issue-2' into 'development'
docs(readme): Update project usage in own repo

See merge request nofusscomputing/projects/gitlab-ci!10
2021-08-13 02:12:35 +00:00
8ac36de8e0 docs(readme): Updated with an example .gitlab-ci.yml example
fixes #2 !10
2021-08-13 11:37:10 +09:30
Jon
aa28ef6553 Merge branch 'code-quality' into 'development'
style: improve python code quality

See merge request nofusscomputing/projects/gitlab-ci!9
2021-08-12 05:42:48 +00:00
4b6cc3176f fix(pylint): install the required packages for files being checked
closes #7
2021-08-12 15:06:07 +09:30
936299aefc fix(pylint): fix bug introduced in code quality commit
#7
2021-08-12 14:49:00 +09:30
2ac22c0e91 fix(commit_footer): fix bug introduced in code quality commit
#7
2021-08-12 14:46:26 +09:30
ccc601f641 style(cz_nfc): code quality on cz_nfc.py
#7
2021-08-12 14:42:16 +09:30
5676c5ee37 style(commit_footer): code quality on setup.py
#7
2021-08-12 14:27:41 +09:30
3d69e57714 style(commit_footer): code quality on __main__.py
#7
2021-08-12 14:26:43 +09:30
c093c31cbd style(commit_footer): code quality on commits.py
#7
2021-08-12 14:21:34 +09:30
73e061e649 build(pylint): added .pylintrc to exclude some rules
.pylintrc had rules ignore docs strings for module, function and class. this can be customised by the end user.

!9 #7
2021-08-12 14:04:32 +09:30
33 changed files with 628 additions and 99 deletions

View File

@ -4,4 +4,4 @@ commitizen:
name: cz_conventional_commits
tag_format: v$major.$minor.$patch$prerelease
update_changelog_on_bump: true
version: 0.3.0
version: 0.6.0

View File

@ -1,9 +1,13 @@
variables:
JOB_ROOT_DIR: '.'
SECURE_LOG_LEVEL: debug
GIT_SUBMODULE_STRATEGY: recursive
MY_PROJECT_ID: "28543717"
LICENSE_FINDER_CLI_OPTS: '--recursive'
stages:
- validation
- test
- release
- sync
@ -12,7 +16,83 @@ include:
- 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/validation/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/python/.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
- template: Security/License-Scanning.gitlab-ci.yml
# 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
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: yaml_lint/requirements.txt
PyLint:
extends:
@ -28,6 +108,11 @@ gilab-ci.yml Lint (python 3.6):
image: python:3.6-slim
Markdown Linting:
extends:
- .Lint_Markdown
Gitlab Release:
variables:
MY_COMMAND: ./sub-folder_changlog.sh

9
.markdownlint.json Normal file
View File

@ -0,0 +1,9 @@
{
"line-length": false,
"MD007": {
"indent": 4
},
"MD033": {
"allowed_elements": [ "div", "s", "span", "u" ]
}
}

View File

@ -1,3 +1,96 @@
## 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

View File

@ -1,23 +1,43 @@
<div align="center">
<div align="center" width="100%">
# No Fuss Computing - Gitlab-CI
[![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)
<br>
![Project Status - Active](https://img.shields.io/badge/Project%20Status-Active-green?logo=gitlab&style=plastic)
<br>
![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)
<br>
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)](https://gitlab.com/nofusscomputing/projects/gitlab-ci) | [![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)](https://gitlab.com/nofusscomputing/projects/gitlab-ci) | [![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) |
|:----|:----|:----|
**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)
----
<br>
</div>
This repository is hosted on [gitlab.com](https://gitlab.com/nofusscomputing/projects/gitlab-ci) and has a read-only copy hosted on [github.com](https://github.com/NoFussComputing/gitlab-ci).
links:
- [![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) Issues](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues)
- [Issues](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues)
- [Merge Requests (Pull Requests)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests)
@ -30,7 +50,7 @@ Each CI/CD job is contained within its own sub-folder. Each sub-folder has a rea
### gitlab-ci layout
We use the following branches:
We use the following branches *(these jobs assume you do as well)*:
- `master` - Considered as the stable branch
- `development` considered as unstable
@ -62,6 +82,37 @@ The CI stages for these jobs are as follows, and in the order expected by the jo
- publish
> placement of build objects to external sources
### .gitlab-ci.yml example
example:
``` yaml
stages:
- validation
- build
- prepare
- test
- release
- sync
- publish
variables:
GIT_SUBMODULE_STRATEGY: recursive
MY_PROJECT_ID: "{your_project_id}"
include:
- project: nofusscomputing/projects/gitlab-ci
ref: 68b6bc3bfacf0770e10d2e10a5c57952070d44fe
file:
- conventional_commits/.gitlab-ci.yml
- gitlab_release/.gitlab-ci.yml
- git_push_mirror/.gitlab-ci.yml
- ansible/.gitlab-ci.yml
```
| :bulb: Tip |
|:----|
| *Use a project import in your `.gitlab-ci.yml` file that is tied to a specific `ref`. for example a 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.
@ -69,6 +120,8 @@ 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.
## 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:

View File

@ -1,5 +1,14 @@
# Changelog
2022-01-24 13:37:23 +0930 [4e1da5e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4e1da5e87281284e021791a4b600a1bff53b8431) - ci(dependency_scanning): python 3.7 not available for dependecy scanning.
2022-01-23 07:14:32 +0000 [6668c2f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6668c2fb8d7545b4f9052ad3065e58f00d11be62) - refactor: test specifying must equal.
2022-01-23 06:12:35 +0000 [0df60b1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0df60b12dbfff983ca3a671b90ab1be126597e52) - fix(ansible): remove duplicate lines that last code review didn't remove.
2022-01-23 05:57:43 +0000 [484d987](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/484d98792a27c9d967331e9d3cd1afdca435bdd6) - fix(ansible): fix typo in job pip file
2022-01-23 05:46:31 +0000 [e1894ec](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e1894ec0c4fe7504901682f008c2ff0db7e351fe) - fix(dependency_scanning): upgraded versions from vulnerability scan.
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

View File

@ -1,3 +1,11 @@
# Dependency scanning only has Python 3.6 available.
# Python 3.7
# Pillow==9.0.0
# numpy==1.22.0
# Python 3.6
pipenv==2022.1.8
wheel
ansible
setuptools_rust

View File

@ -22,19 +22,13 @@
- 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]"
- $ROOT_DIR/conventional_commits/scripts/commit.py --token "$MR_ACCESS_TOKEN" --project $PROJECT_ID --branch $CI_COMMIT_BRANCH --target-branch
- target_branch=$($ROOT_DIR/conventional_commits/scripts/commit.py --token "$MR_ACCESS_TOKEN" --project $PROJECT_ID --branch $CI_COMMIT_BRANCH --target-branch)
- echo "[DEBUG] Target Branch[$target_branch]"
- git clone --depth 150 -b $target_branch $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
- git submodule update --init
- 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 $target_branch..$CI_COMMIT_BRANCH --format=format:%H | tail -1)
- 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:
@ -61,7 +55,9 @@ MR Title:
extends:
- .conventional_commit
script:
- cz_exit=0 && cz check --message "$($ROOT_DIR/conventional_commits/scripts/commit.py --token "$MR_ACCESS_TOKEN" --project $PROJECT_ID --title --branch $CI_COMMIT_BRANCH)" > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/cz_output.log" 2>&1 || cz_exit=$?
- 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"

View File

@ -1,5 +1,18 @@
# Changelog
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

View File

@ -9,13 +9,11 @@ import getopt
import json
import requests
get_first_commit = False
get_mr_title = False
get_target_branch = False
project_id = ''
try:
opts, args = getopt.getopt(sys.argv[1:],"hic:t:ti:p:b:o",["commit","token=", "title", "project=", "branch=", "target-branch"])
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}]')
@ -27,9 +25,9 @@ for opt, arg in opts:
if opt == '-h':
print('[commit.py] -i <inputfile> -o <outputfile>')
sys.exit()
elif opt in ("-c", "--commit"):
get_first_commit = True
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
@ -37,29 +35,39 @@ for opt, arg in opts:
project_id = str(arg)
elif opt in ("-b", "--branch"):
git_branch = arg
elif opt in ("-o", "--target-branch"):
get_target_branch = True
# 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'
headers = {'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'] == ci_job_token:
headers = {'JOB_TOKEN': os.environ['CI_JOB_TOKEN']}
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
#print('[DEBUG] headers[{0}]'.format(headers))
merge_requests = requests.get(url, headers=headers, data='')
if not isinstance(merge_requests, list):
headers = {'PRIVATE-TOKEN': ci_job_token}
merge_requests = merge_requests.json()
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))
@ -69,32 +77,24 @@ merge_requests = merge_requests.json()
#mrs = gl.mergerequests.list()
mr_title = ''
mr_title = 'failed to fetch Merge Request title'
mr_first_commit = ''
target_branch = ''
for mr in merge_requests:
if isinstance(merge_requests, list):
# print('\n\nMR=[-{0}-]'.format(mr))
if len(merge_requests) > 0:
if mr['source_branch'] == git_branch and str(mr['target_project_id']) == str(project_id) and str(mr['state']) == 'opened':
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']
mr_first_commit = mr['sha']
target_branch = mr['target_branch']
if get_mr_title:
print('{0}'.format(mr_title))
if get_target_branch:
print('{0}'.format(target_branch))
else:
if get_first_commit:
print('{0}'.format(mr_first_commit))
if get_mr_title:
print('{0}'.format(mr_title))
print('ci: No Merge Request found, MR count "0"')

View File

@ -1,5 +1,9 @@
# Changelog
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

View File

@ -85,8 +85,7 @@ commit footer refs:
junit:
- "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml"
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_COMMIT_BRANCH == "development"'
- if: '$CI_COMMIT_BRANCH == "development" || $CI_COMMIT_BRANCH == "master"'
when: never
- if: '$CI_COMMIT_BRANCH && $CHANGELOG_FOOTER_REFERENCES != "False"'
when: always

View File

@ -1,5 +1,15 @@
# Changelog
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'

View File

@ -1,7 +1,6 @@
#-*- coding: utf-8 -*-
from commit_footer.cli import main
import cli
if __name__ == '__main__':
main()
cli.main()

View File

@ -2,8 +2,8 @@
#-*- coding: utf-8 -*-
import os
import git
import re
import git
class Commits:
@ -11,7 +11,7 @@ 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])
@ -20,22 +20,22 @@ class Commits:
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 = []
branch_commits = []
for remove in commits:
if str(remove).lower() == self._merge_base.lower():
clean = False
if clean:
Branch_commits.append(remove)
branch_commits.append(remove)
self._commits = Branch_commits
self._commits = branch_commits
def fetch(self, sha1:str) -> str: # fetch a single git message
@ -48,64 +48,82 @@ class Commits:
return ''
def footer(self, git_message:str) -> list: # Get the last line of the commit message if has more than 2 lines
# 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)]
footer = re.findall(r"([\!|\#][0-9]+)", str(git_message))
commit_footer = re.findall(r"([\!|\#][0-9]+)", str(git_message))
if len(footer) > 0:
return footer
if len(commit_footer) > 0:
footer = commit_footer
else:
return False
footer = False
return None
return footer
def junit(self) -> bool:
junit = False
junit_testsuites = '<testsuites id="Commits Messages Check" name="commit footer references" errors="{0}" tests="{1}" time="0">'.format(len(self._failed), len(self._commits))
junit_testsuite = '<testsuite errors="{0}" name="commit footer references" tests="{1}">'.format(len(self._failed), len(self._commits))
junit_testsuites = '''<testsuites
id="Commits Messages Check"
name="commit footer references"
errors="{0}"
tests="{1}"
time="0">'''.format(len(self._failed), len(self._commits))
junit_testsuite = '''<testsuite
errors="{0}"
name="commit footer references"
tests="{1}">'''.format(len(self._failed), len(self._commits))
junit_testcase = ''
for commit in self._failed:
for key in commit:
junit_testcase += '''
<testcase classname="{0}" file="{2}/gitlab_release/README.md" line="0" name="No commit footer references found" time="0" timestamp="date">
<failure message="No References in the commit footer" type="validation">{1}</failure>
<testcase
classname="{0}"
file="{2}/gitlab_release/README.md"
line="0"
name="No commit footer references found"
time="0"
timestamp="date">
<failure
message="No References in the commit footer"
type="validation">{1}</failure>
<system-out>
<![CDATA[ {1} ]]>
</system-out>
<system-err>
<![CDATA[ {1} ]]>
</system-err>
</testcase>'''.format(key, str(commit[key], os.environ['ROOT_DIR']))
</testcase>'''.format(key, str(commit[key]), os.environ['ROOT_DIR'])
if junit_testcase == '':
junit_testcase = '<testcase classname="Commit footer references check" file="' + os.environ['ROOT_DIR'] + '/gitlab_release/README.md" name="has commit footer references"/>'
junit_testcase = '''<testcase
classname="Commit footer references check"
file="' + os.environ['ROOT_DIR'] + '/gitlab_release/README.md"
name="has commit footer references"/>'''
junit_close = '</testsuite></testsuites>'
print(str(junit_testsuites))
print(str(junit_testsuite))
print(str(junit_testcase))
print(str(junit_close))
def check(self) -> bool:
check = True
start_check = False
for commit in self._commits:
if commit.message.count('\n') < 3:
continue
continue
footer = self.footer(commit.message)
if footer is False:
@ -119,5 +137,3 @@ class Commits:
check = False
return check

View File

@ -11,4 +11,3 @@ setup(
'console_scripts': ['commit_footer=cli:main'],
},
)

View File

@ -2,19 +2,37 @@
#-*- coding: utf-8 -*-
import os
import git as Git
import re
import git as Git
from commitizen import git
from commitizen.cz.base import BaseCommitizen
class nfc_cz(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"}
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_order = [
"BREAKING CHANGE",
"feat",
"fix",
"refactor",
"perf",
"docs",
"ci"
]
change_type_map = {
"feat": "Features",
"fix": "Bug Fixes",
@ -82,8 +100,9 @@ class nfc_cz(BaseCommitizen):
else:
footer_references = ''
m = parsed_message["message"]
parsed_message["message"] = f"[{rev_short}](" + os.environ['CI_PROJECT_URL'] + f"/-/commit/{rev}) - {m}" + 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
@ -95,4 +114,4 @@ class nfc_cz(BaseCommitizen):
raise NotImplementedError("Not Implemented yet")
discover_this = nfc_cz
discover_this = NoFussCz

0
mkdocs/.gitkeep Normal file
View File

29
mkdocs/.gitlab-ci.yml Normal file
View File

@ -0,0 +1,29 @@
.MKDocs_Build:
image: python:3.7.5-buster
stage: build
variables:
GIT_DEPTH: 0
MKDOCS_BUILD_PATH: build
MKDOCS_SOURCE_PATH: pages
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
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: '$CI_COMMIT_BRANCH'
exists:
- "mkdocs.yml"
- when: never

7
mkdocs/CHANGELOG.md Normal file
View File

@ -0,0 +1,7 @@
# Changelog
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.

58
mkdocs/build.md Normal file
View File

@ -0,0 +1,58 @@
# MKDocs Static Site Build
Build a MKDocs site from the config specified in `mkdocs.yml`. _Only runs if `mkdocs.yml` exists in the repository root directory._ This job is designated to run on all branchs so that you can use the artifacts for deployment to `staging` and/or `production` as required.
This job provides the following badge:
- _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"`
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)

1
mkdocs/requirements.txt Normal file
View File

@ -0,0 +1 @@
mkdocs==1.2.3

View File

@ -7,6 +7,7 @@
.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
@ -24,11 +25,13 @@
script:
- PYLINT_PATH=$ROOT_DIR$PYLINT_PATH
- echo "[DEBUG] PYLINT_PATH[$PYLINT_PATH]"
- python3 -m pylint --exit-zero --output-format=pylint_gitlab.GitlabCodeClimateReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.json"
- 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 --exit-zero --output-format=pylint_gitlab.GitlabPagesHtmlReporter $PYLINT_PATH > "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html"
- 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 --exit-zero $PYLINT_PATH | sed -n 's/^Your code has been rated at \([-0-9./]*\).*/\1/p')
- 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

5
python/.pylintrc Normal file
View File

@ -0,0 +1,5 @@
[MASTER]
disable=
C0114, # missing-module-docstring
C0115, # missing-class-docstring
C0116, # missing-function-docstring

View File

@ -1,3 +1,10 @@
# Changelog
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

View File

@ -61,6 +61,7 @@ include:
PyLint:
variables:
PYLINT_PATH: "/*/*.py"
PYLINT_RC_PATH: "."
extends:
- .PyLint
image: python:3.6-slim
@ -72,6 +73,7 @@ PyLint:
| 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

View File

@ -1,2 +1,4 @@
pylint==2.9.6
pylint-gitlab==0.3.0
gitpython==3.1.18
commitizen==2.17.13

34
validation/.gitlab-ci.yml Normal file
View File

@ -0,0 +1,34 @@
.Lint_Markdown:
image: node:alpine3.14
stage: validation
variables:
MDLINT_PATH: '"**/*.md"'
MDLINT_EXCLUDE_PATHS: '"!gitlab-ci"'
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 ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR ; fi
- echo "[DEBUG] ROOT_DIR[$ROOT_DIR]"
- cp -f "$CI_PROJECT_DIR/validation/.markdownlint-cli2.jsonc" "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc"
- npm install markdownlint-cli2 --global
- npm install markdownlint-cli2-formatter-junit --global
script:
- markdownlint-cli2 $MDLINT_PATH $MDLINT_EXCLUDE_PATHS 1>&1 || EXITCODE=$?
- echo DEBUG EXITCODE[$EXITCODE]
- rm "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc"
- mv *.junit.xml $CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/markdown.junit.xml
artifacts:
expire_in: 24 hrs
when: always
paths:
- "$CI_PROJECT_DIR/artifacts/*"
reports:
junit:
- "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml"
rules:
- if: '$CI_COMMIT_BRANCH'
exists:
- "**.md"
- when: never

View File

@ -0,0 +1,5 @@
{
"outputFormatters": [
[ "markdownlint-cli2-formatter-junit", { "name": "markdown.junit.xml" } ]
]
}

12
validation/CHANGELOG.md Normal file
View File

@ -0,0 +1,12 @@
# Changelog
2022-01-24 05:14:54 +0000 [b6dcb47](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b6dcb47b1d1831784d36f482fd99c0ce5e56f088) - docs(markdown_lint): removed no longer needed requirement.
2022-01-23 06:53:57 +0000 [fd48316](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fd48316ae763282fc106b7da184c05b35d9ae052) - docs(markdown_lint): updated docs on how to use and view rules.
2022-01-23 06:48:42 +0000 [9ab336f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9ab336fbddd6cba1d29c5a001ab52772ed4554b6) - feat(markdown_lint): include junit configuration file '.markdownlint-cli2.jsonc' in ci job.
2022-01-23 06:39:23 +0000 [e46dc57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e46dc57b1643d6fd7c393bcf8b7d1d77bd2096c8) - chore(markdown_lint): add empty junit test file.
2022-01-23 03:21:43 +0000 [2115964](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/21159643176249cbc33df3a655df90267d64bc3b) - chore: review fixes.
2022-01-23 03:19:58 +0000 [e0d8885](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e0d8885d52319a6188c779e80c2064b773721184) - ci(artifacts): markdown lint and mkdocs build artifacts to expire after 24 hours
2022-01-23 11:05:07 +0930 [6363ea3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6363ea377cd008bbc839e6f4ee4fca337b77bc19) - docs(markdown_lint): completed the job docs.
2022-01-23 10:43:54 +0930 [6383cde](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6383cde3bf9985b2cb43908bc2486d1dc67b7026) - docs(markdown_lint): initial adding of the docs
2022-01-23 10:03:02 +0930 [954aa28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/954aa28dbf1073be05a3dd6d13da818a0bc7cb4e) - feat(validation): Added a Markdown linting validation job.
2022-01-23 09:52:30 +0930 [bc67e93](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bc67e939faf0b3d2eac05eae7edf297c81e55739) - chore: initial add of build and validation jobs for mkdocs and markdown linting

View File

@ -0,0 +1,49 @@
# Markdown File Linting
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"` |
## 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`
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)

View File

@ -36,8 +36,6 @@
junit:
- "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml"
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
when: never
- if: '$CI_COMMIT_BRANCH'
when: always
- when: never

View File

@ -1,3 +1,8 @@
# Changelog
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:04:52 +0930 [140985c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/140985c3a4ea07cf30f7fe8c970fb07cc61b776d) - feat(.yaml_lint_defaults): Always run on all branches as this denotes quality.
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:41:42 +0930 [d20a56f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d20a56fa0ca492e3fc2ad7c548fc891cc8ffc8ec) - feat(yaml_lint): Added job yaml lint for checking yaml files