Compare commits
70 Commits
master
...
automated-
Author | SHA1 | Date | |
---|---|---|---|
c2028e8702 | |||
a890e93c44 | |||
96b63cd7c6 | |||
522275c324 | |||
433770ffa3 | |||
e649d7e711 | |||
5f59921c70 | |||
4efb97b728 | |||
20726d1712 | |||
bf732b3238 | |||
e415c4f112 | |||
e0ca7c7a25 | |||
03f88d7300 | |||
acf5d9fe58 | |||
b22bde4f61 | |||
1eb98c187b | |||
3458e89ee0 | |||
3b8a8b8e9e | |||
b2afb094bb | |||
deb01d8774 | |||
2bcf3c99a7 | |||
9533f47a3b | |||
c15f2e0ea9 | |||
a6bff682c2 | |||
c59a0f6b7f | |||
fa93149ac6 | |||
bbccb0260a | |||
80cfabbbb7 | |||
99d5cd36e3 | |||
f5def60091 | |||
f87051432c | |||
3481b1229b | |||
33c4f17324 | |||
4b666a5c04 | |||
e12b0a1ef3 | |||
7a4161e2a2 | |||
6692e90318 | |||
57b00bc8f7 | |||
185d3eec8c | |||
d42f0901ed | |||
c0d589f70a | |||
649055c2e9 | |||
e3e8417130 | |||
1788673523 | |||
809b4457d9 | |||
955e30ba31 | |||
85de8dcd64 | |||
7d7fd5b4c1 | |||
58130b365d | |||
2eeb1a4cee | |||
4b129fe0f5 | |||
844cb0cb73 | |||
14a115d984 | |||
4bdf9d6f00 | |||
fc3869798e | |||
aba4b88509 | |||
020de5681f | |||
6c430c9384 | |||
a72ceafd34 | |||
f65a738621 | |||
3d484f8dd1 | |||
b20906f38a | |||
cd8088345e | |||
8b61229d33 | |||
f83c40ca87 | |||
1eaa5c1c68 | |||
ba00bf5ba4 | |||
0e25bc5909 | |||
eac92e72fb | |||
4f320158ad |
478
.gitlab-ci.yml
478
.gitlab-ci.yml
@ -5,317 +5,197 @@ variables:
|
||||
|
||||
|
||||
include:
|
||||
|
||||
- local: .gitlab/project_docs.gitlab-ci.yml
|
||||
|
||||
- project: nofusscomputing/projects/gitlab-ci
|
||||
ref: development
|
||||
file:
|
||||
- .gitlab-ci_common.yaml
|
||||
- template/automagic.gitlab-ci.yaml
|
||||
|
||||
|
||||
|
||||
Get Project Documentation:
|
||||
extends: .fetch_project_docs
|
||||
parallel:
|
||||
matrix:
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: firewall
|
||||
ASSEMBLE_PROJECT_ID: 51640016
|
||||
ASSEMBLE_PROJECT_PATH: projects/ansible/collection/firewall
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: django_template
|
||||
ASSEMBLE_PROJECT_ID: 57560288
|
||||
ASSEMBLE_PROJECT_PATH: projects/django-template
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: kubernetes
|
||||
ASSEMBLE_PROJECT_ID: 51640029
|
||||
ASSEMBLE_PROJECT_PATH: projects/ansible/collection/kubernetes
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: netbox
|
||||
ASSEMBLE_PROJECT_ID: 56568566
|
||||
ASSEMBLE_PROJECT_PATH: projects/ansible/collection/netbox
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: phpipam_scan_agent
|
||||
ASSEMBLE_PROJECT_ID: 55052132
|
||||
ASSEMBLE_PROJECT_PATH: projects/ansible/collection/phpipam_scan_agent
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: gitlab-ci
|
||||
ASSEMBLE_PROJECT_ID: 28543717
|
||||
ASSEMBLE_PROJECT_PATH: projects/gitlab-ci
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: operations
|
||||
ASSEMBLE_PROJECT_ID: 32419575
|
||||
ASSEMBLE_PROJECT_PATH: operations
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: git_configuration
|
||||
ASSEMBLE_PROJECT_ID: 45705596
|
||||
ASSEMBLE_PROJECT_PATH: projects/ansible/roles/git_configuration
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: docker-bind
|
||||
ASSEMBLE_PROJECT_ID: 52098058
|
||||
ASSEMBLE_PROJECT_PATH: projects/docker/bind
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: docker-mail
|
||||
ASSEMBLE_PROJECT_ID: 33611657
|
||||
ASSEMBLE_PROJECT_PATH: projects/docker-mail
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: execution_environment
|
||||
ASSEMBLE_PROJECT_ID: 45741845
|
||||
ASSEMBLE_PROJECT_PATH: projects/ansible/execution_environment
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: ldap_self_service
|
||||
ASSEMBLE_PROJECT_ID: 48321671
|
||||
ASSEMBLE_PROJECT_PATH: projects/ldap_self_service
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: docker-glpi
|
||||
ASSEMBLE_PROJECT_ID: 12928828
|
||||
ASSEMBLE_PROJECT_PATH: projects/glpi
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: kubernetes_monitoring
|
||||
ASSEMBLE_PROJECT_ID: 50510268
|
||||
ASSEMBLE_PROJECT_PATH: projects/kubernetes_monitoring
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: ansible_playbooks
|
||||
ASSEMBLE_PROJECT_ID: 46364551
|
||||
ASSEMBLE_PROJECT_PATH: projects/ansible/playbooks
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: common
|
||||
ASSEMBLE_PROJECT_ID: 52226103
|
||||
ASSEMBLE_PROJECT_PATH: projects/ansible/roles/common
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: homeassistant
|
||||
ASSEMBLE_PROJECT_ID: 51020674
|
||||
ASSEMBLE_PROJECT_PATH: projects/ansible/roles/homeassistant
|
||||
|
||||
- ASSEMBLE_PROJECT_NAME: itil_runbooks
|
||||
ASSEMBLE_PROJECT_ID: 54680811
|
||||
ASSEMBLE_PROJECT_PATH: projects/itil/runbooks
|
||||
|
||||
# - ASSEMBLE_PROJECT_NAME:
|
||||
# ASSEMBLE_PROJECT_ID:
|
||||
# ASSEMBLE_PROJECT_PATH:
|
||||
|
||||
|
||||
Documentation.Lint:
|
||||
rules:
|
||||
- when: never
|
||||
|
||||
|
||||
Documentation.Build:
|
||||
rules:
|
||||
- when: never
|
||||
|
||||
|
||||
Website.Lint:
|
||||
extends: .Lint_Markdown_Docs
|
||||
variables:
|
||||
MDLINT_PATHS: "pages/*.md pages/**/*.md pages/**/**/*.md pages/**/**/**/*.md pages/**/**/**/**/**/*.md #CHANGELOG.md !gitlab-ci !website-template"
|
||||
|
||||
rules:
|
||||
- if: '$JOB_STOP_LINT_MARKDOWN_DOCS'
|
||||
when: never
|
||||
|
||||
- if: # condition_git_tag
|
||||
$CI_COMMIT_TAG != null &&
|
||||
$CI_COMMIT_BRANCH == null
|
||||
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 &&
|
||||
(
|
||||
$CI_PIPELINE_SOURCE == "api"
|
||||
||
|
||||
$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'
|
||||
# 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" &&
|
||||
$CI_PIPELINE_SOURCE == "push"
|
||||
exists:
|
||||
- '{docs/**,pages/**}/*.md' # works
|
||||
changes:
|
||||
paths:
|
||||
#- '{docs/*,pages/*}*.md'
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
compare_to: 'development'
|
||||
when: always
|
||||
|
||||
- when: never
|
||||
|
||||
|
||||
Website.Build:
|
||||
extends: .MKDocs_Build
|
||||
needs: [ 'Website.Lint' ]
|
||||
resource_group: build
|
||||
|
||||
|
||||
Assemble.Website.Prepare:
|
||||
# extends: .MKDocs_Build
|
||||
stage: prepare
|
||||
# image: python:3.7.5-buster
|
||||
# turn mkdocs build template script section to a command template so that customizations can be added.
|
||||
script:
|
||||
- mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/source"
|
||||
# - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build"
|
||||
- echo "fetch artifacts from child repo's"
|
||||
- echo "copy static pages source to" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/source"
|
||||
- echo "copy sub-repo source to (merge)" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/source"
|
||||
- echo "mkdocs build source dir"
|
||||
# - mkdir -p "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/full-site"
|
||||
- mv "$CI_PROJECT_DIR/artifacts/build/Website.Build/build" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/"
|
||||
#- ls -laR $CI_PROJECT_DIR
|
||||
# remove ops placeholder index.html
|
||||
|
||||
# Project: Operations
|
||||
- echo "[DEBUG] fetch operations docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/32419575/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output operations-artifacts.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/32419575/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip operations-artifacts.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/operations/index.html";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/operations" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
# Project: Gitlab-CI
|
||||
- echo "[DEBUG] fetch gitlab-ci project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/28543717/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output gitlab-ci-artifacts.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/28543717/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip gitlab-ci-artifacts.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/gitlab-ci";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/gitlab-ci" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/gitlab-ci/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
# Project: ansible role, git_configuration
|
||||
- echo "[DEBUG] fetch git_configuration project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/45705596/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output git_configuration-artifacts.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/45705596/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip git_configuration-artifacts.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/git_configuration";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/git_configuration" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/git_configuration/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
# Project: Docker Mail Server
|
||||
- echo "[DEBUG] fetch docker-mail project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/33611657/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output docker-mail-artifacts.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/33611657/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip docker-mail-artifacts.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/docker-mail";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/docker-mail" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/docker-mail/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
# Project: Ansible Execution Environment
|
||||
- echo "[DEBUG] fetch execution_environment project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/45741845/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output execution_environment-artifacts.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/45741845/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip execution_environment-artifacts.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/execution_environment";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/execution_environment" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/execution_environment/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
# Project: NodeRED LDAP Self Service
|
||||
- echo "[DEBUG] fetch nodered_ldap_self_service project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/48321671/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output nodered_ldap_self_service-artifacts.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/48321671/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip nodered_ldap_self_service-artifacts.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ldap_self_service";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/ldap_self_service" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ldap_self_service/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
# Project: docker GLPI
|
||||
- echo "[DEBUG] fetch docker-glpi project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/12928828/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output docker-glpi-artifacts.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/12928828/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip docker-glpi-artifacts.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/glpi";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/glpi" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/glpi/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
|
||||
# Project: kubernetes monitoring helm chart
|
||||
- echo "[DEBUG] fetch kubernetes_monitoring project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/50510268/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output kubernetes_monitoring.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/50510268/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip kubernetes_monitoring.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/kubernetes_monitoring";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/kubernetes_monitoring" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/kubernetes_monitoring/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
|
||||
# Project: Ansible Public Playbooks
|
||||
- echo "[DEBUG] fetch Ansible Public Playbooks project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/46364551/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output ansible_playbooks.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/46364551/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip ansible_playbooks.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/playbooks";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/ansible/playbooks" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/playbooks/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
|
||||
# Project: Ansible role common
|
||||
- echo "[DEBUG] fetch Ansible common project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/52226103/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output nfc_common.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/52226103/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip nfc_common.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/roles/common";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/ansible/roles/common" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/roles/common/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
|
||||
# Project: Ansible role firewall
|
||||
- echo "[DEBUG] fetch Ansible firewall project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/51640016/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output nfc_firewall.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/51640016/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip nfc_firewall.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/roles/firewall";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/ansible/roles/firewall" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/roles/firewall/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
|
||||
# Project: Ansible role homeassistant
|
||||
- echo "[DEBUG] fetch Ansible Public homeassistant project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/51020674/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output nfc_homeassistant.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/51020674/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip nfc_homeassistant.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/roles/homeassistant";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/ansible/roles/homeassistant" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/roles/homeassistant/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
|
||||
# Project: Ansible role kubernetes
|
||||
- echo "[DEBUG] fetch Ansible kubernetes project docs"
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/51640029/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
# exit 1;
|
||||
else
|
||||
curl --location --output nfc_kubernetes.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/51640029/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
unzip nfc_kubernetes.zip;
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/roles/kubernetes";
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/projects/ansible/roles/kubernetes" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/ansible/roles/kubernetes/";
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
# # below 2 lines commented out as need to ffigure out how to download artifacts.
|
||||
# - rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/operations/index.html"
|
||||
# - echo "cp -rvn" "$CI_PROJECT_DIR/artifacts/build/Website.Build/build/operations" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/"
|
||||
|
||||
|
||||
# # copy ops pages into main site, not overwriting
|
||||
# #- cp -rvn "$CI_PROJECT_DIR/artifacts/build/Static Pages/build/"* "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/"
|
||||
|
||||
|
||||
# # below line commented out as need to ffigure out how to download artifacts.
|
||||
# - cp -rvf "$CI_PROJECT_DIR/artifacts/build/Website.Build/build/operations" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/"
|
||||
|
||||
- echo "copy prepare files (sitemap, search file) to fullsite (overwrite)"
|
||||
- echo "copy each sub-repo build to fullsite (merge)"
|
||||
# - echo mv "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/full-site" public
|
||||
needs:
|
||||
- 'Website.Build'
|
||||
# only available in gitlab premium
|
||||
# use: - "curl -O --header 'PRIVATE-TOKEN: ${GITLAB_API_TOKEN}' https://gitlab.example.com/api/v4/projects/${PROJECT_A_ID}/jobs/${REMOTE_JOB_ID}/artifacts/${REMOTE_FILENAME}"
|
||||
# - project: nofusscomputing/ops
|
||||
# job: Static Pages
|
||||
# ref: development
|
||||
# artifacts: true
|
||||
artifacts:
|
||||
expire_in: 24 hrs
|
||||
when: always
|
||||
paths:
|
||||
- "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/*"
|
||||
resource_group: build
|
||||
rules:
|
||||
# - if: '$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != "master" && $CI_PIPELINE_SOURCE == "push"'
|
||||
# when: always
|
||||
|
||||
# Build docs on tag so they can be downloaded from the tag job and are always available.
|
||||
- if: '$JOB_STOP_MKDOCS_BUILD'
|
||||
when: never
|
||||
|
||||
- if: # condition_git_tag
|
||||
$CI_COMMIT_TAG != null &&
|
||||
$CI_COMMIT_BRANCH == null
|
||||
exists:
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
- 'mkdocs.{yaml,yml}'
|
||||
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:
|
||||
# - 'mkdocs.{yaml,yml}'
|
||||
# when: always
|
||||
|
||||
- if: # condition_dev_branch_push
|
||||
$CI_COMMIT_BRANCH == "development" &&
|
||||
$CI_COMMIT_BRANCH &&
|
||||
(
|
||||
$CI_PIPELINE_SOURCE == "api"
|
||||
||
|
||||
$CI_PIPELINE_SOURCE == "pipeline"
|
||||
||
|
||||
$CI_PIPELINE_SOURCE == "push"
|
||||
@ -324,7 +204,7 @@ Assemble.Website.Prepare:
|
||||
)
|
||||
# See nofusscomputing/projects/gitlab-ci#34 for extra $CI_PIPELINE_SOURCE
|
||||
exists:
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
- 'mkdocs.{yaml,yml}'
|
||||
# No changes check # See nofusscomputing/projects/gitlab-ci#34
|
||||
# changes:
|
||||
# paths:
|
||||
@ -337,7 +217,7 @@ Assemble.Website.Prepare:
|
||||
$CI_COMMIT_BRANCH != "development" &&
|
||||
$CI_PIPELINE_SOURCE == "push"
|
||||
exists:
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
- 'mkdocs.{yaml,yml}'
|
||||
changes:
|
||||
paths:
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
@ -347,15 +227,39 @@ Assemble.Website.Prepare:
|
||||
- when: never
|
||||
|
||||
|
||||
Merge Project Docs:
|
||||
extends: .merge_project_docs
|
||||
needs:
|
||||
- job: Get Project Documentation
|
||||
artifacts: true
|
||||
- job: Website.Build
|
||||
artifacts: true
|
||||
|
||||
|
||||
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
script:
|
||||
- mv "$CI_PROJECT_DIR/artifacts/prepare/Assemble.Website.Prepare/build" public
|
||||
needs: [ 'Assemble.Website.Prepare' ]
|
||||
- |
|
||||
if [ -d "$CI_PROJECT_DIR/artifacts/prepare/Merge.Project.Docs/build" ]; then
|
||||
|
||||
mv "$CI_PROJECT_DIR/artifacts/prepare/Merge.Project.Docs/build" public;
|
||||
|
||||
else
|
||||
|
||||
mv "$CI_PROJECT_DIR/artifacts/build/Website.Build/build" public;
|
||||
|
||||
fi
|
||||
needs:
|
||||
- job: Website.Build
|
||||
artifacts: true
|
||||
- job: 'Merge Project Docs'
|
||||
optional: true
|
||||
environment:
|
||||
name: staging
|
||||
name: Gitlab Pages
|
||||
url: $CI_PAGES_URL
|
||||
artifacts:
|
||||
paths:
|
||||
@ -370,14 +274,14 @@ pages:
|
||||
$CI_COMMIT_BRANCH == null
|
||||
exists:
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
when: always
|
||||
when: on_success
|
||||
|
||||
- if: # condition_master_branch_push
|
||||
$CI_COMMIT_BRANCH == "master" &&
|
||||
$CI_PIPELINE_SOURCE == "push"
|
||||
exists:
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
when: always
|
||||
when: on_success
|
||||
|
||||
- if: # condition_dev_branch_push
|
||||
$CI_COMMIT_BRANCH == "development" &&
|
||||
@ -396,7 +300,7 @@ pages:
|
||||
# paths:
|
||||
# - '{docs/**,pages/**}/*.md'
|
||||
# compare_to: 'master'
|
||||
when: always
|
||||
when: on_success
|
||||
|
||||
- if: # condition_not_master_or_dev_push
|
||||
$CI_COMMIT_BRANCH != "master" &&
|
||||
@ -408,7 +312,7 @@ pages:
|
||||
paths:
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
compare_to: 'development'
|
||||
when: always
|
||||
when: on_success
|
||||
|
||||
- when: never
|
||||
|
||||
@ -514,9 +418,9 @@ public_website:
|
||||
- ls -la /html
|
||||
script:
|
||||
- rm -rf /html/*
|
||||
- cp -r "$CI_PROJECT_DIR/artifacts/prepare/Assemble.Website.Prepare/build"/* /html/
|
||||
- cp -r "$CI_PROJECT_DIR/artifacts/prepare/Merge.Project.Docs/build"/* /html/
|
||||
- ls -laR /html/
|
||||
needs: [ 'Assemble.Website.Prepare', 'Unit Tests']
|
||||
needs: [ 'Merge Project Docs', 'Unit Tests']
|
||||
resource_group: production
|
||||
environment:
|
||||
name: production
|
||||
|
162
.gitlab/project_docs.gitlab-ci.yml
Normal file
162
.gitlab/project_docs.gitlab-ci.yml
Normal file
@ -0,0 +1,162 @@
|
||||
---
|
||||
|
||||
# Variables required:
|
||||
# ASSEMBLE_PROJECT_NAME: ''
|
||||
# ASSEMBLE_PROJECT_ID: ''
|
||||
# ASSEMBLE_PROJECT_PATH: ''
|
||||
.fetch_project_docs:
|
||||
stage: chores
|
||||
needs: []
|
||||
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
before_script:
|
||||
- mkdir -p "$CI_PROJECT_DIR/artifacts/project_docs"
|
||||
|
||||
script:
|
||||
- echo "[DEBUG] Fetch Project ${ASSEMBLE_PROJECT_NAME}"
|
||||
|
||||
- 'HTTP_STATUS_FILE=$(curl --location -o /dev/null --silent --head --write-out "%{http_code}" --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/${ASSEMBLE_PROJECT_ID}/jobs/artifacts/development/download?job=Documentation%2EBuild")'
|
||||
|
||||
- echo "[DEBUG] HTTP_STATUS_FILE=$HTTP_STATUS_FILE"
|
||||
|
||||
- |
|
||||
if [ "0$HTTP_STATUS_FILE" != "0200" ]; then
|
||||
|
||||
echo "[ERROR] Unable to fetch Job Artifacts due to HTTP status of $HTTP_STATUS_FILE";
|
||||
|
||||
# exit 1;
|
||||
|
||||
else
|
||||
|
||||
curl --location --output artifacts.zip --header "PRIVATE-TOKEN: ${GIT_COMMIT_TOKEN}" "https://gitlab.com/api/v4/projects/${ASSEMBLE_PROJECT_ID}/jobs/artifacts/development/download?job=Documentation%2EBuild";
|
||||
|
||||
unzip artifacts.zip;
|
||||
|
||||
# rm -Rf "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/$CI_JOB_NAME/build/projects/gitlab-ci";
|
||||
|
||||
cp -rvf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build/build/${ASSEMBLE_PROJECT_PATH}" "$CI_PROJECT_DIR/artifacts/project_docs/$(echo -n "${ASSEMBLE_PROJECT_PATH}" | sed -e "s/\//./g")/";
|
||||
|
||||
rm -Rf "$CI_PROJECT_DIR/artifacts/build/Documentation.Build";
|
||||
fi
|
||||
|
||||
artifacts:
|
||||
expire_in: 24 hrs
|
||||
when: always
|
||||
paths:
|
||||
- "$CI_PROJECT_DIR/artifacts/"
|
||||
rules:
|
||||
|
||||
# Docs must always be built for:
|
||||
# - git tag
|
||||
# - dev branch
|
||||
# - master branch
|
||||
- if: # condition_git_tag
|
||||
(
|
||||
$CI_COMMIT_TAG
|
||||
)
|
||||
||
|
||||
(
|
||||
(
|
||||
$CI_COMMIT_BRANCH == "development"
|
||||
||
|
||||
$CI_COMMIT_BRANCH != "master"
|
||||
)
|
||||
&&
|
||||
(
|
||||
$CI_PIPELINE_SOURCE == "pipeline"
|
||||
||
|
||||
$CI_PIPELINE_SOURCE == "push"
|
||||
||
|
||||
$CI_PIPELINE_SOURCE == "schedule"
|
||||
)
|
||||
)
|
||||
||
|
||||
(
|
||||
$CI_COMMIT_BRANCH == "master"
|
||||
&&
|
||||
$CI_PIPELINE_SOURCE == "push"
|
||||
)
|
||||
exists:
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
when: always
|
||||
|
||||
- when: never
|
||||
|
||||
|
||||
|
||||
.merge_project_docs:
|
||||
stage: prepare
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
before_script:
|
||||
- mkdir -p $CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/Merge.Project.Docs
|
||||
- mv "$CI_PROJECT_DIR/artifacts/build/Website.Build/build" "$CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/Merge.Project.Docs/"
|
||||
script:
|
||||
|
||||
- ls -l ${CI_PROJECT_DIR}/artifacts/project_docs/
|
||||
|
||||
- | # Merge Project docs to website
|
||||
for i in `ls ${CI_PROJECT_DIR}/artifacts/project_docs/`; do
|
||||
|
||||
echo "Found Path - $i";
|
||||
|
||||
export JOIN_PROJECT_PATH=$(echo -n "${i}" | sed -e "s/\./\//g");
|
||||
|
||||
echo "set as project path [${JOIN_PROJECT_PATH}]";
|
||||
|
||||
rm -Rf $CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/Merge.Project.Docs/build/${JOIN_PROJECT_PATH};
|
||||
|
||||
cp -rvf $CI_PROJECT_DIR/artifacts/project_docs/${i} $CI_PROJECT_DIR/artifacts/$CI_JOB_STAGE/Merge.Project.Docs/build/${JOIN_PROJECT_PATH}/;
|
||||
|
||||
done
|
||||
|
||||
- | # Assemble website and project sources to build search index
|
||||
echo "ToDo: build website and docs together to get the search index to add to the website";
|
||||
|
||||
- | # Join sitemaps together
|
||||
echo "ToDo: Join all Sitemaps together into one";
|
||||
|
||||
artifacts:
|
||||
expire_in: 24 hrs
|
||||
when: always
|
||||
paths:
|
||||
- "$CI_PROJECT_DIR/artifacts/"
|
||||
|
||||
rules:
|
||||
|
||||
# Docs must always be built for:
|
||||
# - git tag
|
||||
# - dev branch
|
||||
# - master branch
|
||||
- if: # condition_git_tag
|
||||
(
|
||||
$CI_COMMIT_TAG
|
||||
)
|
||||
||
|
||||
(
|
||||
(
|
||||
$CI_COMMIT_BRANCH == "development"
|
||||
||
|
||||
$CI_COMMIT_BRANCH != "master"
|
||||
)
|
||||
&&
|
||||
(
|
||||
$CI_PIPELINE_SOURCE == "pipeline"
|
||||
||
|
||||
$CI_PIPELINE_SOURCE == "push"
|
||||
||
|
||||
$CI_PIPELINE_SOURCE == "schedule"
|
||||
)
|
||||
)
|
||||
||
|
||||
(
|
||||
$CI_COMMIT_BRANCH == "master"
|
||||
&&
|
||||
$CI_PIPELINE_SOURCE == "push"
|
||||
)
|
||||
exists:
|
||||
- '{docs/**,pages/**}/*.md'
|
||||
when: always
|
||||
|
||||
- when: never
|
Submodule gitlab-ci updated: a5a9fa4437...224ef83157
58
mkdocs.yml
58
mkdocs.yml
@ -35,7 +35,27 @@ nav:
|
||||
|
||||
- Ansible Execution Environment:
|
||||
|
||||
- projects/execution_environment/index.md
|
||||
- projects/ansible/execution_environment/index.md
|
||||
|
||||
- Collections:
|
||||
|
||||
- projects/ansible/collection/index.md
|
||||
|
||||
- Firewall:
|
||||
|
||||
- projects/ansible/collection/firewall/index.md
|
||||
|
||||
- Kubernetes:
|
||||
|
||||
- projects/ansible/collection/kubernetes/index.md
|
||||
|
||||
- netbox:
|
||||
|
||||
- projects/ansible/collection/netbox/index.md
|
||||
|
||||
- phpIPAM Scan Agent:
|
||||
|
||||
- projects/ansible/collection/phpipam_scan_agent/index.md
|
||||
|
||||
- Playbooks:
|
||||
|
||||
@ -49,33 +69,45 @@ nav:
|
||||
|
||||
- projects/ansible/roles/common/index.md
|
||||
|
||||
- Firewall:
|
||||
|
||||
- projects/ansible/roles/firewall/index.md
|
||||
- Git Configuration:
|
||||
|
||||
- projects/ansible/roles/git_configuration/index.md
|
||||
|
||||
- Home Assistant:
|
||||
|
||||
- projects/ansible/roles/homeassistant/index.md
|
||||
|
||||
- Kubernetes:
|
||||
- Testing:
|
||||
|
||||
- projects/ansible/roles/kubernetes/index.md
|
||||
|
||||
- Git Configuration:
|
||||
|
||||
- projects/git_configuration/index.md
|
||||
- projects/ansible/roles/ansible_test/index.md
|
||||
|
||||
- Docker:
|
||||
|
||||
- projects/docker/index.md
|
||||
|
||||
- BIND DNS Server: projects/docker/bind/index.md
|
||||
- BIND DNS Server:
|
||||
|
||||
- projects/docker/bind/index.md
|
||||
|
||||
- Docker Mail: projects/docker-mail/index.md
|
||||
- Docker GLPI:
|
||||
|
||||
- projects/glpi/index.md
|
||||
|
||||
- Docker Mail:
|
||||
|
||||
- projects/docker-mail/index.md
|
||||
|
||||
- Django ITSM:
|
||||
|
||||
- projects/django-template/index.md
|
||||
|
||||
- Gitlab CI: projects/gitlab-ci/index.md
|
||||
|
||||
- Docker GLPI: projects/glpi/index.md
|
||||
- ITIL:
|
||||
|
||||
- Runbooks:
|
||||
|
||||
- projects/itil/runbooks/index.md
|
||||
|
||||
- Kubernetes Monitoring: projects/kubernetes_monitoring/index.md
|
||||
|
||||
|
@ -11,3 +11,4 @@ hide:
|
||||
<div style="background: url(assets/nfc_revamp.png) no-repeat center top; background-size: 282px 90px; width: 100%; height: 120px; display: flex;">
|
||||
<span style="align-self: flex-end; width: 100%; text-align: center; color: #009900; font-weight: bold; font-size: 14pt;">Using Technology to make life easier</span>
|
||||
</div>
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
# Ansible Roles
|
||||
|
||||
| :red_circle: This page is a placeholder for the ansible-roles repo's docs. |
|
||||
|:---|
|
||||
| _If you can see this page there has been an error, please report the issue on gitlab_ |
|
9
pages/projects/ansible/collection/index.md
Normal file
9
pages/projects/ansible/collection/index.md
Normal file
@ -0,0 +1,9 @@
|
||||
---
|
||||
title: Ansible Collections
|
||||
description: No Fuss Computings Ansible Collections
|
||||
date: 2024-02-21
|
||||
template: project.html
|
||||
about: https://gitlab.com/nofusscomputing/projects/ansible
|
||||
---
|
||||
|
||||
This section of the website contains Ansible Collection projects and the details of how to use said projects.
|
@ -105,8 +105,53 @@ Naming of host inventory files is to use the hostname portion of the FQDN only.
|
||||
The hosts file `host.yaml` contains all hosts and by which group they are part of.
|
||||
|
||||
|
||||
### Variable Files
|
||||
|
||||
Preference for variable files is that there is one file per subject. i.e. for the variables for a keycloak deployment, all be in one variable file, and under a directory matching the host/group name.
|
||||
|
||||
|
||||
### Playbooks
|
||||
|
||||
For playbook usage in AWX / Ansible Automation platform, the following changes are required to be made to **all** playbooks:
|
||||
|
||||
- variable `nfc_pb_host` is used for a template survey variable for a host selector for limiting hosts when running a play.
|
||||
|
||||
Example implementaion
|
||||
``` yaml
|
||||
- name: Desktops and Sub-groups
|
||||
hosts: |-
|
||||
{%- if
|
||||
nfc_pb_host is defined
|
||||
and
|
||||
nfc_pb_host in groups.desktops
|
||||
-%}
|
||||
{{ nfc_pb_host }}
|
||||
{%- else -%}
|
||||
{{ groups.desktops }}
|
||||
{%- endif %}
|
||||
```
|
||||
|
||||
!!! warning "Important"
|
||||
The building of the variable is dynamic and must check if the host is part of the group the playbook is for. this ensures that the playbook will only ever run for a host that is part of that group.
|
||||
|
||||
- variable `nfc_pb_kubernetes_cluster_name` is used for a template survey variable for the dynamic building of the cluster group name.
|
||||
|
||||
Example implementaion
|
||||
``` yaml
|
||||
- name: Kubernetes Group and sub-groups
|
||||
hosts: |-
|
||||
{%- if
|
||||
nfc_pb_host is defined
|
||||
and
|
||||
nfc_pb_host in groups.kubernetes
|
||||
-%}
|
||||
{{ nfc_pb_host }}
|
||||
{%- elseif nfc_pb_kubernetes_cluster_name is defined -%}
|
||||
kubernetes_cluster_{{ nfc_pb_kubernetes_cluster_name }}
|
||||
{%- else -%}
|
||||
{{ groups.kubernetes }}
|
||||
{%- endif %}
|
||||
```
|
||||
|
||||
### Templates
|
||||
|
||||
@ -140,6 +185,315 @@ feature_gates:
|
||||
Seting a feature gate on a template is as simple as enclosing the entire contents of the file with a jinja if statement. i.e. `{% if path.feature_gates.monitoring | default(false) | bool %}the content here{% endif %}`
|
||||
|
||||
|
||||
## Playbooks
|
||||
|
||||
Playbooks are used for grouping of hosts and/or groups for a task or set of tasks that are required to be run. All playbooks must return artifacts that exist to serve the purpose of having information on the play that can be used in further automations.
|
||||
|
||||
|
||||
### Artifacts
|
||||
|
||||
The artificates returned are set using the `ansible.builtin.set_stats` module. Prior to setting these facts with the `stats` module they must be set as facts first using the `ansible.builtin.set_fact` module. the latter enables passing of the artifacts via cli and `stats` from within AWX / Ansible Automation Platform.
|
||||
|
||||
!!! tip
|
||||
When setting the artifacts, ensure `per_host=false` is set so that artifacts work within AWX / Ansible Automation Platform.
|
||||
|
||||
Common artifacts structure. **ALL** playbooks must set these variables.
|
||||
|
||||
``` yaml
|
||||
# 'nfc_automation', dict. Global Variable, This is set from within the first playbook
|
||||
# ran and updated as required with the end time updated by the last playbook.
|
||||
nfc_automation:
|
||||
error: 0 # Boolean, 0=no Error, 1=Error occured
|
||||
time:
|
||||
start: "{{ '%Y-%m-%dT%H:%M:%S %z' | strftime }}" # String of date time, set at time of setting 'nfc_automation'
|
||||
end: 0 # String of date time, set when play finished, and updated by subsequent plays
|
||||
# Determin end time of play or duration of play when used with start time, even on error.
|
||||
|
||||
# 'nfc_task', list. every playbook creates its own task dict to add to this list.
|
||||
nfc_task:
|
||||
- name: "glpi"
|
||||
start: "{{ '%Y-%m-%dT%H:%M:%S %z' | strftime }}"
|
||||
tags: "{{ ansible_run_tags }}"
|
||||
|
||||
```
|
||||
|
||||
The above must be set from within every playbook regardless of what else is in the playbooks.
|
||||
|
||||
example playbook to set artifacts and variables
|
||||
|
||||
``` yaml
|
||||
---
|
||||
|
||||
#
|
||||
# Playbook Template
|
||||
#
|
||||
# This playbook template is the base template for All of our playbooks.
|
||||
#
|
||||
# No Fuss Computing <https://nofusscomputing.gitlab.io/projects/ansible/ansible_playbooks/projects/ansible/>
|
||||
#
|
||||
# Requirements:
|
||||
# - ansible >= 2.8
|
||||
#
|
||||
|
||||
- name: Playbook Template
|
||||
hosts: localhost
|
||||
become: false
|
||||
|
||||
|
||||
pre_tasks:
|
||||
|
||||
|
||||
# Play and task set time
|
||||
- name: Set Start Time
|
||||
ansible.builtin.set_fact:
|
||||
nfc_task_starttime: "{{ ('%Y-%m-%dT%H:%M:%S %z' | strftime) | string }}"
|
||||
no_log: "{{ nfc_pb_no_log_setup_facts | default(true) | bool }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# Setup dictionary 'nfc_automation'
|
||||
- name: Set Automation Facts
|
||||
ansible.builtin.set_fact:
|
||||
nfc_automation: {
|
||||
"time": {
|
||||
"start": "{{ nfc_task_starttime | string }}",
|
||||
"end": 0
|
||||
}
|
||||
}
|
||||
no_log: "{{ nfc_pb_no_log_setup_facts | default(true) | bool }}"
|
||||
when: nfc_automation is not defined
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# Setup dictionary 'nfc_task'
|
||||
- name: Set Automation Facts
|
||||
ansible.builtin.set_fact:
|
||||
nfc_task: {
|
||||
"name": "{{ ansible_play_name | lower | string }}",
|
||||
"error": 0,
|
||||
"roles": "{{ ansible_play_role_names | string }}",
|
||||
"skip_tags": "{{ ansible_skip_tags | list }}",
|
||||
"start": "{{ nfc_task_starttime | string }}",
|
||||
"tags": "{{ ansible_run_tags | list }}"
|
||||
}
|
||||
no_log: "{{ nfc_pb_no_log_setup_facts | default(true) | bool }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
- name: Block - pre_tasks
|
||||
block:
|
||||
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Your tasks here
|
||||
#
|
||||
########################################################################
|
||||
|
||||
|
||||
rescue:
|
||||
|
||||
# there was an error, set error object
|
||||
- name: Set error fact
|
||||
ansible.builtin.set_fact:
|
||||
nfc_task: "{{ nfc_task | combine({
|
||||
'error': 1
|
||||
}) }}"
|
||||
no_log: "{{ nfc_pb_no_log_setup_facts | default(true) | bool }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
always:
|
||||
|
||||
|
||||
# Check if error occured and fail task
|
||||
- name: Error Check
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- nfc_task.error | int == 0
|
||||
msg: Error occured, Fail the play run
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# Don't use the 'roles' section.
|
||||
roles: []
|
||||
# if the included role(s) do not contain a rescue block, the playbook may stop
|
||||
# executing in this section (roles) with the post_tasks not running. This will
|
||||
# cause the artifacts to be incomplete. It's recommended to include your roles
|
||||
# in section(s) 'pre_tasks', 'tasks' or 'post_tasks' and from within a block with
|
||||
# rescue so that the playbook can complete and ensure that all artifacts are set.
|
||||
|
||||
|
||||
tasks:
|
||||
|
||||
|
||||
- name: Block - tasks
|
||||
block:
|
||||
|
||||
# Check for error and fail play on error
|
||||
- name: Error Check
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- nfc_task.error | int == 0
|
||||
msg: Error eccured, follow error path to fail play
|
||||
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Your tasks here
|
||||
#
|
||||
########################################################################
|
||||
|
||||
rescue:
|
||||
|
||||
|
||||
# there was an error, set error object
|
||||
- name: Set error fact
|
||||
ansible.builtin.set_fact:
|
||||
nfc_task: "{{ nfc_task | combine({
|
||||
'error': 1
|
||||
}) }}"
|
||||
no_log: "{{ nfc_pb_no_log_setup_facts | default(true) | bool }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
always:
|
||||
|
||||
|
||||
# Check if error occured and fail task
|
||||
- name: Error Check
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- nfc_task.error | int == 0
|
||||
msg: Error occured, Fail the play run
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
post_tasks:
|
||||
|
||||
- name: Tasks post_task
|
||||
block:
|
||||
|
||||
|
||||
# Check for error and fail play on error
|
||||
- name: Error Check
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- nfc_task.error | int == 0
|
||||
msg: Error occured, follow error path to fail play
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
########################################################################
|
||||
#
|
||||
# Your tasks here
|
||||
#
|
||||
########################################################################
|
||||
|
||||
|
||||
rescue:
|
||||
|
||||
|
||||
# there was an error, set error object
|
||||
- name: Set error fact
|
||||
ansible.builtin.set_fact:
|
||||
nfc_task: "{{ nfc_task | combine({
|
||||
'error': 1
|
||||
}) }}"
|
||||
no_log: "{{ nfc_pb_no_log_setup_facts | default(true) | bool }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
always:
|
||||
|
||||
|
||||
# Task and automation end time.
|
||||
- name: Fetch End time
|
||||
ansible.builtin.set_fact:
|
||||
nfc_task_endtime: "{{ '%Y-%m-%dT%H:%M:%S %z' | strftime }}"
|
||||
no_log: "{{ nfc_pb_no_log_setup_facts | default(true) | bool }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# Set task end time
|
||||
- name: Set task Facts
|
||||
ansible.builtin.set_fact:
|
||||
nfc_tasks: "{{ nfc_tasks | default([]) + [ nfc_task | combine({
|
||||
'end': nfc_task_endtime | string
|
||||
}) ] }}"
|
||||
no_log: "{{ nfc_pb_no_log_setup_facts | default(true) | bool }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# Set Automation end time.
|
||||
# every playbook must set this variable so that the end time
|
||||
# is equal to the fail time or the end of a group of playbooks.
|
||||
- name: Set automation end time
|
||||
ansible.builtin.set_fact:
|
||||
nfc_automation: "{{ nfc_automation | combine({
|
||||
'time': nfc_automation.time | combine({
|
||||
'end': nfc_task_endtime | string
|
||||
})
|
||||
}) }}"
|
||||
nfc_task_endtime: null
|
||||
no_log: "{{ nfc_pb_no_log_setup_facts | default(true) | bool }}"
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# Set the artifacts as a fact for subsequent playbook useage
|
||||
# Note: variable 'per_host' must be 'false' so that the artifacts
|
||||
# work within AWX / Ansible Automation Platform.
|
||||
- name: Create Automation Artifact
|
||||
ansible.builtin.set_stats:
|
||||
data:
|
||||
nfc_automation: "{{ nfc_automation }}"
|
||||
nfc_tasks: "{{ nfc_tasks }}"
|
||||
per_host: false
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
# Final error check to fail the entire play run on error
|
||||
- name: Error Check
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- nfc_task.error | int == 0
|
||||
msg: Error occured, Fail the play run
|
||||
tags:
|
||||
- always
|
||||
|
||||
|
||||
vars: {}
|
||||
|
||||
|
||||
```
|
||||
|
||||
The above template playbook is designed for post automation should it be required to run. `nfc_automation` is for the entire play/workflow with `nfc_tasks` being a list of `nfc_task` dictionary from each playbook. `nfc_task` is there for you to add your own artifacts to and without any additional effort from you, will be added to the global artifacts.
|
||||
|
||||
|
||||
### Playbook Variables
|
||||
|
||||
Within any playbook that we create any variable that is set within the playbook is to be prefixed with `nfc_pb_`. Currently we have the following variables that are reserved and set as part of how we structure our playbooks.
|
||||
|
||||
- `nfc_automation` Details on the play/run. see artifacts above for details.
|
||||
|
||||
- `nfc_pb_no_log_setup_facts` Boolean value used as a feature gate on whether to log `set_fact` tasks that are for setting up the play. i.e. artifacts. setting this value to `false` will caused the tasks to be logged.
|
||||
|
||||
- `nfc_tasks` List of all `nfc_task` dictionaries of the play. see artifacts above for details.
|
||||
|
||||
|
||||
## AWX / Tower / Automation Platform
|
||||
|
||||
|
||||
|
0
pages/projects/ansible/roles/ansible_test/index.md
Normal file
0
pages/projects/ansible/roles/ansible_test/index.md
Normal file
@ -15,14 +15,10 @@ Our roles:
|
||||
|
||||
- Docker Management
|
||||
|
||||
- [Firewall](firewall/index.md)
|
||||
|
||||
- Git Configuration
|
||||
|
||||
- [Home Assistant](homeassistant/index.md)
|
||||
|
||||
- [Kubernetes](kubernetes/index.md)
|
||||
|
||||
- SSH
|
||||
|
||||
|
||||
|
0
pages/projects/django-template/index.md
Normal file
0
pages/projects/django-template/index.md
Normal file
5
pages/projects/itil/runbooks/index.md
Normal file
5
pages/projects/itil/runbooks/index.md
Normal file
@ -0,0 +1,5 @@
|
||||
# ITIL Runbooks
|
||||
|
||||
| :red_circle: This page is a placeholder for the python-gitlab-management repo's docs. |
|
||||
|:---|
|
||||
| _If you can see this page there has been an error, please report the issue on gitlab_ |
|
@ -15,7 +15,7 @@ class Test:
|
||||
def setup_method(self):
|
||||
self.ignore_url_alive_check = {
|
||||
'gitlab.com': [
|
||||
'nofusscomputing/infrastructure/website//-/new/development'
|
||||
'nofusscomputing/infrastructure/website/-/new/development'
|
||||
]
|
||||
}
|
||||
|
||||
|
Submodule website-template updated: 59b16501a6...8735f623dc
Reference in New Issue
Block a user