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_NAME env variable is defined or if the user specify the chart name via a parameter.
  • Define a BASE_DIR set to the sylva-core main folder to be able to run scripts from anywhere.
  • Use BASE_DIR in chart_dir definition and in all the paths to the config files.
  • Redefine $HELM_NAME, to use ${HELM_NAME} or $1 if ${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.json schema from https://json-schema.org/draft/2020-12/schema instead 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

Merge request reports

Loading