Compare commits
67 Commits
Author | SHA1 | Date | |
---|---|---|---|
1ef6c41818 | |||
1093b380cb | |||
f4670844cc | |||
140985c3a4 | |||
82c6c9f5d5 | |||
31517b4bf0 | |||
73918f2f5e | |||
5c9000a748 | |||
745622c214 | |||
e5531fc77b | |||
6b7ad95fc0 | |||
c543c47af8 | |||
99bdc2a092 | |||
d03d9fefc9 | |||
b01550e09f | |||
d5782d95e8 | |||
42ad02ee5d | |||
7751fd9494 | |||
49a2e1185b | |||
8ac36de8e0 | |||
aa28ef6553 | |||
4b6cc3176f | |||
936299aefc | |||
2ac22c0e91 | |||
ccc601f641 | |||
5676c5ee37 | |||
3d69e57714 | |||
c093c31cbd | |||
73e061e649 | |||
389bc08d76 | |||
f455eb2e27 | |||
3360a15fde | |||
2c61651d9c | |||
a629e39f59 | |||
0653766c93 | |||
d610562438 | |||
def31ef562 | |||
d20a56fa0c | |||
9f7a24c1eb | |||
da8eb5c338 | |||
ace7a03456 | |||
8790917e7d | |||
19900945e7 | |||
63af1efb4f | |||
8a988ebf09 | |||
f4ee55daa5 | |||
dc13d4f284 | |||
22136f7dd2 | |||
eb0bf4c174 | |||
81776223c5 | |||
756b9406dd | |||
7cb676eb98 | |||
11e156619d | |||
d2d4ac0afa | |||
d929c1d3b0 | |||
35edb7cfc5 | |||
8699c41219 | |||
cc2f23b091 | |||
5f273ce23a | |||
f76cabeeb0 | |||
eb5cc8a0e2 | |||
cb78ab8218 | |||
09dcb65b09 | |||
3e8c3ce7cd | |||
cc3fabdaa2 | |||
4453b433c8 | |||
588698df26 |
2
.cz.yaml
2
.cz.yaml
@ -4,4 +4,4 @@ commitizen:
|
||||
name: cz_conventional_commits
|
||||
tag_format: v$major.$minor.$patch$prerelease
|
||||
update_changelog_on_bump: true
|
||||
version: 0.2.0
|
||||
version: 0.5.0
|
||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -11,3 +11,7 @@ dev_env/
|
||||
|
||||
# ignore gitlab-ci artifacts
|
||||
artifacts/
|
||||
|
||||
|
||||
__pycache__
|
||||
*.egg-info
|
||||
|
@ -1,5 +1,6 @@
|
||||
variables:
|
||||
JOB_ROOT_DIR: '.'
|
||||
GIT_SUBMODULE_STRATEGY: recursive
|
||||
MY_PROJECT_ID: "28543717"
|
||||
|
||||
stages:
|
||||
@ -8,9 +9,24 @@ stages:
|
||||
- sync
|
||||
|
||||
include:
|
||||
- local: $JOB_ROOT_DIR/yaml_lint/.gitlab-ci.yml
|
||||
- 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/python/.gitlab-ci.yml
|
||||
|
||||
PyLint:
|
||||
extends:
|
||||
- .PyLint
|
||||
image: python:3.6-slim
|
||||
|
||||
|
||||
gilab-ci.yml Lint (python 3.6):
|
||||
variables:
|
||||
YAML_LINT_PATH: "/*/.gitlab-ci.yml"
|
||||
extends:
|
||||
- .yaml_lint_defaults
|
||||
image: python:3.6-slim
|
||||
|
||||
|
||||
Gitlab Release:
|
||||
@ -20,7 +36,6 @@ Gitlab Release:
|
||||
- .gitlab_release
|
||||
|
||||
|
||||
|
||||
Github (Push --mirror):
|
||||
variables:
|
||||
GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/gitlab-ci.git"
|
||||
|
0
.gitlab/.gitkeep
Normal file
0
.gitlab/.gitkeep
Normal file
0
.gitlab/issue_templates/.gitkeep
Normal file
0
.gitlab/issue_templates/.gitkeep
Normal file
84
.gitlab/issue_templates/new_job.md
Normal file
84
.gitlab/issue_templates/new_job.md
Normal file
@ -0,0 +1,84 @@
|
||||
## :new: Ansible Role - {new ansible role name}
|
||||
<!--
|
||||
- provide a summary of the role and what you propose including what the role will do. ensure all explainations are detailed.
|
||||
- include any templates here using the collapsable sections. remove/add as many as is required and name as to what it is.
|
||||
- you can add/delete any details section as required.
|
||||
- emojis ref: https://github.com/yodamad/gitlab-emoji
|
||||
-->
|
||||
|
||||
<details>
|
||||
<summary>:clipboard: template filename.extension</summary>
|
||||
|
||||
``` yaml
|
||||
your yaml playbook here
|
||||
```
|
||||
</details>
|
||||
|
||||
|
||||
### Playbook usage
|
||||
<!--
|
||||
|
||||
provide examples on how this role would be used in a playbook.
|
||||
|
||||
include a playbook example i.e.
|
||||
<details>
|
||||
<summary>:clipboard: example playbook</summary>
|
||||
|
||||
``` yaml
|
||||
your yaml playbook here
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
-->
|
||||
|
||||
<!-- provide a summary here -->
|
||||
|
||||
<details>
|
||||
<summary>:clipboard: example playbook</summary>
|
||||
|
||||
``` yaml
|
||||
your yaml playbook here
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
### :ledger: Documentation
|
||||
<!-- provide a summary of what is required or even better contribute by writing the docs here -->
|
||||
|
||||
|
||||
<details>
|
||||
<summary>:clipboard: contribution - Documentation</summary>
|
||||
|
||||
<!-- if you are contributing docs write them here. -->
|
||||
|
||||
</details>
|
||||
|
||||
## :link: Links
|
||||
<!-- Add a list of links to items relevant to this issue-->
|
||||
|
||||
- link 1
|
||||
|
||||
- issue #number
|
||||
|
||||
|
||||
## :ballot_box_with_check: Tasks
|
||||
<!--
|
||||
don't delete tasks from the list strike them through to denote not-applicable use double tidle '~~'. i.e. '~~[ ] a random task~~'
|
||||
|
||||
tasks are used as part of the development stage
|
||||
-->
|
||||
|
||||
- [ ] ~Documentation Added
|
||||
|
||||
- [ ] (dev) Merge request opened and linked to this issue
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- don't adjust the below slash commands -->
|
||||
|
||||
/label ~"workflow::not started"
|
||||
|
||||
/label ~"category::feature"
|
0
.gitlab/merge_request_templates/.gitkeep
Normal file
0
.gitlab/merge_request_templates/.gitkeep
Normal file
34
.gitlab/merge_request_templates/default.md
Normal file
34
.gitlab/merge_request_templates/default.md
Normal file
@ -0,0 +1,34 @@
|
||||
## :books: Summary
|
||||
|
||||
<!-- your summary here emojis ref: https://github.com/yodamad/gitlab-emoji-->
|
||||
|
||||
|
||||
-----
|
||||
|
||||
| :link: **Related Issue(s)** | :link: **Related Merge Request(s)** |
|
||||
|:----:|:----:|
|
||||
| <!-- example #1 <br> #2 <br> #3 etc. if none enter *none* --> | <!-- example !1 <br> !2 <br> !3 etc. if none enter *none* --> |
|
||||
|
||||
|
||||
### :construction_worker: Tasks
|
||||
<!-- dont remove tasks strike through including the checkbox by enclosing in double tidle '~~' -->
|
||||
|
||||
- [ ] merging to correct branch?
|
||||
|
||||
- [ ] issue linked to this MR?
|
||||
|
||||
- related issues:
|
||||
|
||||
- [ ] closed in a commit message
|
||||
|
||||
- [ ] Manually closed
|
||||
|
||||
- [ ] All related issues tasks complete?
|
||||
|
||||
|
||||
|
||||
<!-- don't adjust the below slash commands -->
|
||||
|
||||
/label ~"workflow::not started"
|
||||
|
||||
/label ~"category::feature"
|
40
.templates/README.md
Normal file
40
.templates/README.md
Normal file
@ -0,0 +1,40 @@
|
||||
# {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)
|
152
CHANGELOG.md
152
CHANGELOG.md
@ -1,44 +1,160 @@
|
||||
## 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**: [7a69685b53cbe5bd7341a176bf63fd17d36bc7f0]($CI_PROJECT_URL/-/commit/7a69685b53cbe5bd7341a176bf63fd17d36bc7f0) - Dont conduct any release, git push or tag delete if the version was not bumped
|
||||
- **gitlab_release**: [72e8b6c84defdb903c5741e3469651987769713f]($CI_PROJECT_URL/-/commit/72e8b6c84defdb903c5741e3469651987769713f) - build gitlab commit url for changelog so that there is a weblink to the changes
|
||||
- **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**: [eebe8e30dcb11cd239f35fcb98216b2ae4d20ece]($CI_PROJECT_URL/-/commit/eebe8e30dcb11cd239f35fcb98216b2ae4d20ece) - Include custom command instructions
|
||||
- **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**: [287b4c954dddfaaf0a66af387676ea438cc80e61]($CI_PROJECT_URL/-/commit/287b4c954dddfaaf0a66af387676ea438cc80e61) - Include code refactor as part of the changelog
|
||||
- **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**: 80ca3618ee56d0f2a2c012416cb6206599a4f3f6 - A 'feat' commit must do a MINOR bump to version
|
||||
- **gitlab_release**: ed5be7fd3c16e86d48e179a2cded53a38f79e1d9 - ci image is alpine, use '/bin/sh' and add the changlogs to git cache for commiting
|
||||
- **gitlab_release**: 7706085b09f3cd9b7c09f7f93b182fd425f6525a - All tasks run as part of script including user custom script
|
||||
- **gitlab_release**: 1446c28ed2bfe2efec99bc2fc83b111717bcb2af - Use a user token to access the git repo for pushing commits back
|
||||
- **ansible**: 2a3266fb537e22dddf47708d0af101945027128f - Ensure the default ci directory is populated
|
||||
- **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**: b593505698b3d3359569f29f97c90e17e211f304 - Push repo to github NoFussComputing/gitlab-gi
|
||||
- **conventional_commits**: a2174104d1eb05d329bacd44700bf81ac709dcac - Add conventional commits job to check commits and MR titles
|
||||
- **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**: 247264e36bc0b6c86d2f06f8dae09ff7447fc156 - Added readme for the repo
|
||||
- **git_push_mirror**: 7ffb20418cfa8e6fa20cca60e42155171961d1ce - Update workflow and typos
|
||||
- **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**: 1ecd857c0bf8ef009ad2482ad1d52604adadc0ed - Create a changelog per job folder
|
||||
- **git_release**: 6678a3dbab2763addc185e766cbaffbc074a6e98 - Migrated from ansible-roles
|
||||
- **ansible**: 2413daefb1e7e5a9e7a3cbb2d8cff2214f4a98ae - Added ansible validation job for linting
|
||||
- **git_push_mirror**: 9b28ae5952adfb3d61e660814074ad3c7b42ff61 - Added a job that syncs to a remote git repo
|
||||
- **conventional_commits**: 392a200fd469c4161dbab5f2b59031a7a64f20a2 - Added conventional commit job
|
||||
- **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)
|
||||
|
142
README.md
142
README.md
@ -1,20 +1,152 @@
|
||||
# Ansible Roles
|
||||
<div align="center" width="100%">
|
||||
|
||||
[](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
|
||||
# No Fuss Computing - Gitlab-CI
|
||||
|
||||
<br>
|
||||
|
||||

|
||||
|
||||
<br>
|
||||
|
||||
  [](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues)
|
||||
|
||||
  
|
||||
|
||||
<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).
|
||||
|
||||
|
||||
[](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
|
||||
----
|
||||
|
||||
**Stable Branch**
|
||||
|
||||
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).
|
||||
  [](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/jobs/artifacts/master/file/artifacts/validation/tests/gl-code-quality-report.html?job=PyLint)
|
||||
|
||||
----
|
||||
|
||||
**Development Branch**
|
||||
|
||||
  [](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/jobs/artifacts/development/file/artifacts/validation/tests/gl-code-quality-report.html?job=PyLint)
|
||||
|
||||
----
|
||||
|
||||
<br>
|
||||
|
||||
</div>
|
||||
|
||||
links:
|
||||
|
||||
- [Issues](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues)
|
||||
|
||||
- [Merge Requests (Pull Requests)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests)
|
||||
|
||||
|
||||
> *To Do: expand on how repo setup and how to use.*
|
||||
## 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.
|
||||
|
||||
|
||||
### gitlab-ci 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/).
|
||||
|
||||
|
||||
|
||||
### CI Stages
|
||||
The CI stages for these jobs are as follows, and in the order expected by the jobs:
|
||||
|
||||
- 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
|
||||
|
||||
### .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.
|
||||
|
||||
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:
|
||||
``` bash
|
||||
git submodule add -b {ref} https://gitlab.com/nofusscomputing/projects/gitlab-ci.git gitlab-ci
|
||||
git submodule update --remote
|
||||
|
||||
```
|
||||
|
||||
| :bulb: 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.
|
||||
|
||||
|
||||
## Contributing
|
||||
|
@ -22,13 +22,13 @@
|
||||
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"
|
||||
expire_in: 3 days
|
||||
when: always
|
||||
paths:
|
||||
- "artifacts/*"
|
||||
reports:
|
||||
junit:
|
||||
- "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml"
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
when: never
|
||||
|
@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
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 15:23:19 +0930 [2a3266f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2a3266fb537e22dddf47708d0af101945027128f) - fix(ansible): Ensure the default ci directory is populated
|
||||
2021-08-03 15:08:37 +0930 [2413dae](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/2413daefb1e7e5a9e7a3cbb2d8cff2214f4a98ae) - feat(ansible): Added ansible validation job for linting
|
||||
|
@ -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:
|
||||
@ -50,18 +44,20 @@
|
||||
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
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
when: never
|
||||
- if: '$CI_COMMIT_BRANCH'
|
||||
when: always
|
||||
- when: never
|
||||
|
||||
|
||||
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"
|
||||
|
||||
|
||||
@ -69,5 +65,6 @@ Commit Messages:
|
||||
extends:
|
||||
- .conventional_commit
|
||||
script:
|
||||
- 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=$?
|
||||
- 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"
|
||||
|
@ -1,4 +1,22 @@
|
||||
# Changelog
|
||||
|
||||
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
|
||||
|
@ -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"')
|
||||
|
||||
|
@ -14,9 +14,7 @@
|
||||
artifacts:
|
||||
expire_in: 1 day
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
- if: '$CI_COMMIT_BRANCH == "development"'
|
||||
when: always
|
||||
|
||||
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
- if: '$CI_COMMIT_BRANCH == "development"'
|
||||
when: always
|
||||
|
||||
|
@ -1,5 +1,13 @@
|
||||
# Changelog
|
||||
|
||||
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
|
||||
|
@ -15,16 +15,16 @@
|
||||
- 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 $CI_COMMIT_BRANCH $CLONE_URL repo
|
||||
- git clone -b development $CLONE_URL repo
|
||||
- cd repo
|
||||
- git branch
|
||||
- git config --global user.email "CI@nfc-gitlab"
|
||||
- git config --global user.name "NFC CI"
|
||||
- git push --set-upstream origin $CI_COMMIT_BRANCH
|
||||
- git push --set-upstream origin development
|
||||
- RELEASE_VERSION_CURRENT=$(cz -n cz_nfc version --project)
|
||||
script:
|
||||
- "$MY_COMMAND"
|
||||
- RELEASE_CHANGELOG=$(cz -n cz_nfc bump --changelog --changelog-to-stdout)
|
||||
- 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=v$RELEASE_VERSION_NEW
|
||||
- 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
|
||||
@ -36,14 +36,58 @@
|
||||
- echo "[DEBUG] RELEASE_TAG_SHA1[$RELEASE_TAG_SHA1]"
|
||||
- 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" --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: "$CI_COMMIT_AUTHOR =='NFC CI <CI@nfc-gitlab>'"
|
||||
when: never
|
||||
- if: '$CI_COMMIT_BRANCH == "development"'
|
||||
- if: '$TRIGGER_RELEASE == "True" && $CI_COMMIT_BRANCH == "development"'
|
||||
when: on_success
|
||||
- if: '$CI_COMMIT_BRANCH == "master"'
|
||||
when: always
|
||||
allow_failure: false
|
||||
- if: '$CI_COMMIT_BRANCH == "development"'
|
||||
when: manual
|
||||
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
|
||||
- git submodule update --init
|
||||
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: '$CI_COMMIT_BRANCH == "development" || $CI_COMMIT_BRANCH == "master"'
|
||||
when: never
|
||||
- if: '$CI_COMMIT_BRANCH && $CHANGELOG_FOOTER_REFERENCES != "False"'
|
||||
when: always
|
||||
- when: never
|
||||
|
||||
|
@ -1,5 +1,33 @@
|
||||
# Changelog
|
||||
|
||||
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
|
||||
|
@ -1,5 +1,58 @@
|
||||
# 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. This job runs on successful completion of previous jobs and only on `development` and `master` branches.
|
||||
# Commit Message Footer References - 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 (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 Release - Developer Manual
|
||||
This job bumps the version, updates the changelog, creates a git tag and creates a gitlab release. The git tag and release title use [semantic versioning](https://semver.org/). for this job to function correctly a `.cz.yaml` is required in the root of the repository. this file contains the [commitizen](https://github.com/commitizen-tools/commitizen) config and the version details.
|
||||
|
||||
This job has the following workflow:
|
||||
|
||||
- `master` Branch
|
||||
> Automatically increment the version
|
||||
|
||||
- `development` Branch
|
||||
> Manual CI job made available to increment the version. (release-candidate increment only)
|
||||
|
||||
| :octagonal_sign: Danger |
|
||||
|:----|
|
||||
| *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* |
|
||||
|
||||
|
||||
This job provides the following badge:
|
||||
@ -8,13 +61,16 @@ This job provides the following badge:
|
||||
|
||||
## Dependencies
|
||||
|
||||
- This job will only run if all previous jobs run.
|
||||
- None
|
||||
|
||||
## your .gitlab-ci.yml changes
|
||||
To use this job add the following to your `.gitlab-ci.yml` file
|
||||
|
||||
CI Job `ci commit footer` is automatically set to run on all branches except `development` and `master`. This job checks the commits on the users branch that they contain a footer with gitlab references. i.e. `#1` for issue one or `!1` for merge request one.
|
||||
|
||||
``` yaml
|
||||
stages:
|
||||
- validate
|
||||
- release
|
||||
|
||||
include:
|
||||
@ -34,6 +90,7 @@ Gitlab Release:
|
||||
| var name | Description |
|
||||
|:----:|:----|
|
||||
| GIT_COMMIT_TOKEN | *this must be a personal token that has write access to the repository* |
|
||||
| CHANGELOG_FOOTER_REFERENCES | ***Optional** If set to `False` the changelog will not output gitlab references for each entry of the changelog. If this variable is set globally, it will also prevent the creation of the CI job to validate a users commits as having gitlab references.* |
|
||||
|
||||
|
||||
## Job Workflow
|
||||
@ -46,23 +103,19 @@ This CI job's workflow is:
|
||||
1. pushes the change back to the repo
|
||||
1. creates a git release from the `git tag`
|
||||
|
||||
| :octagonal_sign: **NOTE** |
|
||||
|:----|
|
||||
| *If the user has forked the branch, they must keep the development brnach synced with the main repo. If they **don't** the CI job 'commit footer refs' will fail as it will not be able to fetch the parent (`development`) hash of the branch.* |
|
||||
|
||||
|
||||
## Artifacts
|
||||
|
||||
- None
|
||||
- `ci commit footer`
|
||||
> $CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME.junit.xml
|
||||
|
||||
- `Gitlab Release`
|
||||
> None
|
||||
|
||||
## License
|
||||
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
6
gitlab_release/python-module/commit_footer/__main__.py
Normal file
6
gitlab_release/python-module/commit_footer/__main__.py
Normal file
@ -0,0 +1,6 @@
|
||||
#-*- coding: utf-8 -*-
|
||||
|
||||
import cli
|
||||
|
||||
if __name__ == '__main__':
|
||||
cli.main()
|
14
gitlab_release/python-module/commit_footer/cli.py
Normal file
14
gitlab_release/python-module/commit_footer/cli.py
Normal file
@ -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)
|
139
gitlab_release/python-module/commit_footer/commits.py
Normal file
139
gitlab_release/python-module/commit_footer/commits.py
Normal file
@ -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"([\!|\#][0-9]+)", str(git_message))
|
||||
|
||||
if len(commit_footer) > 0:
|
||||
footer = commit_footer
|
||||
else:
|
||||
footer = False
|
||||
|
||||
return footer
|
||||
|
||||
|
||||
def junit(self) -> bool:
|
||||
|
||||
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>
|
||||
<system-out>
|
||||
<![CDATA[ {1} ]]>
|
||||
</system-out>
|
||||
<system-err>
|
||||
<![CDATA[ {1} ]]>
|
||||
</system-err>
|
||||
</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_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
|
||||
|
||||
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
|
13
gitlab_release/python-module/commit_footer/setup.py
Normal file
13
gitlab_release/python-module/commit_footer/setup.py
Normal file
@ -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'],
|
||||
},
|
||||
)
|
@ -1,16 +1,38 @@
|
||||
#!/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 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",
|
||||
@ -25,8 +47,63 @@ class nfc_cz(BaseCommitizen):
|
||||
|
||||
def changelog_message_builder_hook(self, parsed_message: dict, commit: git.GitCommit) -> dict:
|
||||
rev = commit.rev
|
||||
m = parsed_message["message"]
|
||||
parsed_message["message"] = f"[{rev}]($CI_PROJECT_URL/-/commit/{rev}) - {m}"
|
||||
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
|
||||
|
||||
|
||||
@ -37,4 +114,4 @@ class nfc_cz(BaseCommitizen):
|
||||
raise NotImplementedError("Not Implemented yet")
|
||||
|
||||
|
||||
discover_this = nfc_cz
|
||||
discover_this = NoFussCz
|
||||
|
@ -6,5 +6,5 @@ setup(
|
||||
py_modules=['cz_nfc'],
|
||||
license='MIT',
|
||||
long_description='this is a long description',
|
||||
install_requires=['commitizen']
|
||||
install_requires=['commitizen', 'gitpython']
|
||||
)
|
||||
|
52
python/.gitlab-ci.yml
Normal file
52
python/.gitlab-ci.yml
Normal file
@ -0,0 +1,52 @@
|
||||
|
||||
.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: '$CI_COMMIT_BRANCH'
|
||||
when: always
|
||||
- when: never
|
||||
|
5
python/.pylintrc
Normal file
5
python/.pylintrc
Normal file
@ -0,0 +1,5 @@
|
||||
[MASTER]
|
||||
disable=
|
||||
C0114, # missing-module-docstring
|
||||
C0115, # missing-class-docstring
|
||||
C0116, # missing-function-docstring
|
9
python/CHANGELOG.md
Normal file
9
python/CHANGELOG.md
Normal file
@ -0,0 +1,9 @@
|
||||
# Changelog
|
||||
|
||||
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
|
90
python/README.md
Normal file
90
python/README.md
Normal file
@ -0,0 +1,90 @@
|
||||
# Python
|
||||
This folder (`python`) covers jobs for python development
|
||||
|
||||
|
||||
These jobs provides the following badge:
|
||||
|
||||
- `PyLint` - code quality [](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
|
||||
[](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
|
||||
|
||||
## License
|
||||
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
|
4
python/requirements.txt
Normal file
4
python/requirements.txt
Normal file
@ -0,0 +1,4 @@
|
||||
pylint==2.9.6
|
||||
pylint-gitlab==0.3.0
|
||||
gitpython==3.1.18
|
||||
commitizen==2.17.13
|
42
yaml_lint/.gitlab-ci.yml
Normal file
42
yaml_lint/.gitlab-ci.yml
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
.yaml_lint_defaults:
|
||||
variables:
|
||||
YAML_LINT_PATH: "/*.yml"
|
||||
YAML_LINT_CONFIG: "/yaml_lint/.yamllint.yaml"
|
||||
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/yaml_lint/requirements.txt
|
||||
- mkdir $PYTHON_VERSION
|
||||
script:
|
||||
- YAML_LINT_PATH=$ROOT_DIR$YAML_LINT_PATH
|
||||
- echo "[DEBUG] YAML_LINT_PATH[$YAML_LINT_PATH]"
|
||||
- YAML_LINT_CONFIG=$ROOT_DIR$YAML_LINT_CONFIG
|
||||
- echo "[DEBUG] YAML_LINT_CONFIG[$YAML_LINT_CONFIG]"
|
||||
- yamllint $YAML_LINT_PATH -f parsable -c $ROOT_DIR/yaml_lint/.yamllint.yaml > "$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: '$CI_COMMIT_BRANCH'
|
||||
when: always
|
||||
- when: never
|
||||
|
26
yaml_lint/.yamllint.yaml
Normal file
26
yaml_lint/.yamllint.yaml
Normal file
@ -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
|
7
yaml_lint/CHANGELOG.md
Normal file
7
yaml_lint/CHANGELOG.md
Normal file
@ -0,0 +1,7 @@
|
||||
# Changelog
|
||||
|
||||
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
|
52
yaml_lint/README.md
Normal file
52
yaml_lint/README.md
Normal file
@ -0,0 +1,52 @@
|
||||
# Yaml Lint
|
||||
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: "roles/"
|
||||
YAML_LINT_CONFIG: ".yamllint.yaml"
|
||||
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* |
|
||||
| YAML_LINT_CONFOG | *The path you have stored the yaml config file in* |
|
||||
|
||||
|
||||
## 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
|
||||
|
||||
## License
|
||||
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
|
2
yaml_lint/requirements.txt
Normal file
2
yaml_lint/requirements.txt
Normal file
@ -0,0 +1,2 @@
|
||||
yamllint
|
||||
ansible-lint-to-junit-xml
|
Reference in New Issue
Block a user