allow to locally run the CI scripts for Helm charts tests
Solve: #113 (closed)
Move the charts related scripts from gitlab-ci.yaml to dedicated scripts to be able to run them locally if needed.
Few changes were required to have theses scripts properly working either in CI and manually:
- Add a small section to check if
HELM_NAMEenv variable is defined or if the user specify the chart name via a parameter. - Define a
BASE_DIRset to thesylva-coremain folder to be able to run scripts from anywhere. - Use
BASE_DIRinchart_dirdefinition and in all the paths to the config files. - Redefine
$HELM_NAME, to use${HELM_NAME}or$1if${HELM_NAME}is not defined.
Specific changes for helm-schema-validation.sh
- move the temporary values.schema.json from the current folder to
/tmp(eg:${BASE_DIR}/tools/yaml2json.py < $chart_dir/values.schema.yaml > /tmp/values.schema.json) to avoid the creation of this file in unexpected place - retrieve
draft2020-12.jsonschema fromhttps://json-schema.org/draft/2020-12/schemainstead of using the local file shipped with jsonschema module as the path can change depending on how we manage python modules.
Edited by Loic Nicolle