diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f31cd39ffd68ae45ea82664eca28fb275e32965c..e7b5c3a07b36e7d0cd765488bee6bb24364bd8aa 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,25 +5,14 @@ variables: build-test: - before_script: + before_script: &before-script-build-deploy - apk update - - apk add git - - apk add python3 - - apk add py3-pip - - apk add py3-yaml - - apk add openssh-client + - apk add git python3 py3-pip py3-yaml openssh-client curl moreutils script: - hugo --config config.toml -D --destination=./public deploy_cpanel: - before_script: - - apk update - - apk add git - - apk add python3 - - apk add py3-pip - - apk add py3-yaml - - apk add openssh-client - - apk add curl + before_script: *before-script-build-deploy script: - git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.ics.muni.cz/cloud/hiera.git - sed -i '11,$d' content/cloud/flavors/index.md @@ -34,7 +23,8 @@ deploy_cpanel: - cat content/cloud/flavors/index.md - sed -i -e "s/BUILDIDTAG/$CI_COMMIT_SHORT_SHA/g" ./layouts/partials/site-footer.html - curl https://cloud.gitlab-pages.ics.muni.cz/image-rotation/image-rotation-journal.md >> content/cloud/image-rotation/index.md - - python3 ci/image_rotation_news_gen.py + - 'grep -v "GeekdocHidden: true" "content/cloud/image-rotation/index.md" | sponge "content/cloud/image-rotation/index.md"' + - python3 ci/image_rotation_news_gen.py - hugo --config config.toml -D --destination=./public - eval $(ssh-agent -s) diff --git a/ci/image_rotation_news_gen.py b/ci/image_rotation_news_gen.py index a37e275775d7066b7d046de717610b7ecf644c85..b13bfd65a49ca7648cd32b14583ca7545c5170c2 100644 --- a/ci/image_rotation_news_gen.py +++ b/ci/image_rotation_news_gen.py @@ -1,4 +1,17 @@ -"""Generated dynamically image rotation news updates""" +#!/usr/bin/env python3 + +""" +Script generates dynamically image rotation news updates + +Actions performed: + generating of image rotation news + * if everything goes well + - image rotation news section is updated according to image rotation journal + + +Usage: + python3 ./image_rotation_news.gen.py +""" import re import datetime @@ -35,7 +48,7 @@ def generate_news(image_update_dates): update_date = datetime.datetime.strftime(update_date, "%Y-%m-%d") new_entry = [ f"**{update_date}** Image rotation update, details [here](https://docs.cloud.muni.cz/" - f"cloud/image-rotation/image-rotation-update-from-{update_date})", + f"cloud/image-rotation/#image-rotation-update-from-{update_date})", ] news_content = ( news_content[:line_idx] + new_entry + [""] + news_content[line_idx:] diff --git a/content/cloud/image-rotation/index.md b/content/cloud/image-rotation/index.md index f793e50dec386c418dd29f7ba7bbc7edad4b845a..918e819d05702e240fb07ade35fec3ea252a7334 100644 --- a/content/cloud/image-rotation/index.md +++ b/content/cloud/image-rotation/index.md @@ -1,5 +1,4 @@ --- -title: "Image rotation journal" date: 2022-01-23T20:31:35+02:00 draft: false disableToc: true