From 8315ddad1a4c67cf8bc4b381a52541fd8666cfa3 Mon Sep 17 00:00:00 2001
From: berkas1 <berka@berkasimon.com>
Date: Thu, 3 Jun 2021 02:49:45 +0200
Subject: [PATCH] add feature: automate flavor table generator

---
 .gitlab-ci.yml                  | 14 ++++++++++++++
 content/cloud/flavours/index.md |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 354b935..1ca73d0 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -4,8 +4,22 @@ variables:
   GIT_SUBMODULE_STRATEGY: recursive
 
 pages:
+  before_script:
+  - apk update
+  - apk add git
+  - apk add python3  
+  - apk add py3-pip
+  - apk add py3-yaml
   script:
+  - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ics.muni.cz/cloud/hiera.git  
+  - sed -i '9,$d' content/cloud/flavours/index.md 
+  - echo "{{< csv-table header=\"true\">}}" >> content/cloud/flavours/index.md
+  - python3 ci/flavor_info_miner.py --hiera-file ./hiera/group/ostack/flavors.yaml
+  - cat flavors.csv >> content/cloud/flavours/index.md
+  - echo "{{</csv-table>}}" >> content/cloud/flavours/index.md
+  - cat content/cloud/flavours/index.md
   - hugo --config config.toml -D --destination=./public 
+
   artifacts:
     paths:
     - public
diff --git a/content/cloud/flavours/index.md b/content/cloud/flavours/index.md
index c7dd179..e26adfc 100644
--- a/content/cloud/flavours/index.md
+++ b/content/cloud/flavours/index.md
@@ -6,6 +6,8 @@ draft: false
 In this guide you can find info about all flavors available in Metacentrum Cloud.
 
 
+*Data in this table may not be up-to-date. Current information about flavors is placed in the documentation by CI.*
+
 {{< csv-table header="true">}}
 
 Flavor name,CPU,RAM (in GB),HPC,SSD,Disc throughput (in MB per second),IOPS,Net average througput (in MB per second),GPU
-- 
GitLab