docs_build #3577
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: docs_build | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
# This will help to identify faster if | |
# there is a CI failure related to a | |
# change in any dependency. | |
schedule: | |
- cron: '0 */8 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 4 | |
matrix: | |
python-version: [3.9] | |
steps: | |
- name: Use checkout v2 with all git log available | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install required packages | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y \ | |
librsvg2-bin \ | |
ghostscript \ | |
libfreetype6-dev \ | |
gsfonts \ | |
libmagickwand-dev \ | |
imagemagick \ | |
graphviz \ | |
plantuml \ | |
openjdk-11-jdk | |
sudo apt-get remove ansible -y | |
sudo python3 -m pip uninstall ansible ansible-base ansible-core -y | |
sudo python3 -m pip install -r test-requirements.txt | |
sudo python3 -m pip install --upgrade pip | |
sudo python3 -m pip install --upgrade virtualenv | |
sudo python3 -m pip install --upgrade setuptools | |
sudo python3 -m pip install --upgrade ansible-inventory-grapher | |
sudo python3 -m pip install 'ansible-playbook-grapher==1.1.2' | |
sudo python3 -m pip install --upgrade shyaml | |
sudo python3 -m pip install --upgrade diagrams | |
sudo python3 -m pip install --upgrade ruamel.yaml | |
sudo python3 -m pip install --upgrade sphinx | |
sudo python3 -m pip install --upgrade sphinx-rtd-theme | |
sudo python3 -m pip install --upgrade yq | |
- name: Install kubeinit's collection | |
run: | | |
cd kubeinit | |
rm -rf ~/.ansible/collections/ansible_collections/kubeinit/kubeinit | |
ansible-galaxy collection build -v --force --output-path releases/ | |
ansible-galaxy collection install --force --force-with-deps releases/kubeinit-kubeinit-`cat galaxy.yml | shyaml get-value version`.tar.gz | |
cd .. | |
- name: Render the plantuml, mingrammer and SVG diagrams | |
run: | | |
echo "Rendering the planUML diagrams" | |
plantuml -tpng -output render ./docs/src/images/plantuml/*.plantuml | |
echo " " | |
echo "Creating the planUML static folder" | |
mkdir -p ./docs/src/static/plantuml | |
echo " " | |
echo "Moving the planUML diagrams to the docs folder" | |
mv ./docs/src/images/plantuml/render/* ./docs/src/static/plantuml/ | |
echo " " | |
echo "Rendering the mingrammer diagrams" | |
cd ./docs/src/images/mingrammer/ | |
for diagram in *.py; do python3 "$diagram"; done | |
cd ../../../../ | |
echo " " | |
echo "Creating the mingrammer static folder" | |
mkdir -p ./docs/src/static/mingrammer | |
echo " " | |
echo "Moving the mingrammer diagrams to the docs folder" | |
mv ./docs/src/images/mingrammer/*.png ./docs/src/static/mingrammer/ | |
echo " " | |
echo "Rendering the SVG diagrams" | |
cd ./docs/src/images/svg/ | |
# mogrify -format png *.svg | |
for diagram in *.svg; do | |
echo "Rendering $diagram" | |
dest=`echo "$diagram" | cut -d'.' -f1` | |
# convert "$diagram" "$dest.png" | |
rsvg-convert "$diagram" > "$dest.png" | |
done | |
cd ../../../../ | |
echo " " | |
echo "Creating the SVG static folder" | |
mkdir -p ./docs/src/static/svg | |
echo " " | |
echo "Moving the SVG diagrams to the docs folder" | |
mv ./docs/src/images/svg/*.png ./docs/src/static/svg/ | |
- name: Render the projects roles and inventory diagrams | |
run: | | |
set -x | |
tasktag=task_gather_facts | |
taskname=$(echo ${tasktag} | tr '_' '-') | |
ansible-playbook-grapher -t ${tasktag} --skip-tags omit_from_grapher -e kubeinit_cluster_distro=okd -e kubeinit_cluster_distro_role=kubeinit_openshift kubeinit/playbook.yml --include-role-tasks -o docs/src/static/playbook_${tasktag} --save-dot-file | |
sed -e ':again;$!N;$!b again; s/subgraph "Play #[23]:[^"]*"{[^}]*}//g' -e 's/"Play #1: [^"]*"/"'${taskname}'"/g' -e 's/shape=box/shape=octagon/g' -e 's/#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/#000000/g' -e 's/ style=filled / /' docs/src/static/playbook_${tasktag}.dot | dot -Tsvg > docs/src/static/playbook_${tasktag}.svg | |
cat << EOF >> docs/src/playbook_diagrams.rst | |
playbook task ${taskname} | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/playbook_${tasktag}.svg | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
tasktag=task_prepare_hypervisors | |
taskname=$(echo ${tasktag} | tr '_' '-') | |
ansible-playbook-grapher -t ${tasktag} --skip-tags omit_from_grapher -e kubeinit_cluster_distro=okd -e kubeinit_cluster_distro_role=kubeinit_openshift kubeinit/playbook.yml --include-role-tasks -o docs/src/static/playbook_${tasktag} --save-dot-file | |
sed -e ':again;$!N;$!b again; s/subgraph "Play #[13]:[^"]*"{[^}]*}//g' -e 's/"Play #2: [^"]*"/"'${taskname}'"/g' -e 's/shape=box/shape=octagon/g' -e 's/#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/#000000/g' -e 's/ style=filled / /' docs/src/static/playbook_${tasktag}.dot | dot -Tsvg > docs/src/static/playbook_${tasktag}.svg | |
cat << EOF >> docs/src/playbook_diagrams.rst | |
playbook task ${taskname} | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/playbook_${tasktag}.svg | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
for tasktag in task_prepare_environment task_cleanup_hypervisors task_run_validations task_create_network task_create_services; do | |
taskname=$(echo ${tasktag} | tr '_' '-') | |
ansible-playbook-grapher -t ${tasktag} --skip-tags omit_from_grapher -e kubeinit_cluster_distro=okd -e kubeinit_cluster_distro_role=kubeinit_openshift kubeinit/playbook.yml --include-role-tasks -o docs/src/static/playbook_${tasktag} --save-dot-file | |
sed -e ':again;$!N;$!b again; s/subgraph "Play #[12]:[^"]*"{[^}]*}//g' -e 's/"Play #3: [^"]*"/"'${taskname}'"/g' -e 's/shape=box/shape=octagon/g' -e 's/#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/#000000/g' -e 's/ style=filled / /' docs/src/static/playbook_${tasktag}.dot | dot -Tsvg > docs/src/static/playbook_${tasktag}.svg | |
cat << EOF >> docs/src/playbook_diagrams.rst | |
playbook task ${taskname} | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/playbook_${tasktag}.svg | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
done | |
tasktag=task_prepare_cluster | |
taskname=$(echo ${tasktag} | tr '_' '-') | |
for distro in cdk eks k8s kid rke; do | |
ansible-playbook-grapher -t ${tasktag} --skip-tags omit_from_grapher -e kubeinit_cluster_distro=${distro} -e kubeinit_cluster_distro_role=kubeinit_${distro} kubeinit/playbook.yml --include-role-tasks -o docs/src/static/playbook_${distro}_${tasktag} --save-dot-file | |
sed -e ':again;$!N;$!b again; s/subgraph "Play #[12]:[^"]*"{[^}]*}//g' -e 's/"Play #3: [^"]*"/"'${taskname}'"/g' -e 's/shape=box/shape=octagon/g' -e 's/#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/#000000/g' -e 's/ style=filled / /' docs/src/static/playbook_${distro}_${tasktag}.dot | dot -Tsvg > docs/src/static/playbook_${distro}_${tasktag}.svg | |
cat << EOF >> docs/src/playbook_diagrams.rst | |
playbook task ${taskname} [${distro}] | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/playbook_${distro}_${tasktag}.svg | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
done | |
distro=okd | |
ansible-playbook-grapher -t ${tasktag} --skip-tags omit_from_grapher -e kubeinit_cluster_distro=${distro} -e kubeinit_cluster_distro_role=kubeinit_openshift kubeinit/playbook.yml --include-role-tasks -o docs/src/static/playbook_${distro}_${tasktag} --save-dot-file | |
sed -e ':again;$!N;$!b again; s/subgraph "Play #[12]:[^"]*"{[^}]*}//g' -e 's/"Play #3: [^"]*"/"'${taskname}'"/g' -e 's/shape=box/shape=octagon/g' -e 's/#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/#000000/g' -e 's/ style=filled / /' docs/src/static/playbook_${distro}_${tasktag}.dot | dot -Tsvg > docs/src/static/playbook_${distro}_${tasktag}.svg | |
cat << EOF >> docs/src/playbook_diagrams.rst | |
playbook task ${taskname} [${distro}] | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/playbook_${distro}_${tasktag}.svg | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
tasktag=task_download_images | |
taskname=$(echo ${tasktag} | tr '_' '-') | |
ansible-playbook-grapher -t ${tasktag} --skip-tags omit_from_grapher -e kubeinit_cluster_distro=okd -e kubeinit_cluster_distro_role=kubeinit_openshift kubeinit/playbook.yml --include-role-tasks -o docs/src/static/playbook_${tasktag} --save-dot-file | |
sed -e ':again;$!N;$!b again; s/subgraph "Play #[12]:[^"]*"{[^}]*}//g' -e 's/"Play #3: [^"]*"/"'${taskname}'"/g' -e 's/shape=box/shape=octagon/g' -e 's/#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/#000000/g' -e 's/ style=filled / /' docs/src/static/playbook_${tasktag}.dot | dot -Tsvg > docs/src/static/playbook_${tasktag}.svg | |
cat << EOF >> docs/src/playbook_diagrams.rst | |
playbook task ${taskname} | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/playbook_${tasktag}.svg | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
tasktag=task_deploy_cluster | |
taskname=$(echo ${tasktag} | tr '_' '-') | |
for distro in cdk eks k8s kid rke; do | |
ansible-playbook-grapher -t ${tasktag} --skip-tags omit_from_grapher -e kubeinit_cluster_distro=${distro} -e kubeinit_cluster_distro_role=kubeinit_${distro} kubeinit/playbook.yml --include-role-tasks -o docs/src/static/playbook_${distro}_${tasktag} --save-dot-file | |
sed -e ':again;$!N;$!b again; s/subgraph "Play #[12]:[^"]*"{[^}]*}//g' -e 's/"Play #3: [^"]*"/"'${taskname}'"/g' -e 's/shape=box/shape=octagon/g' -e 's/#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/#000000/g' -e 's/ style=filled / /' docs/src/static/playbook_${distro}_${tasktag}.dot | dot -Tsvg > docs/src/static/playbook_${distro}_${tasktag}.svg | |
cat << EOF >> docs/src/playbook_diagrams.rst | |
playbook task ${taskname} [${distro}] | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/playbook_${distro}_${tasktag}.svg | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
done | |
distro=okd | |
ansible-playbook-grapher -t ${tasktag} --skip-tags omit_from_grapher -e kubeinit_cluster_distro=${distro} -e kubeinit_cluster_distro_role=kubeinit_openshift kubeinit/playbook.yml --include-role-tasks -o docs/src/static/playbook_${distro}_${tasktag} --save-dot-file | |
sed -e ':again;$!N;$!b again; s/subgraph "Play #[12]:[^"]*"{[^}]*}//g' -e 's/"Play #3: [^"]*"/"'${taskname}'"/g' -e 's/shape=box/shape=octagon/g' -e 's/#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/#000000/g' -e 's/ style=filled / /' docs/src/static/playbook_${distro}_${tasktag}.dot | dot -Tsvg > docs/src/static/playbook_${distro}_${tasktag}.svg | |
cat << EOF >> docs/src/playbook_diagrams.rst | |
playbook task ${taskname} [${distro}] | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/playbook_${distro}_${tasktag}.svg | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
tasktag=task_post_deployment | |
taskname=$(echo ${tasktag} | tr '_' '-') | |
ansible-playbook-grapher -t ${tasktag} --skip-tags omit_from_grapher -e kubeinit_cluster_distro=okd -e kubeinit_cluster_distro_role=kubeinit_openshift kubeinit/playbook.yml --include-role-tasks -o docs/src/static/playbook_${tasktag} --save-dot-file | |
sed -e ':again;$!N;$!b again; s/subgraph "Play #[12]:[^"]*"{[^}]*}//g' -e 's/"Play #3: [^"]*"/"'${taskname}'"/g' -e 's/shape=box/shape=octagon/g' -e 's/#[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]/#000000/g' -e 's/ style=filled / /' docs/src/static/playbook_${tasktag}.dot | dot -Tsvg > docs/src/static/playbook_${tasktag}.svg | |
cat << EOF >> docs/src/playbook_diagrams.rst | |
playbook task ${taskname} | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/playbook_${tasktag}.svg | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
sed -e '/^juju-controller/d' \ | |
-e '/^hypervisor-04/d' \ | |
-e '/^\[controller_nodes\]$/ acontroller-01 target=hypervisor-01\ncontroller-02 target=hypervisor-02\ncontroller-03 target=hypervisor-03' \ | |
-e '/^\[compute_nodes\]$/ acompute-01 target=hypervisor-01\ncompute-02 target=hypervisor-02' \ | |
-e '/^service /s/ / target=hypervisor-01 /' \ | |
-e '/^bootstrap /s/$/ target=hypervisor-03/' kubeinit/inventory.yml > docs/src/static/inventory | |
ansible-inventory-grapher -i docs/src/static/inventory all -a 'rankdir=LR;' --visible-vars=ansible_host --visible-vars=target -t docs/src/static/inventory.j2 | dot -Tpng > docs/src/static/inventory.png | |
cat << EOF >> docs/src/inventory_diagrams.rst | |
inventory example for okd-libvirt-3-2-3 | |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
.. image:: static/inventory.png | |
:width: 400 | |
:alt: Alternative text | |
EOF | |
cat ./docs/src/playbook_diagrams.rst | |
cat ./docs/src/inventory_diagrams.rst | |
- name: Render the changelog file | |
run: | | |
GITCHANGELOG_CONFIG_FILENAME=./ci/gitchangelog.rc ./ci/gitchangelog.py > ./docs/src/changelog.rst | |
cat ./docs/src/changelog.rst | |
- name: Render the docs | |
run: | | |
cd ./docs/src | |
make html | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: DocumentationHTML | |
path: docs/src/_build/html/ | |
if-no-files-found: error | |
- name: Commit documentation changes | |
run: | | |
git clone https://github.com/kubeinit/kubeinit.git --branch gh-pages --single-branch gh-pages | |
cp -r docs/src/_build/html/* gh-pages/ | |
cd gh-pages | |
git config --local user.email "bot@kubeinit.org" | |
git config --local user.name "KubeInit's bot" | |
git add . | |
git commit -m "Update documentation" -a || true | |
- name: Push changes | |
if: github.event_name == 'push' | |
uses: kubeinit/github-push-action@master | |
with: | |
force: true | |
branch: gh-pages | |
directory: gh-pages | |
github_token: ${{ secrets.GITHUB_TOKEN }} |