Merge branch 'big-fixes' into 'development'

chore: general fixes and dev

Closes #30, #27, and #26

See merge request nofusscomputing/projects/gitlab-ci!34
This commit is contained in:
2023-05-29 02:31:48 +00:00
11 changed files with 168 additions and 40 deletions

View File

@ -1,5 +1,6 @@
stages:
- chores
- validation
- build
- prepare
@ -11,7 +12,7 @@ stages:
include:
- local: $JOB_ROOT_DIR/lint/yaml.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/template/website.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/template/automagic.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/conventional_commits/.gitlab-ci.yml
- local: $JOB_ROOT_DIR/git_push_mirror/.gitlab-ci.yml
@ -119,15 +120,3 @@ gilab-ci.yml Lint (python 3.11):
extends:
- .yaml_lint_defaults
image: python:3.11-slim
Gitlab Release:
variables:
MY_COMMAND: ./sub-folder_changlog.sh
extends:
- .gitlab_release
Github (Push --mirror):
extends:
- .git_push_mirror

View File

@ -1,10 +0,0 @@
# Changelog
2023-05-27 14:04:10 +0930 [1f6ee9e](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/1f6ee9ea27824df1c82bf85e1e239f57f2145bdf) - refactor(automation): final logic changes
2023-05-24 04:40:52 +0000 [0a17fe1](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/0a17fe1aa320c658c05d7a693ff76af4a54e6130) - build(version): bump version 0.6.1rc1 → 0.6.1rc2
2023-05-23 12:42:16 +0930 [bcb8035](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bcb80358d9adb6b3a89fab1003f4434fb2949bdc) - ci(pages): add pages slug
2023-05-23 10:00:27 +0930 [28c04fb](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/28c04fb2e854521167367161d13b09650829d17d) - docs: add job definitions to page
2023-05-23 09:46:43 +0930 [7a9aca3](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7a9aca3a54b1faacb7e286bade84aff0ff4fd2e5) - fix(mkdocs): default to docs directory as root
2023-05-23 09:33:21 +0930 [657df7a](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/657df7a5ceb59798c7bb072aed5bf7ef82aef9b6) - docs: add job definition to page
2023-05-23 09:22:18 +0930 [bb2cddf](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/bb2cddf70bd883636f117453df640e91f1662c39) - chore: remove unneeded fils from docs
2023-05-23 09:10:19 +0930 [7c385b7](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/7c385b7552945699eb87ec3ec43169df0cb77297) - refactor(docs): pages dir renamed to docs

View File

@ -0,0 +1,80 @@
---
title: Ansible Playbook
description: How to use No Fuss Computings gitlab-ci job for running Ansible Playbooks
date: 2023-05-29
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
This job enables you to run an Ansible playbook within the Gitlab CI/CD environment.
This job provides the following badge:
- None
## Dependencies
- **Mandatory** file `.nfc_automation.yaml` see [Documentation](../git_configuration/submodule/) for file details.
## your .gitlab-ci.yml changes
To use this job add the following to your `.gitlab-ci.yml` file
``` yaml
stages:
- chores
include:
- project: nofusscomputing/projects/gitlab-ci
ref: master
file:
- automation/.gitlab-ci-ansible.yaml
Ansible Job:
extends: .ansible_playbook
variables:
ansible_playbook: 'git_configuration.yaml'
ansible_tags: 'submodule'
PIPELINE_RUN_TRIGGER: 'false'
PIPELINE_RUN_SCHEDULE: 'false'
```
!!! Tip
You can optionally override the stage by specifying the job you define
## CI/CD Variables required
| 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.* |
!!! 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
## Job Workflow
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.
## Artifacts
- None
## gitlab-ci.yml definition
``` yaml title=".gitlab-ci.yml" linenums="1"
--8<-- "automation/.gitlab-ci-ansible.yaml"
```

View File

@ -0,0 +1,27 @@
---
title: Automatic Gitlab CI/CD jobs Template
description: How to use No Fuss Computings gitlab-ci template for auto creation of CI/CD joobs.
date: 2023-05-22
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
---
This template is designed to autodetect which jobs should be created. By including it within your project, the jobs will be automagically created for the pipeline.
## Docs ToDo
- .
!!! Note
Docs Still under development
## gitlab-ci.yml definition
``` yaml title=".gitlab-ci.yml" linenums="1"
--8<-- "template/automagic.gitlab-ci.yaml"
```

View File

@ -1,6 +1,6 @@
---
title: Website Gitlab CI/CD Template
description: How to use No Fuss Computings gitlab-ci template for website jobs
title: mkdocs documentation Gitlab CI/CD Template
description: How to use No Fuss Computings gitlab-ci template for building docs with mkdocs
date: 2023-05-22
template: project.html
about: https://gitlab.com/nofusscomputing/projects/gitlab-ci
@ -14,9 +14,19 @@ 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.
## Dependencies
- **Mandatory** file `docs/index.md` this is the index page of your dcoumentation.
!!! 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
## gitlab-ci.yml definition
``` yaml title=".gitlab-ci.yml" linenums="1"
--8<-- "template/mkdocs-documentation.gitlab-ci.yaml"
```

View File

@ -39,10 +39,17 @@
when: never
- if: '$CI_COMMIT_BRANCH == "master" &&
( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline")'
exists:
- 'tasks/main.yaml'
when: always
- if: '$CI_COMMIT_TAG'
exists:
- 'tasks/main.yaml'
when: always
- if: '$CI_COMMIT_BRANCH'
- if: '$CI_COMMIT_BRANCH &&
( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline")'
exists:
- 'tasks/main.yaml'
when: always
- when: never

View File

@ -23,6 +23,10 @@ nav:
- projects/gitlab-ci/mkdocs-build.md
- Chores:
- projects/gitlab-ci/ansible_playbook.md
- Linting:
- projects/gitlab-ci/markdown_lint.md
@ -35,9 +39,11 @@ nav:
- projects/gitlab-ci/templates/ansible_roles.md
- projects/gitlab-ci/templates/automagic.md
- projects/gitlab-ci/templates/docker_container.md
- projects/gitlab-ci/templates/website.md
- projects/gitlab-ci/templates/documentation_mkdocs.md
- Validation:

View File

@ -37,3 +37,24 @@
when: always
- when: never
.MKDocs_Build_Docs:
extends: .MKDocs_Build
variables:
MKDOCS_SOURCE_PATH: docs
needs:
- pipeline: $CI_PIPELINE_ID
job: 'Website.Lint'
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 &&
( $CI_PIPELINE_SOURCE == "push" || $CI_PIPELINE_SOURCE == "pipeline")'
exists:
- "docs/index.md"
when: always
- when: never

View File

@ -3,7 +3,7 @@
for D in *; do
if [ -d "${D}" ]; then
if [ "0${D}" != "0website-template" ]; then
if [ "0${D}" != "0website-template" ] && [ "0${D}" != "0docs" ]; then
echo "[DEBUG] Creating changelog for sub-folder: ${D}"
CHANGELOG_DATA=$(git log --pretty="format:%ci [%h](https://gitlab.com/nofusscomputing/projects/gitlab-ci/-/commit/%H) - %s " --follow -- "${D}")

View File

@ -21,8 +21,9 @@ include:
- local: $JOB_ROOT_DIR/gitlab_release/.gitlab-ci.yml
# templates
- local: $JOB_ROOT_DIR/template/ansible-role.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/template/docker-image.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/template/website.gitlab-ci.yaml
- local: $JOB_ROOT_DIR/template/mkdocs-documentation.gitlab-ci.yaml
#

View File

@ -7,25 +7,22 @@ include:
- local: $JOB_ROOT_DIR/lint/markdown.gitlab-ci.yaml
Website.Lint:
Documentation.Lint:
extends: .Lint_Markdown_Docs
Website.Build:
variables:
MKDOCS_SOURCE_PATH: docs
extends: .MKDocs_Build
needs: [ 'Website.Lint' ]
Documentation.Build:
extends: .MKDocs_Build_Docs
needs: [ 'Documentation.Lint' ]
pages:
stage: deploy
variables:
GIT_STRATEGY: none
PAGES_ENVIRONMENT_PATH: ''
script:
- mv "$CI_PROJECT_DIR/artifacts/build/Website.Build/build" public
needs: [ 'Website.Build' ]
- mv "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build" public
needs: [ 'Documentation.Build' ]
environment:
name: staging
url: $CI_PAGES_URL/$PAGES_ENVIRONMENT_PATH