102 Commits

Author SHA1 Message Date
Jon
e9b5925be3 feat(mkdocs): add plugin mkdocstrings to mkdocs pip requirements
!83 nofusscomputing/infrastructure/website-template!16 nofusscomputing/projects/django_template#57 nofusscomputing/projects/django_template!27
2024-06-15 23:47:49 +09:30
Jon
a24f352ca3 Merge branch 'nfc_firewall_collection' into 'development'
feat: Nfc firewall collection

See merge request nofusscomputing/projects/gitlab-ci!82
2024-03-16 11:31:58 +00:00
Jon
9492699abd refactor: updated nfc_firewall role to collection
!82 nofusscomputing/projects/ansible/firewall!19
2024-03-16 21:00:26 +09:30
Jon
9afa68d1f3 Merge branch 'collection_kubernetes' into 'development'
feat: Collection kubernetes repo update

See merge request nofusscomputing/projects/gitlab-ci!81
2024-03-14 12:43:09 +00:00
Jon
bd5c300d9d feat: add phpipam collection project
!81
2024-03-13 21:18:58 +09:30
Jon
582fa67ea5 feat: update kubernetes collection path
!81 nofusscomputing/projects/ansible/collections/kubernetes!37
2024-03-13 21:18:29 +09:30
Jon
41eeb7badd fix(ansible_collection): custom release actions to be shell script
use a shell script for the custom commands to prevent the var from expansion/parsing

!80 nofusscomputing/projects/ansible/collections/phpipam_scan_agent#14 nofusscomputing/projects/ansible/collections/phpipam_scan_agent!13
2024-02-25 18:58:44 +09:30
Jon
6f80ea3af7 feat(ansible_collection): custom release actions
enables commands to be ran before the git commit and git tag

!80
2024-02-24 15:57:25 +09:30
Jon
4f65bc1367 feat(ansible_collection): allow trigger from web interface
!80
2024-02-23 18:33:49 +09:30
Jon
8094694d43 feat(deploy): add itil runbooks
fixes #47
2024-02-23 12:17:56 +09:30
Jon
f987f9e4f0 feat(ansible_collection): for package use galaxy link
!80
2024-02-23 12:17:39 +09:30
Jon
b329eedd00 feat(ansible_collection): add dockerhub link
!80
2024-02-23 12:11:31 +09:30
Jon
34c81c9849 Merge branch 'ansible-collectio-specify-bump-increment' into 'development'
fix(ansible_collection): specify version for changelog

See merge request nofusscomputing/projects/gitlab-ci!80
2024-02-22 09:50:23 +00:00
Jon
8265977c7f fix(ansible_collection): version project label description
!80
2024-02-22 19:19:00 +09:30
Jon
d30abfdb73 fix(ansible_collection): specify version for changelog
!80
2024-02-22 19:17:44 +09:30
Jon
c7c966bbee Merge branch 'ansible-collectio-specify-bump-increment' into 'development'
fix(ansible_collection): syntax error in label command

See merge request nofusscomputing/projects/gitlab-ci!79
2024-02-22 08:31:30 +00:00
Jon
e6ba068b68 fix(ansible_collection): syntax error in label command
!79
2024-02-22 18:00:02 +09:30
Jon
74ac15925c Merge branch 'ansible-collectio-specify-bump-increment' into 'development'
feat(ansible_collection): Create project label matching version on release create

See merge request nofusscomputing/projects/gitlab-ci!78
2024-02-22 08:01:10 +00:00
Jon
21db41bae1 feat(ansible_collection): Create project label matching version on release create
!78
2024-02-22 17:29:48 +09:30
Jon
e046f9ea49 Merge branch 'ansible-collectio-specify-bump-increment' into 'development'
feat: Ansible collection specify bump increment

See merge request nofusscomputing/projects/gitlab-ci!77
2024-02-22 06:27:38 +00:00
Jon
4a0fa49b3f feat(project): add ansible collection ci test
!77
2024-02-22 15:56:09 +09:30
Jon
03609e2c9d feat(ansible_collection): specify version increment
!77
2024-02-22 15:55:42 +09:30
Jon
d29064f149 Merge branch 'ansible-collections' into 'development'
feat: Ansible collections

See merge request nofusscomputing/projects/gitlab-ci!75
2024-02-17 04:46:46 +00:00
Jon
6bcd588da8 docs(ansible_collection): added.
!75
2024-02-17 14:13:47 +09:30
Jon
5eb34f87e5 fix: merging changes to master on full release
!75 nofusscomputing/projects/ansible/collections/ci-test!14
2024-02-17 12:42:27 +09:30
Jon
fe1fc844d5 fix: don't jam pipeline success for MR to master
!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-17 00:52:36 +09:30
Jon
d77fefd095 refactor(ansible_collection): git tag must be created after the change commit
!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-17 00:20:47 +09:30
Jon
d4c534b95a fix(ansible_collection): build change to git tag only on git tag
!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-17 00:13:11 +09:30
Jon
9841eebb9d feat(ansible_collection): rename job 'merge check' to 'create release'
!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-17 00:07:38 +09:30
Jon
c05c421425 fix(ansible_collection): build change to git tag only on git tag
!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-17 00:03:01 +09:30
Jon
be612d905c fix(ansible_collection): ensure before building git is on the tagged commit
!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-16 23:28:12 +09:30
Jon
1d67a0aa45 fix(ansible_collection): create git tag before changelog
required so that cz can properly generate changelog.

!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-16 22:46:17 +09:30
Jon
1716032215 fix(ansible_collection): use last commit message to locate merge request id
on merge the last commit on the branch is the merge request commit. use it to obtain the MR id for the bump commit message

!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-16 22:04:19 +09:30
Jon
82e7be6849 feat(ansible_collection): remove testing rule
rule removed as it was used for developing the ci file and job should only run on dev

!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-16 21:11:35 +09:30
Jon
dee50b4ba0 feat(ansible_collection): complete ci jobs for full workflow
!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-16 20:55:57 +09:30
Jon
5d333e994f feat(ansible_lint): enable option to force failure
will allow user to enforce a unit test if they wish

!75 nofusscomputing/projects/ansible/collections/ci-test!1
2024-02-16 20:53:47 +09:30
Jon
64f08b5d3d feat(ansible_collection): initial incomplete test jobs
not yet tested or finished.

!75
2024-02-16 20:49:10 +09:30
Jon
4b6c0ac9f7 feat(ansible_collection): initial incomplete ci jobs
not yet tested or finished.

!75
2024-02-16 03:43:49 +09:30
Jon
80a9e7f183 chore: add vscode defaults
!75
2024-02-16 03:42:26 +09:30
Jon
02252db664 Merge branch 'test-rules' into 'development'
feat(test): add ci jobs to test gitlab rules

See merge request nofusscomputing/projects/gitlab-ci!76
2024-02-15 13:45:45 +00:00
Jon
8f25d1a09e feat(test): add ci jobs to test gitlab rules
!76
2024-02-15 23:14:33 +09:30
Jon
bea398200f ci: add docker-glpi and kube_monitoring
!74
2024-02-02 22:38:55 +09:30
Jon
e1a7f60401 ci: use matrix job to update parent repos
!74
2024-02-02 22:01:00 +09:30
9b57371358 build(version): bump version 0.6.1 → 0.7.0rc0 2024-02-02 08:22:51 +00:00
Jon
fc9f37617c feat(sub_module_update): wbsite-template
!44
2024-02-02 17:47:38 +09:30
Jon
3fa71fe91a fix(mkdocs): correct mkdocs image name
!73
2024-02-02 17:04:34 +09:30
Jon
6700cdbc90 Merge branch 'mkdocs-update' into 'development'
feat: Mkdocs update

Closes #43

See merge request nofusscomputing/projects/gitlab-ci!73
2024-02-02 07:28:55 +00:00
Jon
955ce37520 refactor(mkdocs): set env name to gitlab pages
!73 fixes #43
2024-02-02 16:57:20 +09:30
Jon
3fbd4317c0 feat(mkdocs): update requirements.txt to current versions
!73 nofusscomputing/infrastructure/website-template!13 nofusscomputing/infrastructure/website!44
2024-02-02 16:45:19 +09:30
Jon
c4087c7069 feat(mkdocs): update python to 3.11.2
!73 nofusscomputing/infrastructure/website-template!13 nofusscomputing/infrastructure/website!44
2024-02-02 16:19:44 +09:30
Jon
bd22ff566c Merge branch '44-fix-commit-footer-refs' into 'development'
fix(commit_footer_refs): enable automated jobs without MR to succeed.

Closes #44

See merge request nofusscomputing/projects/gitlab-ci!72
2023-11-18 06:42:22 +00:00
Jon
0f6e06c50f fix(commit_footer_refs): enable automated jobs without MR to succeed.
automated jobs use !not for MR

fixes #44 !72
2023-11-18 16:11:26 +09:30
Jon
67199ccc55 Merge branch '42-fix-commit-foot-refs' into 'development'
fix(commit_footer_refs): dont update git submodules

Closes #42

See merge request nofusscomputing/projects/gitlab-ci!71
2023-11-12 05:03:22 +00:00
Jon
b8199586b4 fix(commit_footer_refs): dont update git submodules
this ci job requires only the gitlab-ci submodule with other submodules being not applicable.

!71 fixes #42 nofusscomputing/infrastructure/configuration-management/project-production!2
2023-11-12 14:30:53 +09:30
265bafde54 build(version): bump version 0.6.1rc8 → 0.6.1 2023-11-06 08:15:59 +00:00
Jon
5036fc1ccc Merge branch 'minor-fixes' into 'development'
chore: minor fixes

Closes #40

See merge request nofusscomputing/projects/gitlab-ci!70
2023-11-06 08:11:00 +00:00
Jon
3918686e48 feat(conventional_commits): do not run on master branch
!70 fixes #40
2023-11-06 17:36:55 +09:30
Jon
52f4ebda54 Merge branch '39-feat-git-submodule' into 'development'
feat: git submodule custome git message type

Closes #39

See merge request nofusscomputing/projects/gitlab-ci!69
2023-10-28 05:09:49 +00:00
Jon
8eb57c5809 feat(sub_module_update): enable passing commit type and category
!69 closes #39 nofusscomputing/projects/ansible/git_configuration!122 nofusscomputing/projects/gitlab-ci#39 nofusscomputing/projects/ansible/ansible-roles!96 nofusscomputing/infrastructure/config!28
2023-10-28 13:56:43 +09:30
Jon
a5a9fa4437 Merge branch '37-fix-builds' into 'development'
fix: builds

Closes #37

See merge request nofusscomputing/projects/gitlab-ci!68
2023-09-02 06:01:17 +00:00
Jon
86a0292faf feat(deploy): add new nfc repos
!68
2023-09-02 15:28:43 +09:30
Jon
535d0b4293 docs: update docker tag build
!68 #37
2023-09-02 15:28:43 +09:30
Jon
282128410d chore: remove commented code
!68 closes #37
2023-09-02 15:28:43 +09:30
Jon
837311c022 feat(release): annotate git tag with changelog
!68
2023-09-02 15:28:43 +09:30
Jon
e8758c4cce feat(build): no docs/docker build on master push, only tag
as a push to master branch is to create a release, no building should occur.

!68
2023-09-02 15:00:11 +09:30
Jon
0d7974152c feat(docker): add debugging to publish
required to determin if #36 is still an issue

!68 #36 nofusscomputing/projects/ansible/execution_environment#11
2023-09-02 14:53:10 +09:30
Jon
359c664d97 fix(docker): always build on tag
!68 fixes #37
2023-09-02 14:45:39 +09:30
Jon
975de7aca2 Merge branch 'chores-to-mr-pipeline' into 'development'
refactor: Chores to mr pipeline

See merge request nofusscomputing/projects/gitlab-ci!67
2023-07-04 02:01:23 +00:00
Jon
1a168593eb feat(deploy): added ansible.docker.os repo
!67
2023-07-04 11:30:38 +09:30
Jon
d21692f788 refactor(ansible): move submodule/issue patch to mr pipeline
!67
2023-07-04 11:27:23 +09:30
Jon
ebc3d93304 Merge branch 'fix-image-pull-policy' into 'development'
fix(build): adjust to enforce

See merge request nofusscomputing/projects/gitlab-ci!66
2023-06-28 04:30:30 +00:00
Jon
799de6c98c fix(build): adjust to enforce
!66
2023-06-28 13:58:19 +09:30
Jon
6a3ef23c61 Merge branch '38-fix-docker-build' into 'development'
feat(docker_publish): on merge to dev always publish

See merge request nofusscomputing/projects/gitlab-ci!65
2023-06-28 03:50:30 +00:00
Jon
9489c99fe4 feat(docker_publish): on merge to dev always publish
!65
2023-06-28 13:18:23 +09:30
Jon
fd570fa3df Merge branch '38-fix-docker-build' into 'development'
fix: docker build

See merge request nofusscomputing/projects/gitlab-ci!64
2023-06-28 03:12:52 +00:00
Jon
4ea999cec9 fix(docker): ensure on any changes to directory path, build occurs
!64 #38 nofusscomputing/projects/ansible/execution_environment!76
2023-06-28 12:40:27 +09:30
Jon
2492fdb17f Merge branch 'gitlab-issue-patch-automation' into 'development'
ci(deploy): added docker management repo

See merge request nofusscomputing/projects/gitlab-ci!63
2023-06-28 02:09:59 +00:00
Jon
f35d99dc43 ci(deploy): added docker management repo
!63
2023-06-28 11:37:51 +09:30
Jon
de2ec6a736 Merge branch 'gitlab-issue-patch-automation' into 'development'
fix(template): issue comment patch remove setting role path

See merge request nofusscomputing/projects/gitlab-ci!62
2023-06-28 02:06:45 +00:00
Jon
4da44b77df fix(template): issue comment patch remove setting role path
!62
2023-06-28 11:34:38 +09:30
Jon
cf33e1faf1 Merge branch 'gitlab-issue-patch-automation' into 'development'
feat: autojob mr from git patch found in gitlab issues

See merge request nofusscomputing/projects/gitlab-ci!61
2023-06-28 01:48:11 +00:00
Jon
da40e02737 feat(template): added auto job mr from issue comment patch
!61
2023-06-28 11:14:52 +09:30
Jon
d91605e377 Merge branch 'docs' into 'development'
docs: working on

See merge request nofusscomputing/projects/gitlab-ci!59
2023-06-15 04:22:50 +00:00
Jon
d9b303edc1 docs: expand
!59
2023-06-11 10:48:24 +09:30
1a03324ecc build(version): bump version 0.6.1rc7 → 0.6.1rc8 2023-06-08 05:41:34 +00:00
Jon
869faedf57 Merge branch 'fix-immediate' into 'development'
docs: added notes

See merge request nofusscomputing/projects/gitlab-ci!58
2023-06-08 05:37:59 +00:00
Jon
469255f450 docs: added notes
!58
2023-06-08 15:06:24 +09:30
Jon
606b19151e Merge branch 'fix-immediate' into 'development'
fix(ci): correct dockerhub tag

See merge request nofusscomputing/projects/gitlab-ci!57
2023-06-08 05:03:58 +00:00
Jon
4462ec0426 fix(lint): all lint to immediatly start job
!57
2023-06-08 14:27:04 +09:30
Jon
9b00af996f fix(ci): correct dockerhub tag
!57
2023-06-08 14:24:27 +09:30
Jon
ae8b936c5d Merge branch 'fix-immediate' into 'development'
fix(ci): remove spaces from regex exists and changes

See merge request nofusscomputing/projects/gitlab-ci!56
2023-06-08 03:45:19 +00:00
Jon
6af454be4d fix(ci): remove spaces from regex exists and changes
!56
2023-06-08 13:13:50 +09:30
Jon
0054a21e19 Merge branch 'fix-immediate' into 'development'
fix: immediate

Closes #33

See merge request nofusscomputing/projects/gitlab-ci!55
2023-06-08 02:37:25 +00:00
Jon
46d85bcf49 fix(ansible_lint): enable first level dir paths
!55
2023-06-08 12:04:19 +09:30
Jon
0ec520f023 feat(ci): add resource groups
!55 fixes #33
2023-06-07 16:50:45 +09:30
Jon
e75464c7c4 feat(sync): immediatee git sync
!55
2023-06-07 15:40:24 +09:30
Jon
755fcac06e feat(latest_artifacts): ensure artifats for jobs are always avail on branches
if the job is not available on the branches last run pipeline, any job
that tries to download the latest artifact by name will not find any
artifacts.

!54 See nofusscomputing/projects/gitlab-ci#34 gitlab-org/gitlab#331232
2023-06-07 13:37:51 +09:30
Jon
11b6209992 fix(docker_build): on success push container to docker hub
!53
2023-06-07 13:37:51 +09:30
Jon
0b5680deac Merge branch 'fix-immediate' into 'development'
fix(docker_build) init submodule submodules

See merge request nofusscomputing/projects/gitlab-ci!53
2023-06-07 03:47:37 +00:00
Jon
e90b938bba fix(docker_build): init submodule submodules
due to commit e2852ebe292bc838d95048515a8dca0d93ccbc24 the submodules submodules are not being initialized, which prevents that repos files from being used.

!53
2023-06-07 13:15:00 +09:30
Jon
f5bd9acebc Merge branch '34-workaround-job-not-available' into 'development'
refactor: latest job artifacts as specified by name are not available

See merge request nofusscomputing/projects/gitlab-ci!52
2023-06-07 03:23:47 +00:00
Jon
22dd4985be feat(latest_artifacts): ensure artifats for jobs are always avail on branches
if the job is not available on the branches last run pipeline, any job
that tries to download the latest artifact by name will not find any
artifacts.

!52 See nofusscomputing/projects/gitlab-ci#34 gitlab-org/gitlab#331232
2023-06-07 12:50:58 +09:30
35 changed files with 1925 additions and 252 deletions

View File

@ -4,4 +4,4 @@ commitizen:
name: cz_conventional_commits
tag_format: $major.$minor.$patch$prerelease
update_changelog_on_bump: true
version: 0.6.1rc7
version: 0.7.0rc0

View File

@ -19,6 +19,8 @@ include:
- local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/lint/markdown.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/python/.gitlab-ci.yml
# - local: $JOB_ROOT_DIR/test/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/ansible/collection/ci-test.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
#- template: Security/License-Scanning.gitlab-ci.yml
@ -119,55 +121,29 @@ gilab-ci.yml Lint (python 3.11):
image: python:3.11-slim
Ansible_playbooks.Submodule.Deploy:
Update Sub Repo:
extends: .submodule_update_trigger
variables:
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_playbooks
Ansible-roles.Submodule.Deploy:
extends: .submodule_update_trigger
variables:
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible-roles
config.Submodule.Deploy:
extends: .submodule_update_trigger
variables:
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/config
Docker_Mail.Submodule.Deploy:
extends: .submodule_update_trigger
variables:
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-mail
docker-buildx-qemu.Submodule.Deploy:
extends: .submodule_update_trigger
variables:
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-buildx-qemu
execution_environment.Submodule.Deploy:
extends: .submodule_update_trigger
variables:
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/execution_environment
git_configuration.Submodule.Deploy:
extends: .submodule_update_trigger
variables:
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/git_configuration
Ops.Submodule.Deploy:
extends: .submodule_update_trigger
variables:
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/ops
Website.Submodule.Deploy:
extends: .submodule_update_trigger
variables:
SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/website
parallel:
matrix:
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/ops
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/configuration-management/itil_runbooks
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/infrastructure/website
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_playbooks
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible-roles
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_docker_os
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/ansible_test
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/ci-test
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/firewall
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/kubernetes
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/collections/phpipam_scan_agent
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/common
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/docker_management
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/execution_environment
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/git_configuration
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/homeassistant
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/ansible/nfc_glpi
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-bind
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-mail
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-buildx-qemu
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/docker-glpi
- SUBMODULE_UPDATE_TRIGGER_PROJECT: nofusscomputing/projects/kubernetes_monitoring

9
.vscode/extensions.json vendored Normal file
View File

@ -0,0 +1,9 @@
{
"recommendations": [
"gitlab.gitlab-workflow",
"jebbs.markdown-extended",
"redhat.vscode-yaml",
"streetsidesoftware.code-spell-checker",
"streetsidesoftware.code-spell-checker-australian-english"
]
}

5
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,5 @@
{
"gitlab.aiAssistedCodeSuggestions.enabled": false,
"gitlab.duoChat.enabled": false,
"cSpell.language": "en-AU,en"
}

View File

@ -1,3 +1,77 @@
## 0.7.0rc0 (2024-02-02)
### Bug Fixes
- **mkdocs**: [3fa71fe9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3fa71fe91ad1e874b76fab7323e02496ac757f5d) - correct mkdocs image name [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) ]
- **commit_footer_refs**: [0f6e06c5](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0f6e06c50f7cae602cdc2ca00bbce7fe1fd72c32) - enable automated jobs without MR to succeed. [ [#44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/44) [!72](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/72) ]
- **commit_footer_refs**: [b8199586](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b8199586b4fe4c9f93efe68a908eaa8582f064c3) - dont update git submodules [ [!71](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/71) [#42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/42) [!2](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/2) ]
### Code Refactor
- **mkdocs**: [955ce375](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/955ce3752050e78085c2037fe66714db41114c9e) - set env name to gitlab pages [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) [#43](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/43) ]
### Features
- **sub_module_update**: [fc9f3761](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fc9f37617cd26b3e44326161ba10183eb13444dd) - wbsite-template [ [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ]
- **mkdocs**: [3fbd4317](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3fbd4317c0388fb8e406eb78614e3943375496ed) - update requirements.txt to current versions [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ]
- **mkdocs**: [c4087c70](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/c4087c7069524df573a43db29c399940600ddba7) - update python to 3.11.2 [ [!73](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/73) [!13](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/13) [!44](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/44) ]
## 0.6.1 (2023-11-06)
### Bug Fixes
- **docker**: [359c664d](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/359c664d97c516bd3b35fb46961288c74f6bd940) - always build on tag [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) [#37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/37) ]
- **build**: [799de6c9](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/799de6c98c0925ef4a85cf246512041fc89534db) - adjust to enforce [ [!66](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/66) ]
- **docker**: [4ea999ce](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4ea999cec96824c2670c5d448dff8c06b1582adc) - ensure on any changes to directory path, build occurs [ [!64](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/64) [#38](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/38) [!76](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/76) ]
- **template**: [4da44b77](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4da44b77dfbc015d28fda34fcfe54d70a6542943) - issue comment patch remove setting role path [ [!62](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/62) ]
### Code Refactor
- **ansible**: [d21692f7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d21692f7886986db1808befb00b045c1a9a65a8f) - move submodule/issue patch to mr pipeline [ [!67](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/67) ]
### Continious Integration
- **deploy**: [f35d99dc](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/f35d99dc436d1e9ab200a8b94052de2fa23608fc) - added docker management repo [ [!63](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/63) ]
### Documentaton / Guides
- [535d0b42](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/535d0b42938fc66f94fd57018dd81e2111ad3abe) - update docker tag build [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) [#37](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/37) ]
- [d9b303ed](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d9b303edc1f61f1d7a4785b5b5396625cc98a179) - expand [ [!59](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/59) ]
### Features
- **conventional_commits**: [3918686e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/3918686e483f6fabb6c487be6f2d7105da08d11a) - do not run on master branch [ [!70](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/70) [#40](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/40) ]
- **sub_module_update**: [8eb57c58](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8eb57c580973fa49bd3ffb12553cc24e39c5afac) - enable passing commit type and category [ [!69](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/69) [#39](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/39) [!122](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/122) [#39](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/39) [!96](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/96) [!28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/28) ]
- **deploy**: [86a0292f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/86a0292fafa0fb139f068106dacfa2ee6917f4d4) - add new nfc repos [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) ]
- **release**: [837311c0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/837311c0221820b93072e9bfcba2191a8b96b9ea) - annotate git tag with changelog [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) ]
- **build**: [e8758c4c](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e8758c4ccecdbf0c22a5e67bf086762c68c6b915) - no docs/docker build on master push, only tag [ [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) ]
- **docker**: [0d797415](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0d7974152c26200c8beaa3a1ddecf504f4406ee3) - add debugging to publish [ [#36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/36) [!68](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/68) [#36](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/36) [#11](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/11) ]
- **deploy**: [1a168593](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1a168593eb0fd234885982a16bc216804e76d293) - added ansible.docker.os repo [ [!67](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/67) ]
- **docker_publish**: [9489c99f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9489c99fe489c9b9b9e29fc2013d5ff6a990094a) - on merge to dev always publish [ [!65](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/65) ]
- **template**: [da40e027](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/da40e027376c163ca4915f3edcf322b6e0b0c278) - added auto job mr from issue comment patch [ [!61](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/61) ]
## 0.6.1rc8 (2023-06-08)
### Bug Fixes
- **lint**: [4462ec04](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/4462ec04268c5b967f0672828d1cd7b3995894d9) - all lint to immediatly start job [ [!57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/57) ]
- **ci**: [9b00af99](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9b00af996ff96f58a26b83066004e5a9e94ac155) - correct dockerhub tag [ [!57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/57) ]
- **ci**: [6af454be](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6af454be4d2b658e0c362392ff502b3fb3da2cbf) - remove spaces from regex exists and changes [ [!56](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/56) ]
- **ansible_lint**: [46d85bcf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46d85bcf49ea73545a5af4324c28af51a17acd3c) - enable first level dir paths [ [!55](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/55) ]
- **docker_build**: [11b62099](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/11b6209992294e45a051e26963d772d75014e516) - on success push container to docker hub [ [!53](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/53) ]
- **docker_build**: [e90b938b](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e90b938bba092bdaecbc1a43758218da0058427b) - init submodule submodules [ [!53](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/53) ]
### Documentaton / Guides
- [469255f4](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/469255f450e946a712d379415e45a74eb8c07995) - added notes [ [!58](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/58) ]
### Features
- **ci**: [0ec520f0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0ec520f02328b69642f929a19e8517c7d475a988) - add resource groups [ [!55](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/55) [#33](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/33) ]
- **sync**: [e75464c7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e75464c7c409fd17864624d48c9fec8e6e3544e9) - immediatee git sync [ [!55](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/55) ]
- **latest_artifacts**: [755fcac0](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/755fcac06e9f265789b02a88eb90df35ab1dbf07) - ensure artifats for jobs are always avail on branches [ [!54](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/54) [#34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/34) [#331232](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/331232) ]
- **latest_artifacts**: [22dd4985](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/22dd4985be315be95be55b2b4edff5ae4ba1eeb4) - ensure artifats for jobs are always avail on branches [ [!52](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/merge_requests/52) [#34](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/34) [#331232](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/issues/331232) ]
## 0.6.1rc7 (2023-06-05)
### Bug Fixes

View File

@ -0,0 +1,662 @@
---
variables:
ANSIBLE_GALAXY_UPLOAD_TOKEN: "" # Mandatory, String. The token to upload to ansible galaxy. DONT SET HERE, USE PIPELINE VARIABLES.
ANSIBLE_GALAXY_SERVER_URL: https://galaxy.ansible.com # Optional, default=(as displayed)String. URL to the Galaxy server for uploads
ANSIBLE_GALAXY_NAMESPACE: "" # Mandatory, String. The ansible galaxy upload namespace
ANSIBLE_GALAXY_PACKAGE_NAME: "" # Mandatory, String. The Ansible Galaxy package name
.ansible_collection_merge:
stage: chores
image: python:3.11-bookworm
before_script:
- | # Create artifact directory
mkdir -p artifacts
- | # Install Pre-req packages
apt update;
apt install -y --no-install-recommends \
curl \
git;
# ToDo: Install python deps
- |
pip install \
commitizen==3.14.1
- | # setup git user
git config --global user.email "helpdesk@nofusscomputing.com";
git config --global user.name "nfc_bot";
- | # Update origin using gitlab token
echo "Current git origin";
git remote -v;
git remote remove origin;
echo "Removed origin";
git remote add origin https://gitlab-ci-token:$GIT_COMMIT_TOKEN@gitlab.com/$CI_PROJECT_PATH.git;
echo "Add origin with auth";
git remote -v;
- | # fetch repo details
git fetch -fpv;
- | # switch to dev branch
git switch development;
- | # pull dev branch
git pull origin development --rebase
- | # Init git sub-modules
git submodule update --init
script:
- | # Store old version number
export OLD_VERSION=$(cz version --project);
echo "Trace - OLD_VERSION[$OLD_VERSION]"
# rc codes https://commitizen-tools.github.io/commitizen/exit_codes/
- | # Bump the version
if [ "0${VERSION_BUMP_INCREMENT}" != '0' ]; then
export BUMP_INCREMENT="--increment ${VERSION_BUMP_INCREMENT}";
fi;
if [ $CI_COMMIT_BRANCH == "development" ]; then
cz bump \
--files-only \
--yes \
${BUMP_INCREMENT} \
--prerelease alpha \
export VERSION_BUMPED=$?
elif [ $CI_COMMIT_BRANCH == "master" ]; then
cz bump \
--files-only \
${BUMP_INCREMENT} \
--yes
export VERSION_BUMPED=$?
else
echo "Something went wrong with creating the release";
exit 1;
fi;
echo "Trace - VERSION_BUMPED[$VERSION_BUMPED]"
- | # Store new version number
if [ "0$VERSION_BUMPED" == "00" ]; then
export NEW_VERSION=$(cz version --project)
echo "Trace - NEW_VERSION[$NEW_VERSION]"
fi;
- | # git stage .cz.yaml
if [ "0$VERSION_BUMPED" == "00" ]; then
git add .cz.yaml;
echo "git staged .cz.yaml";
git status;
fi;
- | # Update version in galaxy file
if [ "0$VERSION_BUMPED" == "00" ]; then
sed -E "s/version: (.+)/version: ${NEW_VERSION}/g" -i galaxy.yml
fi;
- | # git stage galaxy.yml
if [ "0$VERSION_BUMPED" == "00" ]; then
git add galaxy.yml
echo "git staged galaxy.yml";
git status;
fi;
- | # changelog since last version - for development branch
echo "changelog since last version - for development branch";
if [ "0$VERSION_BUMPED" == "00" ]; then
cz changelog --incremental --dry-run --unreleased-version "${NEW_VERSION}" > artifacts/incremental_changelog.txt
ls -lR artifacts/
fi;
- | # store incremental changelog since last version
echo "store incremental changelog since last version";
if [ "0$VERSION_BUMPED" == "00" ]; then
curl \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file artifacts/incremental_changelog.txt \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/incremental_changelog.txt"
fi;
- | # complete changelog since last normal release - for master branch
echo "complete changelog since last normal release - for master branch";
if [ "0$VERSION_BUMPED" == "00" ]; then
cz changelog --merge-prerelease --dry-run --unreleased-version "${NEW_VERSION}" > artifacts/full_changelog.txt
fi;
- | # store full changelog (merge-prerelease)
if [ "0$VERSION_BUMPED" == "00" ]; then
curl \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file artifacts/full_changelog.txt \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/full_changelog.txt"
fi;
- | # Update CHANGELOG.md
if [ "0$VERSION_BUMPED" == "00" ]; then
if [ $CI_COMMIT_BRANCH == "development" ]; then
cz changelog --incremental --unreleased-version "${NEW_VERSION}";
elif [ $CI_COMMIT_BRANCH == "master" ]; then
cz changelog --merge-prerelease --unreleased-version "${NEW_VERSION}";
else
echo "This job should only run on 'development' and 'master' branches";
exit 1;
fi;
fi;
- | # Create release notes
if [ "0$VERSION_BUMPED" == "00" ]; then
if [ $CI_COMMIT_BRANCH == "development" ]; then
cp artifacts/incremental_changelog.txt artifacts/release_notes.md
elif [ $CI_COMMIT_BRANCH == "master" ]; then
cp artifacts/full_changelog.txt artifacts/release_notes.md
else
echo "This job should only run on 'development' and 'master' branches";
exit 1;
fi;
fi;
- | # Store Release notes
curl \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file artifacts/release_notes.md \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/release_notes.md";
- | # git stage CHANGELOG.md
if [ "0$VERSION_BUMPED" == "00" ]; then
git add CHANGELOG.md;
echo "git staged CHANGELOG.md";
git status;
fi;
- | # Custom commands from RELEASE_ADDITIONAL_ACTIONS_BUMP
if [ -f ${RELEASE_ADDITIONAL_ACTIONS_BUMP} ]; then
echo "Custom commands found in variable RELEASE_ADDITIONAL_ACTIONS_BUMP";
chmod +x ${RELEASE_ADDITIONAL_ACTIONS_BUMP};
echo '------------------------------ TRACE SoF ------------------------------';
echo "File: RELEASE_ADDITIONAL_ACTIONS_BUMP[${RELEASE_ADDITIONAL_ACTIONS_BUMP}]";
echo '------ contents ------';
echo "";
cat ${RELEASE_ADDITIONAL_ACTIONS_BUMP};
echo "";
echo '------ contents ------';
echo "";
${RELEASE_ADDITIONAL_ACTIONS_BUMP};
echo "";
echo "git reset edited file: ${RELEASE_ADDITIONAL_ACTIONS_BUMP}";
git restore ${RELEASE_ADDITIONAL_ACTIONS_BUMP};
git status
echo '------------------------------ TRACE EoF ------------------------------'
fi;
# - | # Find merge request ID
# echo "Trace CI_OPEN_MERGE_REQUESTS[${CI_OPEN_MERGE_REQUESTS}]";
# if grep -q "," <<< "$CI_OPEN_MERGE_REQUESTS"; then
# export MERGE_REQUEST_FOUND=$(echo "${CI_OPEN_MERGE_REQUESTS}" | cut -d "," -f 1 | cut -d '!' -f 2);
# else
# export MERGE_REQUEST_FOUND=$(echo "${CI_OPEN_MERGE_REQUESTS}" | cut -d '!' -f 2);
# fi
# echo "Trace MERGE_REQUEST_FOUND[${MERGE_REQUEST_FOUND}]";
# if [ "$CI_MERGE_REQUEST_IID" ]; then
# export MERGE_REQUEST_FOUND=${CI_MERGE_REQUEST_IID}
# echo "Using CI_MERGE_REQUEST_IID[${CI_MERGE_REQUEST_IID}] as value for MERGE_REQUEST_FOUND";
# fi
- | # Find merge request ID
echo "Trace CI_OPEN_MERGE_REQUESTS[${CI_OPEN_MERGE_REQUESTS}]";
echo "Trace CI_MERGE_REQUEST_IID[${CI_MERGE_REQUEST_IID}]";
export MERGE_REQUEST_FOUND=$(git log -1 | grep -E '\!(.+)' | cut -d '!' -f 2);
echo "Trace MERGE_REQUEST_FOUND[${MERGE_REQUEST_FOUND}]";
- | # commit any changes
if [ "0$VERSION_BUMPED" == "00" ]; then
git status;
echo "commit changes to repo"
cat <<EOF | git commit -F-
build: bump version ${OLD_VERSION} -> ${NEW_VERSION}
!${MERGE_REQUEST_FOUND}
EOF
fi;
- | # Store the changes commit for the tag
export CHANGE_COMMIT=$(git log -n1 --format=format:"%H")
echo "Trace - CHANGE_COMMIT[$CHANGE_COMMIT]"
if [ "${CI_COMMIT_SHA}" == "${CHANGE_COMMIT}" ]; then
echo "No changes appear to have been commited!"
exit 1;
fi;
git log -3;
- | # create git tag, if changed
if [ "0$VERSION_BUMPED" == "00" ]; then
git tag -m "$(cat artifacts/incremental_changelog.txt)" ${NEW_VERSION} ${CHANGE_COMMIT};
fi;
- | # push development to origin
if [ "0$VERSION_BUMPED" == "00" ]; then
git push --set-upstream origin development
fi;
- | # merge bump changes to master
if [ "0$VERSION_BUMPED" == "00" ]; then
if [ $CI_COMMIT_BRANCH == "master" ]; then
echo "Trace Checkout master branch";
git checkout master;
echo "Trace merge changes from development branch";
git merge --no-ff development;
echo "Trace push changes to origin";
git push origin master;
fi;
fi;
- | # store metadata for use in later stages
if [ "0$VERSION_BUMPED" == "00" ]; then
cat <<EOF > artifacts/metadata.env
export CHANGE_COMMIT=${CHANGE_COMMIT}
export MERGE_REQUEST_FOUND=${MERGE_REQUEST_FOUND}
export NEW_VERSION=${NEW_VERSION}
export OLD_VERSION=${CURRENT_VERSION}
export VERSION_BUMPED=${VERSION_BUMPED}
EOF
chmod +x artifacts/metadata.env;
curl \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file artifacts/metadata.env \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${NEW_VERSION}/metadata.env";
fi;
- | # Create Version Label
if [ "$CREATE_VERSION_LABEL" != "false" ]; then
curl \
--data "name=v${NEW_VERSION}&color=#eee600&description=Version%20that%20is%20affected" \
--header "PRIVATE-TOKEN: $GIT_COMMIT_TOKEN" \
"https://gitlab.com/api/v4/projects/${CI_PROJECT_ID}/labels"
fi;
- | # push git tag to origin
if [ "0$VERSION_BUMPED" == "00" ]; then
git push --tags
fi;
artifacts:
untracked: false
when: always
expire_in: "3 days"
paths:
- "artifacts/*"
rules:
- if: "$CI_COMMIT_AUTHOR =='nfc_bot <helpdesk@nofusscomputing.com>'"
when: never
- if: # Occur on merge
$CI_COMMIT_BRANCH == "development"
&&
$CI_PIPELINE_SOURCE == "push"
allow_failure: true
when: manual
- if: # Occur on merge
$CI_COMMIT_BRANCH == "master"
&&
(
$CI_PIPELINE_SOURCE == "push"
||
$CI_PIPELINE_SOURCE == "web"
)
when: always
- when: never
# Feature Branch / git tag
.ansible_collection_build:
stage: build
image: python:3.11-bookworm
before_script:
- | # Exit if mandatory variables not defined. On the first job in the pipeline for release.
if [ "$CI_COMMIT_TAG" ]; then
if [ "0$ANSIBLE_GALAXY_UPLOAD_TOKEN" == "0" ]; then
echo variable ANSIBLE_GALAXY_UPLOAD_TOKEN must be set;
exit 1;
fi;
if [ "0$ANSIBLE_GALAXY_NAMESPACE" == "0" ]; then
echo variable ANSIBLE_GALAXY_NAMESPACE must be set;
exit 1;
fi;
if [ "0$ANSIBLE_GALAXY_PACKAGE_NAME" == "0" ]; then
echo variable ANSIBLE_GALAXY_PACKAGE_NAME must be set;
exit 1;
fi;
fi
- | # Install python deps
pip install \
ansible==9.2.0
- | # Setup git to be on the tagged commit
if [ "${CI_COMMIT_TAG}" ]; then
echo "setting up git to be on revision ${CI_COMMIT_TAG}";
git log -2;
git fetch -fpvt;
git pull origin development --rebase;
git checkout tags/${CI_COMMIT_TAG} -b development;
git log -2;
fi;
script:
- | # Build the collection
ansible-galaxy collection build . --verbose --force --output-path artifacts/galaxy/
artifacts:
untracked: false
when: on_success
expire_in: "3 days"
paths:
- "artifacts/*"
rules:
- if: $CI_COMMIT_TAG
when: on_success
- if: "$CI_COMMIT_AUTHOR =='nfc_bot <helpdesk@nofusscomputing.com>'"
when: never
- if: # Occur on merge
$CI_COMMIT_BRANCH == "development"
&&
$CI_PIPELINE_SOURCE == "push"
when: always
- if:
$CI_COMMIT_BRANCH != "development"
&&
$CI_COMMIT_BRANCH != "master"
&&
$CI_PIPELINE_SOURCE == "push"
when: always
- when: never
# store built package in generic package registry
.ansible_collection_stage_package:
stage: prepare
image: curlimages/curl:latest
variables:
GIT_STRATEGY: none
environment:
name: Gitlab Package Registry
url: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/
script:
- | # Store collection
curl \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
--upload-file artifacts/galaxy/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz \
"${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz"
- | # Fetch Release Notes
mkdir -p artifacts;
curl \
--header "JOB-TOKEN: $CI_JOB_TOKEN" \
-o artifacts/release_notes.md \
${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/${CI_PROJECT_NAME}/${CI_COMMIT_TAG}/release_notes.md
echo "Release notes fetched";
ls -lR artifacts/
artifacts:
untracked: false
when: on_success
expire_in: "3 days"
paths:
- "artifacts/*"
rules:
- if: $CI_COMMIT_TAG
when: on_success
- when: never
# Only on git tag
.ansible_collection_release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
variables:
GIT_STRATEGY: none
script:
- ls -lR artifacts/
release:
tag_name: $CI_COMMIT_TAG
description: ./artifacts/release_notes.md
name: $CI_COMMIT_TAG
assets:
links:
- name: 'Ansible Galaxy'
url: https://galaxy.ansible.com/ui/repo/published/${ANSIBLE_GALAXY_NAMESPACE}/${ANSIBLE_GALAXY_PACKAGE_NAME}/?version=${CI_COMMIT_TAG}
- name: ${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz
url: https://galaxy.ansible.com/api/v3/plugin/ansible/content/published/collections/artifacts/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz
link_type: package
- name: 'Docker Image: ${DOCKER_IMAGE_PUBLISH_REGISTRY}/${DOCKER_IMAGE_PUBLISH_NAME}:${CI_COMMIT_TAG}'
url: ${DOCKER_IMAGE_PUBLISH_URL}
link_type: package
- name: Documentation
url: https://nofusscomputing.com/${PAGES_ENVIRONMENT_PATH}
milestones:
- $CI_MERGE_REQUEST_MILESTONE
rules:
- if: $CI_COMMIT_TAG
when: on_success
- when: never
# Only on git tag
.ansible_collection_publish_galaxy:
stage: publish
image: python:3.11-bookworm
variables:
GIT_STRATEGY: none
ANSIBLE_GALAXY_SERVER_URL: https://galaxy.ansible.com
environment:
name: Ansible Galaxy
url: https://galaxy.ansible.com/ui/repo/published/${ANSIBLE_GALAXY_NAMESPACE}/${ANSIBLE_GALAXY_PACKAGE_NAME}/
before_script:
- | # Install python deps
pip install \
ansible
pip list;
- | # Prepare filename for package
# mkdir -p artifacts/galaxy;
# mv collection.tar.gz artifacts/galaxy/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz
# echo "Prepare filename to be in the correct format";
ls -lR artifacts;
script:
- | # Publish package to Ansible Galaxy
ansible-galaxy collection publish \
--server ${ANSIBLE_GALAXY_SERVER_URL} \
--token ${ANSIBLE_GALAXY_UPLOAD_TOKEN} \
--verbose artifacts/galaxy/${ANSIBLE_GALAXY_NAMESPACE}-${ANSIBLE_GALAXY_PACKAGE_NAME}-${CI_COMMIT_TAG}.tar.gz
artifacts:
untracked: false
when: on_success
expire_in: "3 days"
paths:
- "artifacts/*"
rules:
- if: $CI_COMMIT_TAG
when: on_success
- when: never

View File

@ -0,0 +1,63 @@
# Ansible Collection Unit Test: # what would the unit tests be??
# stage: test
# before_script:
# - echo. #install deps
# script:
# - echo. # what????
Ansible Collection Functional Test:
stage: test
# ToDo: refactor lint jobs to be individual so that pipeline linking can occur
# needs:
# - Ansible Collection CI Lint
parallel:
matrix:
- NFC_CI_FUNCTIONAL_TEST: "push"
NFC_CI_FUNCTIONAL_TEST_BRANCH: feature
- NFC_CI_FUNCTIONAL_TEST: "merge"
NFC_CI_FUNCTIONAL_TEST_BRANCH: development
- NFC_CI_FUNCTIONAL_TEST: "release"
NFC_CI_FUNCTIONAL_TEST_BRANCH: development
- NFC_CI_FUNCTIONAL_TEST: "push"
NFC_CI_FUNCTIONAL_TEST_BRANCH: development
- NFC_CI_FUNCTIONAL_TEST: "merge"
NFC_CI_FUNCTIONAL_TEST_BRANCH: master
script:
- echo "to be created";
# ToDo: run ansible playbook to setup, run and wait for each stage
# ToDo: create build artifact for use with creating a badge for tests, per branch
artifacts:
untracked: true
when: on_success
expire_in: "90 days"
resource_group: ansible_collection_functional_test
rules:
# turn off until created
- when: never
- if: # development/feature branch
$CI_COMMIT_BRANCH != "master" &&
$CI_PIPELINE_SOURCE == "push"
changes:
paths:
- 'ansible/collection/*.yml'
compare_to: 'development'
when: always
- if: # master branch
$CI_COMMIT_BRANCH == "master" &&
$CI_PIPELINE_SOURCE == "push"
when: always

View File

@ -8,7 +8,7 @@ include:
.ansible_playbook:
image:
name: nofusscomputing/ansible-ee:dev
pull_policy: [always]
pull_policy: always
stage: chores
variables:
ansible_inventory: ''
@ -93,8 +93,10 @@ include:
when: always
- if: # condition_dev_branch_push
$CI_COMMIT_TAG == null &&
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" &&
$CI_PIPELINE_SOURCE != "push"
exists:
- ".nfc_automation.yaml"
when: always
@ -126,6 +128,8 @@ include:
--form ref=development \
--form "variables[GIT_CONFIG_SUBMODULE_NAME]=$GIT_CONFIG_SUBMODULE_NAME" \
--form "variables[PIPELINE_RUN_TRIGGER]=$PIPELINE_RUN_TRIGGER" \
--form "variables[GIT_COMMIT_TYPE]=$GIT_COMMIT_TYPE" \
--form "variables[GIT_COMMIT_TYPE_CATEGORY]=$GIT_COMMIT_TYPE_CATEGORY" \
"https://gitlab.com/api/v4/projects/$TRIGGER_PROJECT_PATH/trigger/pipeline"
environment:
name: $SUBMODULE_UPDATE_TRIGGER_PROJECT
@ -144,3 +148,27 @@ include:
when: on_success
- when: never
.ansible_playbook_mr_from_issue_comment_patch:
extends: .ansible_playbook
variables:
ansible_playbook: 'git_configuration.yaml'
ansible_tags: 'gitlab_issue_patches'
PIPELINE_RUN_TRIGGER: 'false'
PIPELINE_RUN_SCHEDULE: 'false'
needs: []
rules:
- if: '$NFC_AUTO_JOBS == "false"'
when: never
- if:
$CI_COMMIT_TAG == null &&
$CI_MERGE_REQUEST_TARGET_BRANCH_NAME == "development" &&
$CI_PIPELINE_SOURCE != "push" &&
$CI_COMMIT_BRANCH != 'master' &&
$CI_COMMIT_BRANCH != 'automated-tasks' &&
$CI_COMMIT_BRANCH == 'development'
exists:
- ".nfc_automation.yaml"
when: always
- when: never

View File

@ -50,7 +50,8 @@
- if: # condition_any_branch_push
$CI_COMMIT_BRANCH != null &&
$CI_COMMIT_TAG == null &&
$CI_PIPELINE_SOURCE == "push"
$CI_PIPELINE_SOURCE == "push" &&
$CI_COMMIT_BRANCH != 'master'
exists:
- .cz.yaml
when: always

View File

@ -18,7 +18,9 @@ variables:
.build_docker_container:
stage: build
image: nofusscomputing/docker-buildx-qemu:dev
image:
name: nofusscomputing/docker-buildx-qemu:dev
pull_policy: always
services:
- name: docker:23-dind
entrypoint: ["env", "-u", "DOCKER_HOST"]
@ -30,6 +32,7 @@ variables:
# See https://github.com/docker-library/docker/pull/166
DOCKER_TLS_CERTDIR: ""
before_script:
- git submodule foreach git submodule update --init
- if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=gitlab-ci; else ROOT_DIR=$JOB_ROOT_DIR ; fi
- echo "[DEBUG] ROOT_DIR[$ROOT_DIR]"
- docker info
@ -97,21 +100,21 @@ variables:
fi
rules:
- if: # condition_master_branch_push
$CI_COMMIT_BRANCH == "master" &&
$CI_PIPELINE_SOURCE == "push"
- if: # condition_git_tag
$CI_COMMIT_TAG != null &&
$CI_COMMIT_BRANCH == null
exists:
- '{dockerfile, dockerfile.j2}'
when: always
- '{dockerfile,dockerfile.j2}'
when: on_success
- if: # condition_dev_branch_push
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{dockerfile, dockerfile.j2}'
- '{dockerfile,dockerfile.j2}'
changes:
paths:
- '{dockerfile, dockerfile.j2, includes/**}'
- '{dockerfile,dockerfile.j2,includes/**/*}'
compare_to: 'master'
when: always
@ -120,10 +123,10 @@ variables:
$CI_COMMIT_BRANCH != "development" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{dockerfile, dockerfile.j2}'
- '{dockerfile,dockerfile.j2}'
changes:
paths:
- '{dockerfile, dockerfile.j2, includes/**}'
- '{dockerfile,dockerfile.j2,includes/**/*}'
compare_to: 'development'
when: always

View File

@ -46,20 +46,26 @@
- |
DOCKER_HUB_TAG=dev
echo "[DEBUG] default: DOCKER_HUB_TAG=$DOCKER_HUB_TAG";
if [ "0$CI_COMMIT_TAG" != "0" ]; then
DOCKER_HUB_TAG=latest
if [ "0$CI_COMMIT_TAG" == *"rc"* ]; then
echo "[DEBUG] stable: DOCKER_HUB_TAG=$DOCKER_HUB_TAG";
if [[ "0$CI_COMMIT_TAG" == *"rc"* ]]; then
DOCKER_HUB_TAG=dev
echo "[DEBUG] dev: DOCKER_HUB_TAG=$DOCKER_HUB_TAG";
fi
fi
echo "[DEBUG] DOCKER_IMAGE_PUBLISH_NAME=$DOCKER_IMAGE_PUBLISH_NAME";
echo "[DEBUG] DOCKER_HUB_TAG=$DOCKER_HUB_TAG";
echo "[DEBUG] final: DOCKER_HUB_TAG=$DOCKER_HUB_TAG";
if [ "0$DOCKER_IMAGE_BUILD_TARGET_PLATFORMS" != "0" ]; then
@ -99,26 +105,26 @@
$CI_COMMIT_TAG != null &&
$CI_COMMIT_BRANCH == null
exists:
- '{dockerfile, dockerfile.j2}'
- '{dockerfile,dockerfile.j2}'
when: on_success
- if: # condition_master_branch_push
$CI_COMMIT_BRANCH == "master" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{dockerfile, dockerfile.j2}'
when: always
# - if: # condition_master_branch_push
# $CI_COMMIT_BRANCH == "master" &&
# $CI_PIPELINE_SOURCE == "push"
# exists:
# - '{dockerfile,dockerfile.j2}'
# when: on_success
- if: # condition_dev_branch_push
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{dockerfile, dockerfile.j2}'
- '{dockerfile,dockerfile.j2}'
changes:
paths:
- '{dockerfile, dockerfile.j2, includes/**}'
- '{dockerfile,dockerfile.j2,includes/**/*}'
compare_to: 'master'
allow_failure: true
when: manual
when: on_success
- when: never

View File

@ -0,0 +1,284 @@
---
title: Ansible Collection
description: How to use No Fuss Computings gitlab-ci job for running Ansible Collection CI/CD Pipelines
date: 2024-02-16
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
This CI/CD template contains all of the CI jobs required for a pipeline for an Ansible Collection Project.
## Requirements
The following requirements are needed to run these CI/CD jobs. As we use [commitizen](https://commitizen-tools.github.io/commitizen/) for the versioning system, your commits will be required to be in [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/). The configuration for commitizen is within a `.cz.yaml` file which you will need to add to your repository root directory.
### Gitlab Features
| Feature | Setting | Notes |
|:---|:---:|:---|
| Package Registry | On | Storage of pipeline artifacts and the built package. |
| Releases | On | Gitlab releases are created as part of the pipeline. |
### Variables
To be able to upload to Ansible Galaxy, you will be required to provide the jobs, the following Variables That should be set as CI/CD variables (`<Project> -> Settings -> CI/CD Settings -> Variables`).
| Variable | Settings | Notes |
|:---|:---:|:---|
| `ANSIBLE_GALAXY_UPLOAD_TOKEN` | `masked`, `protected` | |
| `VERSION_BUMP_INCREMENT` | `major`, `minor`, `patch` | Used for manual run of the job. After setting the variable, that type of version bump will occur. |
Within your `.gitlab-ci.yml` file there are varibales to be set, please see below.
### .gitlab-ci.yaml Changes
To include these jobs in your CI/CD Project add our gitlab-ci project as a submodule to your project `git submodule add https://gitlab.com/nofusscomputing/projects/gitlab-ci/`. Then update your projects `.gitlab-ci.yml` file to include the following:
``` yaml
variables:
ANSIBLE_GALAXY_SERVER_URL: https://galaxy.ansible.com # Optional, default=(as displayed)String. URL to the Galaxy server for uploads
ANSIBLE_GALAXY_NAMESPACE: "" # Mandatory, String. The ansible galaxy upload namespace
ANSIBLE_GALAXY_PACKAGE_NAME: "" # Mandatory, String. The Ansible Galaxy package name
include:
- project: nofusscomputing/projects/gitlab-ci
ref: <git ref> # branch, git tag, commit etc
file:
- .gitlab-ci_common.yaml
- template/ansible-collection.gitlab-ci.yaml
```
## CI/CD Jobs
This template contains the following CI/CD Jobs
- `Create Release`
- `Ansible Lint`
- `Ansible Lint (galaxy.yml)`
- `Build Collection`
- `Stage Collection`
- `Gitlab Release`
- `Ansible Galaxy`
for a detail description of each job, please see below.
### Create Release
Triggered:
- **Feature branch**:
- **push**: `never`
- **merge to**: `never`
- **development branch**:
- **push**: `manual`
- **merge to**: `manual`
- **master branch**:
- **push**: `always`
- **merge to**: `always`
- **git tag**: `never`
Create a release. It's only triggered on merge to the `development` and `master` branches. The last stage of this job is to create a git tag which matches the version to be released. The creation of the git tag, starts the remainder of the release cycle. On the `development` branch (when the job is triggered as it's a manual job) an `alpha` release is created and on the `master` branch, a full release is created.
### Ansible Lint
Triggered:
- **Feature branch**:
- **push**: `never`
- **merge to**: `never`
- **development branch**:
- **push**: `manual`
- **merge to**: `manual`
- **master branch**:
- **push**: `never`
- **merge to**: `never`
- **git tag**: `never`
Lints the yaml files in directories `meta`, `playbooks` and `roles`. This job will not fail the pipeline. There are XUnit test reports created for thyis job so you can see any liniting errors.
### Ansible Lint (galaxy.yml)
Triggered:
- **Feature branch**:
- **push**: `always`
- **merge to**: `always`
- **development branch**:
- **push**: `always`
- **merge to**: `always`
- **master branch**:
- **push**: `never`
- **merge to**: `never`
- **git tag**: `always`
Lints the `galaxy.yml` file. This job is designed to fail the pipeline, as an incorrectly formated `galaxy.yml` file can prevent an upload of the collection to Ansible Galaxy. There is a XUnit test report created for thyis job so you can see any liniting errors.
### Build Collection
Triggered:
- **Feature branch**:
- **push**: `always`
- **merge to**: `always`
- **development branch**:
- **push**: `always`
- **merge to**: `always`
- **master branch**:
- **push**: `never`
- **merge to**: `never`
- **git tag**: `always`
Builds the collection.
### Stage Collection
Triggered:
- **Feature branch**:
- **push**: `never`
- **merge to**: `never`
- **development branch**:
- **push**: `never`
- **merge to**: `never`
- **master branch**:
- **push**: `never`
- **merge to**: `never`
- **git tag**: `always`
Adds the collection to Gitlab Packages Regsitry as a generic package. This location is used to store the package.
### Gitlab Release
Triggered:
- **Feature branch**:
- **push**: `never`
- **merge to**: `never`
- **development branch**:
- **push**: `never`
- **merge to**: `never`
- **master branch**:
- **push**: `never`
- **merge to**: `never`
- **git tag**: `always`
Creates a Gitlab release.
### Ansible Galaxy
Triggered:
- **Feature branch**:
- **push**: `never`
- **merge to**: `never`
- **development branch**:
- **push**: `never`
- **merge to**: `never`
- **master branch**:
- **push**: `never`
- **merge to**: `never`
- **git tag**: `always`
Uploads the package to Ansible Galaxy.
## CI Tests
Still to be developed
## Definition
``` yaml title="template/ansible-collection.gitlab-ci.yaml" linenums="1"
--8<-- "template/ansible-collection.gitlab-ci.yaml"
```
----
``` yaml title=".gitlab-ci_common.yaml" linenums="1"
--8<-- ".gitlab-ci_common.yaml"
```

View File

@ -11,29 +11,22 @@ This job enables you to run an Ansible playbook within the Gitlab CI/CD environm
There is also an additional job defined that enables you to specify a project to run an automated update of it's git submodules. This is useful if the project you create the job in, is used as a git submodule in another project. On pushing to the development branch, this job triggers the `Git.Submodules.Update.Chores` job that updates the specified projects git submodules.
This job provides the following badge:
- None
## Dependencies
- **Mandatory** file `.nfc_automation.yaml` see [Documentation](../git_configuration/submodule/) for file details.
- **Mandatory** In addition to the previous dependency, this requirement is for the project specified in the trigger job. The following must be added to the `.gitlab-ci.yml` file in that project.
``` yaml
include:
- project: nofusscomputing/projects/gitlab-ci
ref: master
file:
- .gitlab-ci_common.yaml
- automation/template/automagic.gitlab-ci.yaml
## your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
- **Mandatory** In addition to the previous dependency, this requirement is for the project specified in the trigger job. The following must be added to the `.gitlab-ci.yml` file in that project.
``` yaml
include:
- project: nofusscomputing/projects/gitlab-ci
ref: master
file:
- .gitlab-ci_common.yaml
- automation/template/automagic.gitlab-ci.yaml
```
To use the ansible playbook job add the following to your `.gitlab-ci.yml` file.
``` yaml
@ -56,7 +49,7 @@ Ansible Job:
```
To run the trigger job to update another projects git submodules.
To run the trigger job to update another projects git submodules. add the following to your `.gitlab-ci.yml` file
``` yaml
@ -77,26 +70,91 @@ Docker_Mail.Submodule.Deploy:
```
!!! Tip
You can optionally override the stage by specifying the job you define
In addition to the variables below, you can also specify any additional Environment variables for use by Ansible within the container. Refer to the [Ansible configuration documentation](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#common-options) for further details
## CI/CD Variables required
## Job: `.ansible_playbook`
| var name | Description |
|:----:|:----|
| ansible_playbook | ***Mandatory** The ansible playbook to run.* |
| ansible_tags | ***Optional** Tags to limit task scope* |
| PIPELINE_RUN_TRIGGER | ***Optional** if the job can be triggered by pipeline.* |
| PIPELINE_RUN_SCHEDULE | ***Optional** if the job can be triggered by schedule.* |
| SUBMODULE_UPDATE_TRIGGER_PROJECT | ***Mandatory** and only used for the Submodule.Deploy job. and is the project to trigger the `git.submodule.update.chores` job.* |
!!! Tip
In addition to the variables above, you can also specify any additional Environment variables for use by Ansible. Refer to the [Ansible configuration documentation](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#common-options) for further details
This job runs an Ansible playbook using the `nofusscomputing/ansible-ee:dev` Docker image.
## Job Workflow
### Stage: Chores
This job will run the specified Ansible playbook using our [Ansible Execution Environment](../execution_environment) container. This container contains all of our playbooks and roles.
This job is responsible for executing an Ansible playbook. It can be customized by setting the following variables:
#### Variables
- `ansible_inventory`: The Ansible inventory file.
- `ansible_playbook`: The name of the Ansible playbook file.
- `ansible_tags`: The tags to be applied during playbook execution.
### Rules
- Rule 1: If the `NFC_AUTO_JOBS` variable is set to `"false"`, the job will never run.
- Rule 2: If the pipeline is triggered by a schedule and `PIPELINE_RUN_SCHEDULE` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists.
- Rule 3: If the pipeline is triggered by an API call, another pipeline, a trigger, or a parent pipeline, and `PIPELINE_RUN_TRIGGER` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists.
- Rule 4: If the pipeline is triggered by a push to the `development` branch, the job will run only if the `.nfc_automation.yaml` file exists. see [Documentation](../git_configuration/submodule/) for file details.
- Rule 5: This rule prevents the job from running under any circumstances.
## Job: `.ansible_playbook_git_submodule`
This job extends the `.ansible_playbook` job and is specifically used for running the `git_configuration.yaml` playbook with the `submodule` tags.
### Stage: Chores
This job is responsible for executing the `git_configuration.yaml` playbook with the `submodule` tags.
#### Variables
- `ansible_playbook`: The name of the Ansible playbook file (`git_configuration.yaml`).
- `ansible_tags`: The tags to be applied during playbook execution (`submodule`).
### Rules
- Rule 1: If the `NFC_AUTO_JOBS` variable is set to `"false"`, the job will never run.
- Rule 2: If the pipeline is triggered by a schedule and `PIPELINE_RUN_SCHEDULE` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists.
- Rule 3: If the pipeline is triggered by an API call, another pipeline, a trigger, or a parent pipeline, and `PIPELINE_RUN_TRIGGER` is set to `"true"`, the job will run only if the `.nfc_automation.yaml` file exists. see [Documentation](../git_configuration/submodule/) for file details.
- Rule 4: If the pipeline is triggered by a push to the `development` branch, the job will run only if the `.nfc_automation.yaml` file exists.
- Rule 5: This rule prevents the job from running under any circumstances.
## Job: `.submodule_update_trigger`
This job triggers a pipeline in another project.
### Stage: Publish
This job is responsible for triggering a pipeline in another project.
#### Variables
- `PIPELINE_RUN_TRIGGER`: The flag to indicate if the triggered pipeline should run (`true`).
### Rules
- Rule 1: If the pipeline is triggered by a push to the `master` or `development` branch, and there is no associated tag, the job will run on successful completion.
- Rule 2: This rule prevents the job from running under any other circumstances.
## Artifacts

View File

@ -47,7 +47,7 @@ Run these commands once you have the information above.
``` bash
git format-patch {original_commit}..HEAD -o diff-patches
git format-patch {original_commit}..HEAD -o ../diff-patches
git reset {source_commit} --hard
@ -57,7 +57,7 @@ Now, navigate to the `diff-patches` folder, open up the offending patch (commit)
``` bash
git am diff-patches/*.patch
git am ../diff-patches/*.patch
```
@ -72,18 +72,9 @@ Now push your changes upstream.
| *Ensure that all of your commits were exported prior to reseting the branch and when re-applying, that all of your commits were applied correctly* |
## Conventional Commits Admin Manual Manual
## GitLab CI Template - `.conventional_commit`
This job checks commit messages on a branch and the merge request title for validity against the [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/)
This job provides the following badge:
- None
### Dependencies
- None
This GitLab CI template, named `.conventional_commit`, is designed to validate conventional commits within a GitLab CI/CD pipeline. It follows predefined rules to ensure that commit message conventions are met.
### your .gitlab-ci.yml changes
@ -105,20 +96,55 @@ include:
```
## CI/CD Variables required
### Job Description
| var name | Description |
|:----:|:----|
| MR_ACCESS_TOKEN | *only required if you are accessing a private repository.* <br>This token is a user access token that as a minimum requires read-only access to the api to fetch the projects merg requests. |
In addition to the required variables above, the commitizen config file `.cz.yaml` must exist for the job to run.
The `.conventional_commit` job performs various tasks related to validating conventional commits. It runs in the `validation` stage of the pipeline and uses the `python:3.6-slim` Docker image.
### Job Workflow
### Variables
- `DEFAULT_ROOT_DIR`: The default root directory is set as `./gitlab-ci`.
- `MR_ACCESS_TOKEN`: The access token for the merge request. If not defined, it falls back to `CI_JOB_TOKEN`.
- `JOB_ROOT_DIR`: The root directory for the job. If not defined, it falls back to `DEFAULT_ROOT_DIR`.
- `MY_PROJECT_ID`: The custom project ID. If not defined, it falls back to `CI_PROJECT_ID`.
### Stages
- `validation`: The job is assigned to the `validation` stage.
### Script
The script section contains the actions performed during the job execution. These actions include creating directories, setting up variables, preparing the Python environment, and executing commands related to validating conventional commits.
The complete script can be found in the GitLab CI template file.
### Artifacts
The job generates artifacts that are stored for a period of 3 days. The artifacts include the following paths:
- `$CI_PROJECT_DIR/artifacts/*`
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml`
### Rules
The job follows certain rules to determine when it should be executed:
- If the variable `$JOB_STOP_CONVENTIONAL_COMMITS` is true, the job will not run.
- If the branch is pushed and a commit is made, and there is no tag associated with the commit, and the pipeline source is "push", the job will run if `.cz.yaml` file exists.
- In all other cases, the job will not run.
This GitLab CI template provides a convenient way to validate conventional commits and enforce commit message conventions within your CI/CD pipelines.
## Gitlab job Definition
@ -129,6 +155,3 @@ When you include this definition the following makes up the job definition
--8<-- "conventional_commits/.gitlab-ci.yml"
```
!!! Note
Docs Still under development

View File

@ -0,0 +1,56 @@
---
title: docker build Gitlab CI/CD jobs Template
description: How to use No Fuss Computings gitlab-ci template for auto creation of CI/CD joobs.
date: 2023-06-10
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
This documentation provides an overview and explanation of the GitLab CI/CD YAML template. The template defines a job named `.build_docker_container` that builds a Docker container using the specified configuration.
### Stage: build
This job builds a Docker container using the `nofusscomputing/docker-buildx-qemu:dev` image and the `docker:23-dind` service.
#### Variables
- `DOCKER_IMAGE_BUILD_NAME`: The name of the Docker image to be built (`$CI_PROJECT_NAME`).
- `DOCKER_IMAGE_BUILD_REGISTRY`: The registry where the Docker image will be pushed (`$CI_REGISTRY_IMAGE`).
- `DOCKER_IMAGE_BUILD_TAG`: The tag to be applied to the Docker image (`$CI_COMMIT_SHA`).
#### Rules
- Rule 1: The job runs if the pipeline is triggered by a git tag and a `dockerfile` or `dockerfile.j2` file exists.
- Rule 2: The job runs if the pipeline is triggered by a push to the `development` branch and a `dockerfile` or `dockerfile.j2` file exists. It also checks for changes in the `dockerfile`, `dockerfile.j2`, or `includes/` directory compared to the `master` branch.
- Rule 3: The job runs if the pipeline is triggered by a push to a branch other than `master` or `development` and a `dockerfile` or `dockerfile.j2` file exists. It also checks for changes in the `dockerfile`, `dockerfile.j2`, or `includes/` directory compared to the `development` branch.
- Rule 4: The job never runs.
#### Script
The script performs the following steps:
1. Updates the binary formats and enables execution of other binary formats in the kernel.
2. Creates a Docker buildx builder and sets it as the active builder.
3. Builds a multi-arch Docker image if the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is specified. It applies labels to the image and pushes it to the specified registry. It also inspects the image and performs cleanup by removing additional unknown images from the container registry.
4. Builds a Docker image if the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is not specified. It applies labels to the image and pushes it to the specified registry.
## gitlab-ci.yml definition
``` yaml title=".gitlab-ci.yml" linenums="1"
--8<-- "docker/build.gitlab-ci.yaml"
```

View File

@ -0,0 +1,102 @@
---
title: docker publish Gitlab CI/CD jobs Template
description: How to use No Fuss Computings gitlab-ci job template to publish a docker image to docker hub.
date: 2023-06-10
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
This GitLab CI template is designed to publish Docker images to Docker Hub. It contains a job called "Publish Docker Image to Docker Hub" that handles the image publishing process.
## Stage
- `publish`
## Variables
The following variables are used in the job:
- `DOCKER_IMAGE_BUILD_NAME`: The name of the Docker image to build. By default, it uses the GitLab CI project name.
- `DOCKER_IMAGE_BUILD_REGISTRY`: The registry for the Docker image build. By default, it uses the GitLab CI registry image.
- `DOCKER_IMAGE_BUILD_TAG`: The tag for the Docker image build. By default, it uses the GitLab CI commit SHA.
- `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS`: A comma-separated list of available platforms for the Docker image build. Supported platforms include: `linux/amd64`, `linux/amd64/v2`, `linux/amd64/v3`, `linux/arm64`, `linux/riscv64`, `linux/ppc64`, `linux/ppc64le`, `linux/s390x`, `linux/386`, `linux/mips64le`, `linux/mips64`, `linux/arm/v7`, `linux/arm/v6`.
- `CI_REGISTRY_USER`: The username for logging in to the GitLab CI registry.
- `CI_REGISTRY_PASSWORD`: The password for logging in to the GitLab CI registry.
- `NFC_DOCKERHUB_USERNAME`: The username for logging in to Docker Hub.
- `NFC_DOCKERHUB_TOKEN`: The access token or password for logging in to Docker Hub.
- `DOCKER_IMAGE_PUBLISH_REGISTRY`: The registry for publishing the Docker image to Docker Hub.
- `DOCKER_IMAGE_PUBLISH_NAME`: The name of the Docker image for publishing to Docker Hub.
- `DOCKER_IMAGE_PUBLISH_URL`: The URL to access the published Docker image on Docker Hub.
## Services
- `docker:23-dind`: Runs Docker in Docker (DinD) service with version 23.
## Script
The job executes the following steps in the `script` section:
1. Logs in to the GitLab CI registry using the provided credentials (`CI_REGISTRY_USER` and `CI_REGISTRY_PASSWORD`).
2. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is specified, it iterates over the platforms and inspects the Docker image using `docker buildx imagetools inspect`.
3. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is not specified, it pulls the Docker image from the specified registry.
4. Logs in to Docker Hub using the provided credentials (`NFC_DOCKERHUB_USERNAME` and `NFC_DOCKERHUB_TOKEN`).
5. Lists the Docker images using `docker image ls`.
6. Determines the appropriate tag for the Docker image based on the pipeline source and commit tag.
7. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is specified, it creates multi-arch images using `docker buildx imagetools create` and tags them with the appropriate tag.
8. If the `DOCKER_IMAGE_BUILD_TARGET_PLATFORMS` variable is not specified, it tags the Docker image with the appropriate tag based on the pipeline source and commit tag.
9. Pushes the Docker image to Docker Hub.
10. Logs out of Docker Hub.
## Environment
The job sets the following environment variables:
- **Name**: DockerHub
- **URL**: The URL to access the published Docker image on Docker Hub.
## Rules
The job is controlled by the following rules:
- Runs when the pipeline is triggered by a Git tag and there is no associated branch.
- Runs when the pipeline is triggered by a push to the `master` branch and there is a Dockerfile present.
- Runs when the pipeline is triggered by a push to the `development` branch, there are changes in the Dockerfile or the `includes/` directory compared to the `master` branch, and it allows failure.
- Never runs explicitly.
## gitlab-ci.yml definition
``` yaml title=".gitlab-ci.yml" linenums="1"
--8<-- "docker/build.gitlab-ci.yaml"
```

View File

@ -12,7 +12,7 @@ about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
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)
### fixing commit messages
If only the last commit is the commit with an error just use `git commit --amend` and edit your commit message to be in the correct format and save. now push your changes.
@ -27,7 +27,7 @@ Run these commands once you have the information above.
``` bash
git format-patch {original_commit}..HEAD -o diff-patches
git format-patch {original_commit}..HEAD -o ../diff-patches
git reset {source_commit} --hard
@ -37,7 +37,7 @@ Now, navigate to the `diff-patches` folder, open up the offending patch (commit)
``` bash
git am diff-patches/*.patch
git am ../diff-patches/*.patch
```
@ -52,31 +52,65 @@ Now push your changes upstream.
| *Ensure that all of your commits were exported prior to reseting the branch and when re-applying, that all of your commits were applied correctly* |
## Gitlab Release - Developer Manual
## GitLab CI Template - Developer Manual
## Job: gitlab_release
This job bumps the version, updates the changelog, creates a git tag and creates a gitlab release. The git tag and release title use [semantic versioning](https://semver.org/). for this job to function correctly a `.cz.yaml` is required in the root of the repository. this file contains the [commitizen](https://github.com/commitizen-tools/commitizen) config and the version details.
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* |
!!! Alert
*If prior to merging to the master branch you do a version increment, and there are no commits prior to merging. the job will not increment the version and the job will fail. it is recommended that you only do a version increment on the `development` branch if you are going to commit further changes to the `development` branch*
This job provides the following badge:
### Stage
- None
`release`
### Dependencies
### Image
- None
The job uses the `registry.gitlab.com/gitlab-org/release-cli:latest` image.
### Variables
The job does not use any additional variables.
### Explanation
The `gitlab_release` job is responsible for creating releases and tags for the GitLab repository. It follows a specific release workflow and utilizes the `release-cli` tool to automate the release process.
### Steps
1. Set ROOT_DIR variable: Sets the `ROOT_DIR` variable based on the value of `JOB_ROOT_DIR`.
2. Create necessary directories: Creates necessary directories for storing artifacts and tests.
3. Install dependencies: Updates the package manager and installs Git and Python 3. Sets up the Python environment by installing required packages.
4. Clone repository: Clones the repository using the provided authentication token and checks out the `development` branch.
5. Configure Git: Configures Git settings for the release process.
6. Perform release steps: Executes release-related steps, such as running a custom command (`$MY_COMMAND`), generating the release changelog, and tagging the release.
7. Push changes: Pushes the changes to the GitLab repository.
8. Cleanup: Removes the cloned repository.
### Rules
- The job is never triggered when `$JOB_STOP_GITLAB_RELEASE` is true.
- The job is never triggered when the commit author is `nfc_bot <helpdesk@nofusscomputing.com>`.
- If the commit is pushed to the `master` branch, the job is only triggered on successful pipeline execution and failure is not allowed.
- If the commit is pushed to the `development` branch, the job is triggered manually and failure is allowed.
### your .gitlab-ci.yml changes
@ -105,40 +139,70 @@ Gitlab Release:
> if you wish to run any commands you can add them to variable `MY_COMMAND`. The custom command will run under shell `/bin/sh`. This command is set to run before the version bump commit is conducted so any changes you wish to add as part of the version bump, you can do here as long as you `git add {changed file name}`.
### CI/CD Variables required
| 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: commit_footer_refs
### Job Workflow
### Stage
This CI job's workflow is:
1. updates the changelog from the commits
1. commit the changelog to git
1. adds a `git tag` to the changelog commit.
1. pushes the change back to the repo
1. creates a git release from the `git tag`
| :octagonal_sign: **NOTE** |
|:----|
| *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.* |
`validation`
### Artifacts
### Image
- `ci commit footer`
> $CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME.junit.xml
The job uses the `python:3.6-slim` image.
- `Gitlab Release`
> None
### Variables
- `DEFAULT_ROOT_DIR`: The default root directory path.
### Explanation
The `commit_footer_refs` job validates the commit footer references in the GitLab repository. It checks if the commit messages adhere to the conventional commit format and generates a JUnit XML report.
### Conventional Commits
Conventional commits follow a specific format for commit messages, consisting of a type, optional scope, and a message. The format is as follows:
```
<type>(<scope>): <message>
```
- The `<type>` represents the nature of the changes, such as `feat` for a new feature, `fix` for a bug fix, `docs` for documentation changes, and so on.
- The `<scope>` (optional) provides additional context for the commit, indicating the module, component, or area of code being modified.
- The `<message>` contains a concise and descriptive summary of the changes.
The commit footer can contain additional information, such as references to issues, feature requests, or pull requests.
### Steps
1. Create necessary directories: Creates necessary directories for storing artifacts and test results.
2. Set ROOT_DIR variable: Sets the `ROOT_DIR` variable based on the value of `JOB_ROOT_DIR`.
3. Install dependencies: Updates the package manager and installs Git and the required Python packages for the commit footer validation.
4. Clone repository: Clones the repository and checks out the specified branch.
5. Run commit_footer script: Executes the `commit_footer` script to validate the commit footer references.
6. Generate artifacts: Generates a JUnit XML report for the test results.
### Rules
- The job is never triggered when `$JOB_STOP_CONVENTIONAL_COMMITS` is true.
- The job is never triggered when `CHANGELOG_FOOTER_REFERENCES` is false.
- The job is always triggered when the commit is not pushed to the master or development branch, and a .cz.yaml file is present, indicating the usage of conventional commits.
- The job is never triggered otherwise.
## Gitlab job Definition
@ -150,6 +214,3 @@ When you include this definition the following makes up the job definition
--8<-- "gitlab_release/.gitlab-ci.yml"
```
!!! Note
Docs Still under development

View File

@ -18,10 +18,11 @@ This template is designed to autodetect which jobs should be created. By includi
Docs Still under development
## gitlab-ci.yml definition
``` yaml title=".gitlab-ci.yml" linenums="1"
--8<-- "template/automagic.gitlab-ci.yaml"
```
```

View File

@ -13,6 +13,8 @@ about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
- notate available platforms can be viewed in the job
- notate that resource groups are used. also mention that the resource group allows the git tag pipeline as forced to wait for the previous pipeline, tag push to build the image first
``` yaml
# Available platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6

View File

@ -13,6 +13,7 @@ This template creates the jobs applicable to publishing pages to a website. The
- notate that var `PAGES_ENVIRONMENT_PATH:` can be set to the slug of the page to show and is used for launching the environment to the url that contains the docs index page.
- notate that resource groups are used.
## Dependencies

View File

@ -36,7 +36,7 @@
- if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No tag to delete, version was not bumped"; else git tag -d $RELEASE_TAG; fi
- if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No push will be conducted, version was not bumped"; else git push; fi
- if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No release will be created, version was not bumped"; else release-cli create --name "Release $RELEASE_TAG" --tag-name "$RELEASE_TAG" --ref "$RELEASE_TAG_SHA1" --description "$RELEASE_CHANGELOG"; fi
- if [ "0$RELEASE_VERSION_CURRENT" == "0$RELEASE_VERSION_NEW" ]; then echo "[DEBUG] No release will be created, version was not bumped"; else release-cli create --name "Release $RELEASE_TAG" --tag-name "$RELEASE_TAG" --tag-message "$RELEASE_CHANGELOG" --ref "$RELEASE_TAG_SHA1" --description "$RELEASE_CHANGELOG"; fi
- if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git checkout master; fi
- if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git push --set-upstream origin master; fi
- if [ "$CI_COMMIT_BRANCH" == "master" ] ; then git merge --no-ff development; fi
@ -88,7 +88,6 @@ commit footer refs:
- 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:

View File

@ -57,7 +57,7 @@ class Commits:
footer_line = git_message.split("\n")
footer_line = footer_line[(len(footer_line)-1)]
commit_footer = re.findall(r"([\!|\#][0-9]+)", str(git_message))
commit_footer = re.findall(r"([\!|\#][\d|not]+)", str(git_message))
if len(commit_footer) > 0:
footer = commit_footer

View File

@ -22,6 +22,17 @@
- ls -la $PYTHON_VERSION
- if [ $ANSIBLE_LINT_JUNIT > 0 ]; then echo "Error ANSIBLE_LINT_JUNIT failed with $ANSIBLE_LINT_JUNIT"; fi
- if [ $ANSIBLE_LINT -ge 3 ]; then echo "ansible lint failed with $ANSIBLE_LINT"; exit $ANSIBLE_LINT; fi # don't fail the job?? 1=failed test, 2=failed command i.e. switch/flag
- | # Force failure if test must pass set TEST_MUST_PASS=yes
if [ "0$TEST_MUST_PASS" == "0yes" ]; then
echo "Trace TEST_MUST_PASS[${TEST_MUST_PASS}]";
echo "ansible lint failed with $ANSIBLE_LINT";
exit $ANSIBLE_LINT;
fi
after_script:
- echo deactivate
artifacts:
@ -41,17 +52,17 @@
$CI_COMMIT_BRANCH == "master" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{defaults/**, handlers/**, inventory/**, meta/**, playbooks/**. tasks/**}/*.{yaml,yml}'
- "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}"
when: always
- if: # condition_dev_branch_push
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{defaults/**, handlers/**, inventory/**, meta/**, playbooks/**. tasks/**}/*.{yaml,yml}'
- "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}"
changes:
paths:
- '{defaults/**, handlers/**, inventory/**, meta/**, playbooks/**. tasks/**}/*.{yaml,yml}'
- "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}"
compare_to: 'master'
when: always
@ -60,10 +71,10 @@
$CI_COMMIT_BRANCH != "development" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{defaults/**, handlers/**, inventory/**, meta/**, playbooks/**. tasks/**}/*.{yaml,yml}'
- "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}"
changes:
paths:
- '{defaults/**, handlers/**, inventory/**, meta/**, playbooks/**. tasks/**}/*.{yaml,yml}'
- "{defaults/**,handlers/**,inventory/**,meta/**,playbooks/**,tasks/**}/*.{yaml,yml}"
compare_to: 'development'
when: always

View File

@ -39,7 +39,7 @@
exists:
# - "**.md"
# - "**/**.md"
- '{!docs/**,!pages/**,!gitlab-ci/**, !website-template/**, **}/*.md'
- '{!docs/**,!pages/**,!gitlab-ci/**,!website-template/**,**}/*.md'
when: always
- when: never
@ -68,14 +68,22 @@
when: always
- if: # condition_dev_branch_push
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
$CI_COMMIT_BRANCH == "development" &&
(
$CI_PIPELINE_SOURCE == "pipeline"
||
$CI_PIPELINE_SOURCE == "push"
||
$CI_PIPELINE_SOURCE == "schedule"
)
# See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE
exists:
- '{docs/**,pages/**}/*.md'
changes:
paths:
- '{docs/**,pages/**}/*.md'
compare_to: 'master'
# No changes check # See nofusscomputing/projects/gitlab-ci#34
# changes:
# paths:
# - '{docs/**,pages/**}/*.md'
# compare_to: 'master'
when: always
- if: # condition_not_master_or_dev_push

View File

@ -44,12 +44,12 @@
- if: '$CI_COMMIT_BRANCH &&
( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline")'
exists:
- '{!gitlab-ci/**/*, !website-template/**/*, !.gitlab-ci, !*gitlab-ci*, **/*, **}.{yml, yaml}'
- '{!gitlab-ci/**/*,!website-template/**/*,!.gitlab-ci,!*gitlab-ci*,**/*,**}.{yml,yaml}'
# - ".gitlab-ci*"
# - "**/*gitlab-ci*"
changes:
paths:
- '{!gitlab-ci/**/*, !website-template/**/*, !.gitlab-ci, !*gitlab-ci*, **/*, **}.{yml, yaml}'
- '{!gitlab-ci/**/*,!website-template/**/*,!.gitlab-ci,!*gitlab-ci*,**/*,**}.{yml,yaml}'
compare_to: 'master'
when: always
@ -59,7 +59,7 @@
.Gitlab_CI.Lint.YAML:
variables:
YAML_LINT_PATH: ".gitlab-ci* ./**/*gitlab-ci*"
YAML_LINT_EXTRA_ARGS: "{ extends: lint/.yamllint.yaml, ignore: [gitlab-ci/*, website-template/*] }"
YAML_LINT_EXTRA_ARGS: "{ extends: lint/.yamllint.yaml,ignore: [gitlab-ci/*,website-template/*] }"
extends:
- .yaml_lint_defaults
rules:
@ -68,17 +68,17 @@
$CI_COMMIT_BRANCH == "master" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{*, **/**, **}/*gitlab-ci*'
- '{*,**/**,**}/*gitlab-ci*'
when: always
- if: # condition_dev_branch_push
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{*, **/**, **}/*gitlab-ci*'
- '{*,**/**,**}/*gitlab-ci*'
changes:
paths:
- '{*, **/**, **}/*gitlab-ci*'
- '{*,**/**,**}/*gitlab-ci*'
compare_to: 'master'
when: always
@ -87,10 +87,10 @@
$CI_COMMIT_BRANCH != "development" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{*, **/**, **}/*gitlab-ci*'
- '{*,**/**,**}/*gitlab-ci*'
changes:
paths:
- '{*, **/**, **}/*gitlab-ci*'
- '{*,**/**,**}/*gitlab-ci*'
compare_to: 'development'
when: always

View File

@ -17,9 +17,15 @@ nav:
- projects/index.md
- Gitlab CI:
- Gitlab CI:
- Ansible:
- projects/gitlab-ci/ansible/collection.md
- Build:
- projects/gitlab-ci/docker_build.md
- projects/gitlab-ci/mkdocs-build.md
@ -33,6 +39,10 @@ nav:
- projects/gitlab-ci/yaml_lint.md
- Publish:
- projects/gitlab-ci/docker_publish.md
- Templates:
- projects/gitlab-ci/templates/index.md

View File

@ -1,5 +1,5 @@
.MKDocs_Build:
image: python:3.7.5-buster
image: python:3.11.2-bullseye
stage: build
variables:
GIT_DEPTH: 0
@ -34,22 +34,30 @@
- 'mkdocs.{yaml,yml}'
when: always
- if: # condition_master_branch_push
$CI_COMMIT_BRANCH == "master" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- 'mkdocs.{yaml,yml}'
when: always
# - if: # condition_master_branch_push
# $CI_COMMIT_BRANCH == "master" &&
# $CI_PIPELINE_SOURCE == "push"
# exists:
# - 'mkdocs.{yaml,yml}'
# when: always
- if: # condition_dev_branch_push
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
(
$CI_PIPELINE_SOURCE == "pipeline"
||
$CI_PIPELINE_SOURCE == "push"
||
$CI_PIPELINE_SOURCE == "schedule"
)
# See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE
exists:
- 'mkdocs.{yaml,yml}'
changes:
paths:
- '{docs/**,pages/**}/*.md'
compare_to: 'master'
# No changes check # See nofusscomputing/projects/gitlab-ci#34
# changes:
# paths:
# - '{docs/**,pages/**}/*.md'
# compare_to: 'master'
when: always
- if: # condition_not_master_or_dev_push
@ -83,24 +91,33 @@
- '{docs/**,pages/**}/*.md'
when: always
- if: # condition_master_branch_push
$CI_COMMIT_BRANCH == "master" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{docs/**,pages/**}/*.md'
when: always
# - if: # condition_master_branch_push
# $CI_COMMIT_BRANCH == "master" &&
# $CI_PIPELINE_SOURCE == "push"
# exists:
# - '{docs/**,pages/**}/*.md'
# when: always
- if: # condition_dev_branch_push
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
(
$CI_PIPELINE_SOURCE == "pipeline"
||
$CI_PIPELINE_SOURCE == "push"
||
$CI_PIPELINE_SOURCE == "schedule"
)
# See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE
exists:
- '{docs/**,pages/**}/*.md'
changes:
paths:
- '{docs/**,pages/**}/*.md'
compare_to: 'master'
- 'mkdocs.{yaml,yml}'
# No changes check # See nofusscomputing/projects/gitlab-ci#34
# changes:
# paths:
# - '{docs/**,pages/**}/*.md'
# compare_to: 'master'
when: always
- if: # condition_not_master_or_dev_push
$CI_COMMIT_BRANCH != "master" &&
$CI_COMMIT_BRANCH != "development" &&

View File

@ -1,9 +1,11 @@
mkdocs==1.2.3
mkdocs-minify-plugin==0.5.0
mkdocs-material-extensions==1.0.3
mkdocs==1.5.3
mkdocstrings==0.25.1
mkdocstrings-python==1.10.3
mkdocs-minify-plugin==0.8.0
mkdocs-material-extensions==1.3.1
wheel
mkdocs-material==8.1.7
mkdocs-material==9.5.6
./website-template/custom-plugins/mkdocs-plugin-tags
mkdocs-git-revision-date-localized-plugin==0.11.1
pymdown-extensions==9.1
Jinja2==3.0.3
mkdocs-git-revision-date-localized-plugin==1.2.2
pymdown-extensions==10.7
Jinja2==3.1.3

View File

@ -0,0 +1,101 @@
include:
- local: $JOB_ROOT_DIR/ansible/collection/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/lint/ansible.gitlab-ci.yaml
Create Release:
extends: .ansible_collection_merge
needs: []
Ansible Lint:
extends: .ansible_linter_defaults
image: python:3.11-slim
variables:
ANSIBLE_LINT_PATH: meta/ playbooks/ roles/
needs: []
rules:
- if: $CI_COMMIT_TAG
when: always
- if: "$CI_COMMIT_AUTHOR =='nfc_bot <helpdesk@nofusscomputing.com>'"
when: never
- if: # Occur on merge
$CI_COMMIT_BRANCH == "development"
&&
$CI_PIPELINE_SOURCE == "push"
when: always
- if:
$CI_COMMIT_BRANCH != "development"
&&
$CI_COMMIT_BRANCH != "master"
&&
$CI_PIPELINE_SOURCE == "push"
when: always
- when: never
# ToDo: add lint for README.md as ansible Galaxy doesn't seem to like html in the md document. 16 Feb 24.
Ansible Lint (galaxy.yml):
extends: .ansible_linter_defaults
image: python:3.11-slim
variables:
ANSIBLE_LINT_PATH: galaxy.yml
TEST_MUST_PASS: 'yes'
needs: []
rules:
- if: $CI_COMMIT_TAG
when: always
- if: "$CI_COMMIT_AUTHOR =='nfc_bot <helpdesk@nofusscomputing.com>'"
when: never
- if: # Occur on merge
$CI_COMMIT_BRANCH == "development"
&&
$CI_PIPELINE_SOURCE == "push"
when: always
- if:
$CI_COMMIT_BRANCH != "development"
&&
$CI_COMMIT_BRANCH != "master"
&&
$CI_PIPELINE_SOURCE == "push"
when: always
- when: never
Build Collection:
extends: .ansible_collection_build
needs:
- Ansible Lint
- Ansible Lint (galaxy.yml)
Stage Collection:
extends: .ansible_collection_stage_package
needs:
- Build Collection
Gitlab Release:
extends: .ansible_collection_release
needs:
- Stage Collection
Ansible Galaxy:
extends: .ansible_collection_publish_galaxy
needs:
- Stage Collection
- Gitlab Release

View File

@ -15,6 +15,8 @@ Ansible Lint (python 3.11):
extends:
- .ansible_linter_defaults
image: python:3.11-slim
resource_group: build
needs: []
Gitlab Release:

View File

@ -32,6 +32,8 @@ include:
Update Git Submodules:
extends: .ansible_playbook_git_submodule
Search Issues for git patches:
extends: .ansible_playbook_mr_from_issue_comment_patch
#
# Release
@ -47,3 +49,4 @@ Gitlab Release:
Github (Push --mirror):
extends:
- .git_push_mirror
needs: []

View File

@ -28,45 +28,48 @@ variables:
Docker Container:
extends: .build_docker_container
resource_group: build
needs: []
Docker.Hub.Branch.Publish:
extends: .publish-docker-hub
needs: [ "Docker Container" ]
resource_group: build
rules: # rules manually synced from docker/publish.gitlab-ci.yaml removing git tag
- if: # condition_master_branch_push
$CI_COMMIT_BRANCH == "master" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{dockerfile, dockerfile.j2}'
when: always
# - if: # condition_master_branch_push
# $CI_COMMIT_BRANCH == "master" &&
# $CI_PIPELINE_SOURCE == "push"
# exists:
# - '{dockerfile,dockerfile.j2}'
# when: always
- if: # condition_dev_branch_push
$CI_COMMIT_BRANCH == "development" &&
$CI_PIPELINE_SOURCE == "push"
exists:
- '{dockerfile, dockerfile.j2}'
- '{dockerfile,dockerfile.j2}'
changes:
paths:
- '{dockerfile, dockerfile.j2, includes**/**}'
- '{dockerfile,dockerfile.j2,includes/**/*}'
compare_to: 'master'
allow_failure: true
when: manual
when: on_success
- when: never
Docker.Hub.Tag.Publish:
extends: .publish-docker-hub
resource_group: build
rules: # rules manually synced from docker/publish.gitlab-ci.yaml only keeping git tag
- if: # condition_git_tag
$CI_COMMIT_TAG != null &&
$CI_COMMIT_BRANCH == null
exists:
- '{dockerfile, dockerfile.j2}'
- '{dockerfile,dockerfile.j2}'
when: always
- when: never

View File

@ -9,22 +9,25 @@ include:
Documentation.Lint:
extends: .Lint_Markdown_Docs
needs: []
Documentation.Build:
extends: .MKDocs_Build_Docs
needs: [ 'Documentation.Lint' ]
resource_group: Documentation
# this name must always be called 'pages' so that gitlab pages work
pages:
stage: deploy
resource_group: Documentation
variables:
GIT_STRATEGY: none
script:
- mv "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build" public
needs: [ 'Documentation.Build' ]
environment:
name: staging
name: Gitlab Pages
url: $CI_PAGES_URL/$PAGES_ENVIRONMENT_PATH
artifacts:
paths:

99
test/.gitlab-ci.yml Normal file
View File

@ -0,0 +1,99 @@
# This gitlab-ci file is for testing job rules
API Only:
stage: test
needs: []
script:
- echo should only run on
rules:
- if:
$CI_PIPELINE_SOURCE == "api"
when: always
- when: never
Push Only:
stage: test
needs: []
script:
- echo testing rules
rules:
- if:
$CI_COMMIT_BRANCH != ""
&&
$CI_PIPELINE_SOURCE == "push"
when: always
- when: never
MR-On Merging Only:
stage: test
needs: []
script:
- echo should only run on merging a MR
rules:
- if:
$CI_MERGE_REQUEST_IID == ""
&&
$CI_PIPELINE_SOURCE == "merge_request_event"
when: always
- when: never
MR-Not On Merging:
stage: test
needs: []
script:
- echo should never run on merging a MR
rules:
- if:
$CI_MERGE_REQUEST_IID != ""
&&
$CI_PIPELINE_SOURCE == "merge_request_event"
when: always
- when: never
MR-Merge Request Event:
stage: test
needs: []
script:
- echo should only run on merge event
rules:
- if:
$CI_PIPELINE_SOURCE == "merge_request_event"
when: always
- when: never
Trigger Only:
stage: test
needs: []
script:
- echo should only run on trigger event
rules:
- if:
$CI_PIPELINE_SOURCE == "trigger"
when: always
- when: never
Web Only:
stage: test
needs: []
script:
- echo should only run on web only trigger
rules:
- if:
$CI_PIPELINE_SOURCE == "web"
when: always
- when: never