Commit ff146652 authored by mrodzis's avatar mrodzis 🐸
Browse files

Merge branch 'feature/#284-ci-add-docs' into 'develop'

Feature/#284 ci add docs

Closes #284

See merge request subugoe/emo/Qviewer!182
parents 8f456bfe 3ef43aa0
Pipeline #204103 passed with stages
in 10 minutes and 1 second
# This script is resposible for determining which artifacts are too old to be
# kept any longer. The artifacts are needed and preserved for having the
# environments at hand any time.
# Some lines have been commented since they don't work properly at the moment.
# Currently artifacts are kept for two weeks since this is our average sprint
# duration.
# Some lines have been commented out since they don't work properly at the moment.
# We left them in there as a basis in case we want to improve the performance
# of the build process at a later stage.
# This script remove any entry point given at src/index.template.html.
# If an entry point is removed, src/index.template.html is committed again
# to the repository which triggers a new pipeline. Here there variable
# $CONTINUE_BUILD comes into play.
# In order to avoid having to build the complete application although the
# current pipeline will trigger a new one, $CONTINUE_BUILD is set to "false"
# and prevents a complete build and deployment.
if grep -q '"entrypoint": ""' "$FILE"; then
# This script creates a basic 404 page for GitLab pages.
# It comes into play when a build isn't continued due to the entry point being removed.
# Since the removal of an entry point triggers a new pipeline, the respective GitLab page
# will be created accordingly. The page created by this script serves as a placeholder until
# the correct page has been created.
echo "Create 404 page"
mkdir public
echo "<!DOCTYPE html><html><head><title>TIDO 404</title><meta charset='utf-8'></head><body>404: no build contents have been provided</body>" > public/404.html
# this script sets the entrypoint for TIDO
# This script sets the entry point for TIDO's GitLab pages. They are not part of version
# controlling.
# reason: if an entrypoint is provided, it will be compiled and integrated into the build
# the build takes precedence and prevents the according config option to take effect
# on the the other hand, the entrypoint is needed for the demo page to show data
# Reason: If an entrypoint is provided, it will be compiled and integrated into the build.
# Since we still want to have data at our hands when developing and for the official TIDO
# link, the entry point has to be set without being present in the repository.
......@@ -23,7 +23,7 @@ case $CI_COMMIT_REF_NAME in
echo "set entrypoint for testing"
# TIDO is developed in the context of the Ahiqar project, therefore we use the Ahiqar data for
# development purposes.
sed -ri 's|.*("entrypoint"\s*:).*$|\t\t\t\1 "'${ENTRY_POINT}'",|' src/index.template.html
# This script takes the old artifacts containing the data needed for the environments and
# adds the current branch's data to them.
dist_dir=$(grep distDir quasar.conf.js | cut -d "'" -f2)
# get the latest 'deploy' artifact which contains the former states/environments
# get and extract the latest 'deploy' artifact which contains the former states/environments
jobs=$(curl --header "PRIVATE-TOKEN: $API_TOKEN" "${project_id}/jobs?scope=success" | jq 'sort_by(.finished_at) | reverse')
latest_deploy_job_id=$(echo $jobs | jq '.[] | select(.stage == "deploy").id' | sed -n 1p)
curl --output --header "PRIVATE-TOKEN: $API_TOKEN" "${latest_deploy_job_id}/artifacts"
# add current data to artifact
unzip -u
# add current data to artifact. this only takes place if $CONTINUE_BUILD is set to 'true' or we are on a feature/bugfix/… branch.
# the differentiation between the branches is necessary because $CONTINUE_BUILD is only set on 'main' and 'develop'.
if [[ $CONTINUE_BUILD == "true" || ($CI_COMMIT_BRANCH != "main" && $CI_COMMIT_BRANCH != "develop") ]]; then
mkdir -p public/{${CI_COMMIT_SHORT_SHA},${CI_COMMIT_REF_SLUG}}
echo public/${CI_COMMIT_SHORT_SHA} public/${CI_COMMIT_REF_SLUG} | xargs -n 1 cp --remove-destination --recursive ${dist_dir}/*
# this file defines the CI/CD stages for the TIDO viewer.
# in some cases they invoke scripts provided at .ci-scripts/ in order to
# keep this file slim and clear. please have a look at these scripts for
# information that goes beyond the documentation of the single stages.
- node_modules/
......@@ -18,6 +23,13 @@ stages:
- git config --global ""
- git config --global "Gitlab CI"
# this stage checks if an entry point is set in src/index.template.html and removes it.
# the reasoning behind this is that the entry point should be empty on `develop` and `main`
# so that releases don't accidentally ship an entry point.
# during this stage, the variable $CONTINUE_BUILD is set and exported which determines if
# the following pipeline stages are fully executed. if an entry point has to be removed, it is
# set to 'false' since src/index.template.html is modified and recomitted which triggers a new
# pipeline.
stage: clean
......@@ -31,6 +43,7 @@ clean_up:
dotenv: build.env
# builds TIDO on feature and bugfix branches.
......@@ -43,6 +56,9 @@ build_test:
- dist/
# builds TIDO on `main` and `develop`.
# the software is only built if no entry point has been removed during
# the 'clean' stage.
......@@ -56,6 +72,11 @@ build_main_and_develop:
- dist/
expire_in: 1 mos
# this job triggers a new build of the Ahiqar specific TIDO viewer after a
# merge to `main` (which is only done during a release).
# this way the Ahiqar specific TIDO gets updated automatically if a new
# version of the generic TIDO is available.
# this connection will be removed at some point of the TIDO development.
stage: deploy
......@@ -65,6 +86,10 @@ update-ahikar:
trigger: "subugoe/ahiqar/ahiqar-tido"
# creates the GitLab pages for the environments.
# if an entry point has been removed during the 'clean' stage, we temporarily set a custom
# 404 page on `main` and `develop` which will replaced during the next pipeline. since
# removing the entry point triggers a new pipeline, the 404 state will only last for a few minutes.
# at the very early stage lets deploy for every branch
......@@ -89,6 +114,8 @@ pages:
- public
# this stage serves for preserving the pages that have been created in the last two weeks.
# without this job the pages would get lost or be overwritten by the 'pages' job.
- dnf install -y zip
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment