Merge branch 'ansible-role' into 'development'

feat: ansible role and docs

See merge request nofusscomputing/projects/gitlab-ci!25
This commit is contained in:
2023-05-22 07:13:52 +00:00
31 changed files with 458 additions and 232 deletions

View File

@ -1,25 +1,36 @@
stages:
- validation
- build
- prepare
- test
- release
- sync
- deploy
- publish
include:
- local: $JOB_ROOT_DIR/lint/yaml.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/template/website.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/lint/markdown.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/python/.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
#- template: Security/License-Scanning.gitlab-ci.yml
variables:
JOB_ROOT_DIR: '.'
SECURE_LOG_LEVEL: debug
GIT_SUBMODULE_STRATEGY: recursive
GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/gitlab-ci.git"
MY_PROJECT_ID: "28543717"
LICENSE_FINDER_CLI_OPTS: '--recursive'
MDLINT_PATHS: "**/*.md **/**/*.md **/**/**/*.md **/**/**/**/*.md **/**/**/**/**/**/*.md #**CHANGELOG.md #CHANGELOG.md #website-template/** #.gitlab/**"
stages:
- validation
- test
- release
- sync
include:
- local: $JOB_ROOT_DIR/lint/yaml.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/validation/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/python/.gitlab-ci.yml
- template: Security/Dependency-Scanning.gitlab-ci.yml
#- template: Security/License-Scanning.gitlab-ci.yml
# Scanner doesn't Pickup multiple pip files. Disable and specify jobs with pip file.
gemnasium-python-dependency_scanning:
@ -109,14 +120,6 @@ gilab-ci.yml Lint (python 3.11):
image: python:3.11-slim
Markdown Linting:
variables:
#MDLINT_PATHS: '!website_template** !.gitlab** !CHANGELOG.md **/*.md'
MDLINT_PATHS: "**/*.md **/**/*.md **/**/**/*.md **/**/**/**/*.md **/**/**/**/**/**/*.md #**CHANGELOG.md #CHANGELOG.md #website-template/** #.gitlab/**"
extends:
- .Lint_Markdown
Gitlab Release:
variables:
MY_COMMAND: ./sub-folder_changlog.sh
@ -125,7 +128,5 @@ Gitlab Release:
Github (Push --mirror):
variables:
GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/gitlab-ci.git"
extends:
- .git_push_mirror

View File

@ -10,4 +10,5 @@ stages:
- test
- release
- sync
- deploy
- publish

View File

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

View File

@ -1,18 +1,23 @@
# {CI Job Name}
Summary of job here
This job provides the following badge:
{A badge here}
## Dependencies
- {dependent job name}
## your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
``` yaml
variables:
VARNAME: "a var value"
@ -21,8 +26,10 @@ stages:
include:
- local: CI/{job name}/.gitlab-ci.yml
```
## CI/CD Variables required
| var name | Description |
@ -37,4 +44,5 @@ include:
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)

View File

@ -43,12 +43,15 @@ links:
## Using this repository for your Gitlab CI/CD Jobs.
This repository has been designed as a central point for your repositories CI/CD jobs. By simply linking this repository to your repository and configuring, your CI/CD jobs will run as part of the build process, whilst keeping any CI/CD commits limited within your git history.
Each CI/CD job is contained within its own sub-folder. Each sub-folder has a readme specific to the job, which includes the details on how to implement, use etc.
For further details on using these templates with your Gitlab CI/CD jobs, pleaase view the [documentation](https://nofusscomputing.com/projects/gitlab-ci).
### gitlab-ci layout
### gitlab-ci repository layout
We use the following branches *(these jobs assume you do as well)*:
- `master` - Considered as the stable branch
@ -57,99 +60,8 @@ We use the following branches *(these jobs assume you do as well)*:
We also tag each branch to denote the version of release. We use our own repo to do the version increment automagically in line with [semantic versioning](https://semver.org/).
### CI Stages
The CI stages for these jobs are as follows, and in the order expected by the jobs:
- validation
> validation of files, commits, Merge Request titles, code quality, license checks.
- build
> build any binaries or files that would be used in the later stages .
- prepare
> any jobs that must run after build but before testing. for example a docker image build that includes artifacts from the build job
- test
> unit, functional, integration and any other tests.
- release
> git tagging and creating a gitlab release. Also includes adding build artifacts to gitlab registry.
- sync
> repository synchronization, i.e. push mirror to github.
- publish
> placement of build objects to external sources
### .gitlab-ci.yml example
example:
``` yaml
stages:
- validation
- build
- prepare
- test
- release
- sync
- publish
variables:
GIT_SUBMODULE_STRATEGY: recursive
MY_PROJECT_ID: "{your_project_id}"
include:
- project: nofusscomputing/projects/gitlab-ci
ref: 68b6bc3bfacf0770e10d2e10a5c57952070d44fe
file:
- conventional_commits/.gitlab-ci.yml
- gitlab_release/.gitlab-ci.yml
- git_push_mirror/.gitlab-ci.yml
- ansible/.gitlab-ci.yml
```
| :bulb: Tip |
|:----|
| *Use a project import in your `.gitlab-ci.yml` file that is tied to a specific `ref`. for example a commit or tag. Also ensure that the `gitlab-ci` `git sub-module` and the `ref` as part of the includes matches.* |
### Artifacts
Any artifacts by jobs will be created in folders named after the stage.
preference is placed on jobs to output JUnit.xml test reports. This is because they are visible in merge requests.
## Git Sub-Module setup
It is recommended that you set-up this repo as a git sub-module to your repo and that you configure it to a set commit/tag. This ensures that any change to `gitlab-ci` repo, does not effect your CI/CD jobs.
run the following commands:
``` bash
git submodule add -b {ref} https://gitlab.com/nofusscomputing/projects/gitlab-ci.git gitlab-ci
git submodule update --remote
```
| :bulb: Tip |
|:-----|
| NOTE: `{ref}` should be replaced with the branch name, `master` is the stable branch and recommended. by default the sub-module will be created in folder `gitlab-ci`, it is recommended that you **don't** change this folder name.
You can also substitute the gitlab url with the github url `https://github.com/NoFussComputing/gitlab-ci.git` for the submodule if you desire. this repo is auto-synced with github on each change to the repo. |
After each `git submodule update --remote` you will have to commit the sub-module update to your repo. Suggested commands as follows:
``` bash
git add .gitmodules
git add gitlab-ci
git commit -m "ci(gitlab-ci): updated to use version x
{your reason here or explain what is provided/changed}"
```
Then push the changes to your source.
## Contributing
All contributions for this project must conducted from [Gitlab](https://gitlab.com/nofusscomputing/projects/gitlab-ci).
For further details on contributing please refer to the [contribution guide](CONTRIBUTING.md).

View File

@ -4,18 +4,21 @@
variables:
MDLINT_PATHS: "**/*.md **/**/*.md **/**/**/*.md **/**/**/**/*.md **/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci"
DEFAULT_ROOT_DIR: "./gitlab-ci"
MD_LINT_CONFIG_PATH: ""
before_script:
- mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown"
- if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR ; fi
- if [ "0$JOB_ROOT_DIR" == "0" ]; then ROOT_DIR=$DEFAULT_ROOT_DIR; else ROOT_DIR=$JOB_ROOT_DIR; fi
- echo "[DEBUG] ROOT_DIR[$ROOT_DIR]"
- cp -f "$ROOT_DIR/validation/.markdownlint-cli2.jsonc" "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc"
- if [ "0$MD_LINT_CONFIG_PATH" != "0" ]; then cp "$MD_LINT_CONFIG_PATH/.markdownlint.json" $CI_PROJECT_DIR/.markdownlint.json; fi
- cp -f "$ROOT_DIR/lint/.markdownlint-cli2.jsonc" "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc"
- npm install markdownlint-cli2 --global
- npm install markdownlint-cli2-formatter-junit --global
script:
- echo "[DEBUG] MDLINT_PATHS=$MDLINT_PATHS"
- markdownlint-cli2 $MDLINT_PATHS 1>&1 || EXITCODE=$?
- echo DEBUG EXITCODE[$EXITCODE]
- rm "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc"
- rm -f "$CI_PROJECT_DIR/.markdownlint-cli2.jsonc"
- if [ "0$MD_LINT_CONFIG-PATH" != "0" ]; then rm -f "$CI_PROJECT_DIR/.markdownlint.json"; fi
- mv *.junit.xml "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/lint_markdown/markdown_lint.junit.xml"
artifacts:
expire_in: 24 hrs
@ -32,3 +35,14 @@
- "**/**.md"
- when: never
.Lint_Markdown_Pages:
variables:
MDLINT_PATHS: "pages/*.md pages/**/*.md pages/**/**/*.md pages/**/**/**/*.md pages/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci !website-template"
MD_LINT_CONFIG_PATH: "$CI_PROJECT_DIR/website-template"
extends: .Lint_Markdown
rules:
- if: '$CI_COMMIT_BRANCH'
exists:
- "pages/index.md"
- when: never

View File

@ -1,8 +1,8 @@
INHERIT: website-template/mkdocs.yml
repo_name: Website
repo_name: Gitlab-CI
repo_url: https://gitlab.com/nofusscomputing/projects/gitlab-ci
edit_uri: ''
edit_uri: '/-/ide/project/nofusscomputing/projects/gitlab-ci/edit/development/-/pages/'
nav:
- Home: index.md
@ -11,22 +11,37 @@ nav:
- articles/index.md
- Content Tags: tags.md
- Projects:
- projects/index.md
- Ansible Roles: projects/ansible-roles/README.md
- Gitlab CI:
- projects/gitlab-ci/README.md
- projects/gitlab-ci/ansible_roles.md
- Build:
- projects/gitlab-ci/conventional_commits.md
- projects/gitlab-ci/mkdocs-build.md
- projects/gitlab-ci/docker_container.md
- Linting:
- projects/gitlab-ci/markdown_lint.md
- projects/gitlab-ci/yaml_lint.md
- Templates:
- projects/gitlab-ci/templates/index.md
- projects/gitlab-ci/templates/ansible_roles.md
- projects/gitlab-ci/templates/docker_container.md
- projects/gitlab-ci/templates/website.md
- Validation:
- projects/gitlab-ci/conventional_commits.md
- projects/gitlab-ci/index.md
- projects/gitlab-ci/git_mirror.md
@ -34,13 +49,6 @@ nav:
- projects/gitlab-ci/python.md
- projects/gitlab-ci/yaml_lint.md
- Python Gitlab Management: projects/python-gitlab-management/README.md
- Operations:
- operations/index.md

View File

@ -22,8 +22,16 @@
paths:
- "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME"
rules:
- if: '$JOB_STOP_MKDOCS_BUILD'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: $CI_COMMIT_TAG
when: on_success
- if: '$CI_COMMIT_BRANCH'
exists:
- "mkdocs.yaml"
- "mkdocs.yml"
when: always
- when: never

View File

@ -1 +1,9 @@
mkdocs==1.2.3
mkdocs-minify-plugin==0.5.0
mkdocs-material-extensions==1.0.3
wheel
mkdocs-material==8.1.7
./website-template/custom-plugins/mkdocs-plugin-tags
mkdocs-git-revision-date-localized-plugin==0.11.1
pymdown-extensions==9.1
Jinja2==3.0.3

0
pages/articles/index.md Normal file
View File

0
pages/contact.md Normal file
View File

View File

View File

View File

@ -2,52 +2,65 @@
title: Conventional Commits
description: How to use No Fuss Computings gitlab-ci job for Conventional Commits
date: 2021-08-03
template: manual.html
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
## User Manual
Commitizen is used to validate the format of commit messages. we use [Conventional Commit Messages](https://www.conventionalcommits.org/en/v1.0.0/) format for our validation jobs.
This repository may have two CI jobs to do with commitizen:
- **MR Title** *Checks the Merge Request Title*
- **Commit Messages** *Checks all commit messages*
These CI Jobs output a test report that can be viewed inside of the merge request and contain the error(s), if any.
To fix an error please refer to the titled sections below.
### MR Title
Ensure that the merge request title is in the [conventional message](https://www.conventionalcommits.org/en/v1.0.0/) format. NOTE: the title is case sensitive.
### Commit Messages
All commit messages that form part of your merge request must be in [conventional message](https://www.conventionalcommits.org/en/v1.0.0/) format.
All commit messages that form part of your merge request must be in [conventional message](https://www.conventionalcommits.org/en/v1.0.0/) format.
To fix them go back and edit your commit messages.
#### fixing commit messages (suggestion)
If only the last commit is the commit with an error just use `git commit --amend` and edit your commit message to be in the correct format and save. now push your changes.
If only the last commit is the commit with an error just use `git commit --amend` and edit your commit message to be in the correct format and save. now push your changes.
You will require the following information if the commit message with the error is further down the commit tree:
- Commit message SHA1 of your first commit message to the branch `{original_commit}`
- Commit message SHA1 prior to your first commit `{source_commit}`
- Commit message SHA1 of your first commit message to the branch `{original_commit}`
- Commit message SHA1 prior to your first commit `{source_commit}`
Run these commands once you have the information above.
``` bash
git format-patch {original_commit}..HEAD -o diff-patches
git reset {source_commit} --hard
```
Now, navigate to the `diff-patches` folder, open up the offending patch (commit) and edit the `subject` or message body as appropriate and save. Once all the edits have been done, re-apply the patches to your tree with:
``` bash
git am diff-patches/*.patch
```
Now push your changes upstream.
| :notebook_with_decorative_cover: Note |
@ -60,20 +73,25 @@ Now push your changes upstream.
## Conventional Commits Admin Manual Manual
This job checks commit messages on a branch and the merge request title for validity against the [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/)
This job provides the following badge:
- None
### Dependencies
- None
### your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
``` yaml
variables:
GIT_SUBMODULE_STRATEGY: recursive
MY_PROJECT_ID: "{yourproject id number}"
@ -83,20 +101,23 @@ stages:
include:
- remote: https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/raw/development/conventional_commits/.gitlab-ci.yml
```
## CI/CD Variables required
| 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.
### Job Workflow
### Artifacts
### License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
!!! Note
Docs Still under development

View File

@ -2,7 +2,7 @@
title: Git push mirror
description: How to use No Fuss Computings gitlab-ci job for repository mirrororing
date: 2021-08-03
template: manual.html
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
@ -13,14 +13,18 @@ This job provides the following badge:
- None
## Dependencies
- None
## your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
``` yaml
stages:
- sync
@ -35,6 +39,7 @@ Github (Push --mirror):
```
## CI/CD Variables required
| var name | Description |
@ -44,9 +49,10 @@ Github (Push --mirror):
## Job Workflow
- This job is designed to run on successful completion of the validation tasks and only on the `development` and `master` branches. You can safely override the `rules` when creating the job with your own. i.e.
- This job is designed to run on successful completion of the validation tasks and only on the `development` and `master` branches. You can safely override the `rules` when creating the job with your own. i.e.
``` yaml
Github (Push --mirror):
variables:
GIT_SYNC_URL: "https://${username variable}:${pasword variable}@github.com/NoFussComputing/gitlab-ci.git"
@ -57,12 +63,15 @@ Github (Push --mirror):
when: never
- if: '$CI_COMMIT_BRANCH == "development"'
when: always
```
This will cause the job to only run on the `development` branch.
## Artifacts
- None
- None
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
!!! Note
Docs Still under development

View File

@ -2,37 +2,45 @@
title: Gitlab Release / Commit Footer References
description: How to use No Fuss Computings gitlab-ci job for Gitlab Releases and commit footer messages
date: 2021-08-03
template: manual.html
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
# User Manual
## User Manual
All commit messages must be in [conventional commit format](https://www.conventionalcommits.org/en/v1.0.0/) and have a footer with a gitlab reference. The reference **must** be either a merge request or a gitlab issue. (format i.e. `!1` or `#2` *using the correct reference number*).
### fixing commit messages (suggestion)
## fixing commit messages (suggestion)
If only the last commit is the commit with an error just use `git commit --amend` and edit your commit message to be in the correct format and save. now push your changes.
If only the last commit is the commit with an error just use `git commit --amend` and edit your commit message to be in the correct format and save. now push your changes.
You will require the following information if the commit message with the error is further down the commit tree:
- Commit message SHA1 of your first commit message to the branch `{original_commit}`
- Commit message SHA1 prior to your first commit `{source_commit}`
- Commit message SHA1 of your first commit message to the branch `{original_commit}`
- Commit message SHA1 prior to your first commit `{source_commit}`
Run these commands once you have the information above.
``` bash
git format-patch {original_commit}..HEAD -o diff-patches
git reset {source_commit} --hard
```
Now, navigate to the `diff-patches` folder, open up the offending patch (commit) and edit the `subject` or message body as appropriate and save. Once all the edits have been done, re-apply the patches to your tree with:
``` bash
git am diff-patches/*.patch
```
Now push your changes upstream.
| :notebook_with_decorative_cover: Note |
@ -44,12 +52,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* |
## Gitlab Release - Developer Manual
# Gitlab Release - Developer Manual
This job bumps the version, updates the changelog, creates a git tag and creates a gitlab release. The git tag and release title use [semantic versioning](https://semver.org/). for this job to function correctly a `.cz.yaml` is required in the root of the repository. this file contains the [commitizen](https://github.com/commitizen-tools/commitizen) config and the version details.
This job 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:
@ -68,16 +73,20 @@ This job provides the following badge:
- None
## Dependencies
### Dependencies
- None
## your .gitlab-ci.yml changes
### your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
CI Job `ci commit footer` is automatically set to run on all branches except `development` and `master`. This job checks the commits on the users branch that they contain a footer with gitlab references. i.e. `#1` for issue one or `!1` for merge request one.
``` yaml
stages:
- validate
- release
@ -90,11 +99,13 @@ Gitlab Release:
MY_COMMAND: "{your command here}"
extends:
- .gitlab_release
```
> if you wish to run any commands you can add them to variable `MY_COMMAND`. The custom command will run under shell `/bin/sh`. This command is set to run before the version bump commit is conducted so any changes you wish to add as part of the version bump, you can do here as long as you `git add {changed file name}`.
## CI/CD Variables required
### CI/CD Variables required
| var name | Description |
|:----:|:----|
@ -102,14 +113,18 @@ Gitlab Release:
| CHANGELOG_FOOTER_REFERENCES | ***Optional** If set to `False` the changelog will not output gitlab references for each entry of the changelog. If this variable is set globally, it will also prevent the creation of the CI job to validate a users commits as having gitlab references.* |
## Job Workflow
### Job Workflow
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. 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** |
@ -117,7 +132,7 @@ This CI job's workflow is:
| *If the user has forked the branch, they must keep the development brnach synced with the main repo. If they **don't** the CI job 'commit footer refs' will fail as it will not be able to fetch the parent (`development`) hash of the branch.* |
## Artifacts
### Artifacts
- `ci commit footer`
> $CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$CI_JOB_NAME.junit.xml
@ -125,6 +140,5 @@ This CI job's workflow is:
- `Gitlab Release`
> None
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
!!! Note
Docs Still under development

View File

@ -0,0 +1,107 @@
---
title: No Fuss Computings Gitlab-CI Project
description: How to use No Fuss Computings gitlab-ci project within your CI/CD pipelines
date: 2023-05-22
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
!!! Note
Docs Still under development
## Docs ToDo
- Templates folder is for `gitlab-ci.yaml` that automagically create the jobs if included
- other sub folders are for `` which **DO NOT** automagically create jobs, but are pure definitions only.
## CI Stages
The CI stages for these jobs are as follows, and in the order expected by the jobs:
- validation
> validation of files, commits, Merge Request titles, code quality, license checks.
- build
> build any binaries or files that would be used in the later stages .
- prepare
> any jobs that must run after build but before testing. for example a docker image build that includes artifacts from the build job
- test
> unit, functional, integration and any other tests.
- release
> git tagging and creating a gitlab release. Also includes adding build artifacts to gitlab registry.
- sync
> repository synchronization, i.e. push mirror to github.
- publish
> placement of build objects to external sources
## Git Sub-Module setup
It is recommended that you set-up this repo as a git sub-module to your repo and that you configure it to a set commit/tag. This ensures that any change to `gitlab-ci` repo, does not effect your CI/CD jobs.
run the following commands:
``` bash
git submodule add -b {ref} https://gitlab.com/nofusscomputing/projects/gitlab-ci.git gitlab-ci
git submodule update --remote
```
!!! Tip
NOTE: `{ref}` should be replaced with the branch name, `master` is the stable branch and recommended. by default the sub-module will be created in folder `gitlab-ci`, it is recommended that you **don't** change this folder name.
You can also substitute the gitlab url with the github url `https://github.com/NoFussComputing/gitlab-ci.git` for the submodule if you desire. this repo is auto-synced with github on each change to the repo.
After each `git submodule update --remote` you will have to commit the sub-module update to your repo. Suggested commands as follows:
``` bash
git add .gitmodules
git add gitlab-ci
git commit -m "ci(gitlab-ci): updated to use version x
{your reason here or explain what is provided/changed}"
```
Then push the changes to your source.
## .gitlab-ci.yaml example
example:
``` yaml
include:
- project: nofusscomputing/projects/gitlab-ci
ref: master
file:
- .gitlab-ci_common.yaml
- $JOB_ROOT_DIR/{filepath to include here and is relative to the gitlab-ci repo root}
variables:
MY_PROJECT_ID: "{your_project_id}"
```
!!! Tip
Use a project import in your `.gitlab-ci.yml` file that is tied to a specific `ref`. for example a branch, commit or tag. Also ensure that the `gitlab-ci` `git sub-module` and the `ref` as part of the includes matches.*
## Artifacts
Any artifacts by jobs will be created in folders named after the stage.
preference is placed on jobs to output JUnit.xml test reports. This is because they are visible in merge requests.

View File

@ -1,4 +1,11 @@
# Markdown File Linting
---
title: Markdown File Linting
description: How to use No Fuss Computings gitlab-ci job for markdown linting
date: 2021-08-11
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
This job lints markdown files as part of the validation CI stage. It is designated to run on all branches. If any errors are found, the generated JUnit test report will let you know what errors were found.
You can include your linting rules in `.markdownlint.json` which should be within the root of your repository. for the available rules please see the [docs](https://github.com/DavidAnson/markdownlint/blob/main/README.md#rules--aliases).
@ -7,11 +14,14 @@ This job provides the following badge:
- _None_
## Dependencies
- **Optional** file `.markdownlint.json` in repository root with any rules you wish to specify
## your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
``` yaml
@ -28,12 +38,15 @@ Markdown Linting:
```
## CI/CD Variables required
| var name | Description |
|:----:|:----|
| MDLINT_PATH | **Optional** specifies the path to lint. defaults to `"**/*.md"` |
| MDLINT_EXCLUDE_PATHS | **optional** Specifies the paths to exclude from linting. Defaults to `"!gitlab-ci"` |
| MD_LINT_CONFIG-PATH | **Optional** Specifies a path whenre the lint config file is. defaults to none. this variable enables you to specify a config that will be copied to the project root folder. ***Note:** if specified, the file will be deleted at the end of the linting job.*
## Job Workflow
@ -41,9 +54,10 @@ Markdown Linting:
1. Lints any markdow file found in `$MDLINT_PATH`, excluding paths `$MDLINT_EXCLUDE_PATHS`
## Artifacts
- JUnit test report located at `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/*.junit.xml`
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
!!! Note
Docs Still under development

View File

@ -1,4 +1,12 @@
# MKDocs Static Site Build
---
title: MKDocs Static Site Build
description: How to use No Fuss Computings gitlab-ci job for MKDocs Static Site Build
date: 2021-08-11
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
Build a MKDocs site from the config specified in `mkdocs.yml`. _Only runs if `mkdocs.yml` exists in the repository root directory._ This job is designated to run on all branchs so that you can use the artifacts for deployment to `staging` and/or `production` as required.
This job provides the following badge:
@ -10,9 +18,11 @@ This job provides the following badge:
- **Mandatory** file `mkdocs.yml` in the repository root directory with your MKDocs configuration
## your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
``` yaml
stages:
- build
@ -27,6 +37,7 @@ MKDocs build:
```
## CI/CD Variables required
| var name | Description |
@ -35,6 +46,7 @@ MKDocs build:
| MKDOCS_INCLUDE_SOURCE | **Optional** Include the build source files in the artifacts. Default is Not set. Any value in this variable, will include the source files. |
| MKDOCS_SOURCE_PATH | **Optional, if source files are not to be included** Set to the path where mkdocs uses to build the static html. |
## Job Workflow
1. install mkdocs
@ -54,5 +66,5 @@ MKDocs build:
- files in `"$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME"`
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
!!! Note
Docs Still under development

View File

@ -2,7 +2,7 @@
title: Python
description: How to use No Fuss Computings gitlab-ci job for Python
date: 2021-08-11
template: manual.html
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
@ -15,7 +15,9 @@ These jobs provides the following badge:
- `PyLint` - code quality [![PyLint Score](https://img.shields.io/badge/dynamic/json?&style=plastic&logo=python&label=PyLint%20Score&query=%24.PyLintScore&url=https%3A%2F%2Fgitlab.com%2Fnofusscomputing%2Fprojects%2Fgitlab-ci%2F-%2Fjobs%2Fartifacts%2Fdevelopment%2Fraw%2Fartifacts%2Fvalidation%2FPyLint%2Fbadge_pylint.json%3Fjob%3DPyLint)](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/jobs/artifacts/development/file/artifacts/validation/tests/gl-code-quality-report.html?job=PyLint)
Use the following MD to add a badge adjusting the variables and ensuring everything is on one line.
``` md
[![PyLint Score](https://img.shields.io/badge/dynamic/json?&style=plastic&logo=python&label=PyLint%20Score&query=%24.PyLintScore&url=https%3A%2F%2Fgitlab.com%2F
{project path}
@ -44,7 +46,9 @@ artifacts/validation/tests/gl-code-quality-report.html
{Job Name}
)
```
| Variable | Description |
|:----|:----|
| `{project path}` | *project path, what's after gitlab.com/* |
@ -56,10 +60,13 @@ artifacts/validation/tests/gl-code-quality-report.html
- None
## your .gitlab-ci.yml changes
To add the `PyLint` job, add the following to your `.gitlab-ci.yml` file
``` yaml
stages:
- validation
@ -73,6 +80,7 @@ PyLint:
extends:
- .PyLint
image: python:3.6-slim
```
@ -86,13 +94,16 @@ PyLint:
## Job Workflow
- This job will lint any yaml file in the specified directory using the specified rules.
- This job will lint any yaml file in the specified directory using the specified rules.
## Artifacts
- `$CI_PROJECT_DIR/artifacts` - Root artifact directory
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.json` - Gitlab code quality report (displays in merge request)
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html` - html code quality report
- `$CI_PROJECT_DIR/artifacts` - Root artifact directory
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.json` - Gitlab code quality report (displays in merge request)
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/gl-code-quality-report.html` - html code quality report
!!! Note
Docs Still under development

View File

@ -2,7 +2,7 @@
title: Ansible
description: How to use No Fuss Computings gitlab-ci job for ansible
date: 2021-08-03
template: manual.html
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
@ -13,14 +13,18 @@ This job provides the following badge:
- None
## Dependencies
- None
## your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
``` yaml
stages:
- validation
@ -33,9 +37,12 @@ Ansible Lint (python 3.6):
extends:
- .ansible_linter_defaults
image: python:3.6-slim
```
> You can use any python version you wish.
## CI/CD Variables required
| var name | Description |
@ -45,13 +52,13 @@ Ansible Lint (python 3.6):
## Job Workflow
- This job will lint any yml file in the specified directory using ansible rules.
- This job will lint any yml file in the specified directory using ansible rules.
## Artifacts
- `$CI_PROJECT_DIR/artifacts` - Root artifact directory
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-ansible-lint.junit.xml` - JUnit Test report
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-ansible-lint.log` - Linter log
- `$CI_PROJECT_DIR/artifacts` - Root artifact directory
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-ansible-lint.junit.xml` - JUnit Test report
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-ansible-lint.log` - Linter log

View File

@ -2,17 +2,19 @@
title: Docker Container CI Template
description: How to use No Fuss Computings gitlab-ci template for docker containers
date: 2023-05-13
template: manual.html
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
- available tags `dev` for latest dev build
- latest matches latest git tag
- notate available platforms can be viewed in the job
``` yaml
# Available platforms: linux/amd64, linux/amd64/v2, linux/amd64/v3, linux/arm64, linux/riscv64, linux/ppc64, linux/ppc64le, linux/s390x, linux/386, linux/mips64le, linux/mips64, linux/arm/v7, linux/arm/v6
# DOCKER_IMAGE_BUILD_TARGET_PLATFORMS: "linux/amd64,linux/arm64,linux/arm/v7"
DOCKER_IMAGE_BUILD_NAME: $CI_PROJECT_NAME
@ -26,4 +28,8 @@ about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
# JOB_STOP_GIT_PUSH_MIRROR: 'any_value'
# GIT_SYNC_URL: "https://$GITHUB_USERNAME_ROBOT:$GITHUB_TOKEN_ROBOT@github.com/NoFussComputing/config.git" # Must be defined for job to run
# JOB_STOP_GITLAB_RELEASE: 'any value'
```
```
!!! Note
Docs Still under development

View File

@ -0,0 +1,18 @@
---
title: Gitlab-CI Job Templates
description: How to use No Fuss Computings gitlab-ci project within your CI/CD pipelines
date: 2023-05-22
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
As part of our Gitlab CI job definitions we also have gitlab-ci.yaml templates that are specifically designed for inclusion and will automagically add the required jobs.
## Docs ToDo
- all templates are in the template folder.
- explain `.gitlab-ci_common.yaml` is for inclusion by all, _suggested._ and will never create jobs, only specify defaults. is also included in all templates
!!! Note
Docs Still under development

View File

@ -0,0 +1,15 @@
---
title: Website Gitlab CI/CD Template
description: How to use No Fuss Computings gitlab-ci template for website jobs
date: 2023-05-22
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
This template creates the jobs applicable to publishing pages to a website. The website in question is a static site built by MKDocs.
!!! Note
This template is specifically designed for deployment to https://nofusscomputing.com. However you _may_ be able to override the job definition to use it for your website.
!!! Note
Docs Still under development

View File

@ -2,25 +2,28 @@
title: YAML Linting
description: How to use No Fuss Computings gitlab-ci job for YAML Linting
date: 2021-08-11
template: manual.html
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
This job does yaml linting when any commit is pushed to any branch.
This job provides the following badge:
- None
## Dependencies
- None
## your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
``` yaml
stages:
- validation
@ -34,9 +37,12 @@ Yaml Lint (python 3.6):
extends:
- .yaml_linter_defaults
image: python:3.6-slim
```
> You can use any python version you wish.
## CI/CD Variables required
| var name | Description |
@ -47,13 +53,17 @@ Yaml Lint (python 3.6):
## Job Workflow
- This job will lint any yaml file in the specified directory using the specified rules.
- This job will lint any yaml file in the specified directory using the specified rules.
## Artifacts
- `$CI_PROJECT_DIR/artifacts` - Root artifact directory
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-yaml-lint.junit.xml` - JUnit Test report
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-yaml-lint.log` - Linter log
- `$CI_PROJECT_DIR/artifacts` - Root artifact directory
## License
To view the license for this folder and any sub-folders, refer [here](https://gitlab.com/nofusscomputing/projects/gitlab-ci)
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/tests/$PYTHON_VERSION-yaml-lint.junit.xml` - JUnit Test report
- `$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/$PYTHON_VERSION-yaml-lint.log` - Linter log
!!! Note
Docs Still under development

0
pages/projects/index.md Normal file
View File

0
pages/tags.md Normal file
View File

View File

@ -0,0 +1,50 @@
# This gitlab-ci file is used for creating building pages directories for nofusscomputing.com.
# by including this file, the jobs will be autocreated and only for pages jobs.
include:
- local: $JOB_ROOT_DIR/.gitlab-ci_common.yaml
- local: $JOB_ROOT_DIR/mkdocs/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/lint/markdown.gitlab-ci.yaml
Website.Lint:
extends: .Lint_Markdown_Pages
Website.Build:
extends: .MKDocs_Build
needs: [ 'Website.Lint' ]
pages:
stage: deploy
variables:
GIT_STRATEGY: none
script:
- mv "$CI_PROJECT_DIR/artifacts/build/Website.Build/build" public
needs: [ 'Website.Build' ]
environment:
name: staging
url: $CI_PAGES_URL/projects/gitlab-ci/
artifacts:
paths:
- public
rules:
- if: '$JOB_STOP_GITLAB_PAGES'
when: never
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
when: never
- if: $CI_COMMIT_TAG
when: never
- if: '$CI_COMMIT_BRANCH == "development"'
exists:
- "mkdocs.yaml"
- "mkdocs.yml"
when: always
- if: '$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != "master"'
exists:
- "mkdocs.yaml"
- "mkdocs.yml"
when: manual
allow_failure: true
- when: never

View File

@ -1,19 +0,0 @@
# Changelog
2023-05-14 15:45:30 +0930 [8581981](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8581981a43c31d6903865f067fa3f77adae949e5) - fix(markdown_lint): fix search paths
2023-05-14 12:44:08 +0930 [cf10e28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/cf10e289d21a5cc529bbe7effb189aab65875510) - fix(markdown_lint): enable job for md in sub folders
2022-01-31 10:19:16 +0930 [d75e959](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/d75e95998b4a195cfcc36683ffa6f058bf7b05be) - feat(markdown_lint): artifact locations to be hard set
2022-01-31 10:15:54 +0930 [8391bf6](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/8391bf659bf5dd39edf31205a68c699851e78be3) - fix(markdown_lint): remove quotes from search path variable.
2022-01-25 00:08:05 +0000 [ce1cc01](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/ce1cc017e26ff7f6cee586cc7d98e4d292275672) - build(version): bump version 0.6.0 → 0.6.1rc0
2022-01-25 09:23:42 +0930 [e0402ec](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e0402ecfb2ab662a74bb70df7937b02576d5e41b) - fix(lint_markdown): ensure the correct path for the job directory is used
2022-01-24 06:33:24 +0000 [46cc1fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/46cc1fbb6a878e485af39e679b5184a9912c2e7f) - build(version): bump version 0.5.0 → 0.6.0
2022-01-24 05:14:54 +0000 [b6dcb47](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/b6dcb47b1d1831784d36f482fd99c0ce5e56f088) - docs(markdown_lint): removed no longer needed requirement.
2022-01-23 06:53:57 +0000 [fd48316](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/fd48316ae763282fc106b7da184c05b35d9ae052) - docs(markdown_lint): updated docs on how to use and view rules.
2022-01-23 06:48:42 +0000 [9ab336f](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/9ab336fbddd6cba1d29c5a001ab52772ed4554b6) - feat(markdown_lint): include junit configuration file '.markdownlint-cli2.jsonc' in ci job.
2022-01-23 06:39:23 +0000 [e46dc57](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e46dc57b1643d6fd7c393bcf8b7d1d77bd2096c8) - chore(markdown_lint): add empty junit test file.
2022-01-23 03:21:43 +0000 [2115964](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/21159643176249cbc33df3a655df90267d64bc3b) - chore: review fixes.
2022-01-23 03:19:58 +0000 [e0d8885](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/e0d8885d52319a6188c779e80c2064b773721184) - ci(artifacts): markdown lint and mkdocs build artifacts to expire after 24 hours
2022-01-23 11:05:07 +0930 [6363ea3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6363ea377cd008bbc839e6f4ee4fca337b77bc19) - docs(markdown_lint): completed the job docs.
2022-01-23 10:43:54 +0930 [6383cde](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/6383cde3bf9985b2cb43908bc2486d1dc67b7026) - docs(markdown_lint): initial adding of the docs
2022-01-23 10:03:02 +0930 [954aa28](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/954aa28dbf1073be05a3dd6d13da818a0bc7cb4e) - feat(validation): Added a Markdown linting validation job.
2022-01-23 09:52:30 +0930 [bc67e93](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bc67e939faf0b3d2eac05eae7edf297c81e55739) - chore: initial add of build and validation jobs for mkdocs and markdown linting