5 git submodule update --init --remote 2>/dev/null
6 GEN_CFG='./pharos/config/utils/generate_config.py'
7 INSTALLER_ADAPTERS='./pharos/config/installers/*'
8 TMPF='/tmp/out.yml' # should be outside Jenkins WS to prevent data leakage
11 # Build a table header, using ';' as column sep
12 SUMMARY='PDF Verify Matrix;YAML Lint;'
13 for adapter in ${INSTALLER_ADAPTERS}; do
14 SUMMARY+="$(basename "${adapter}");"
17 # Iterate all PDFs, check with each installer adapter, log results
18 while IFS= read -r lab_config; do
20 echo -e "\n\nyamllint -s ${lab_config}"
21 if ! yamllint -s "${lab_config}"; then valid_yaml='FAIL'; fi
22 SUMMARY+="\n${lab_config#labs/};${valid_yaml};"
23 for adapter in ${INSTALLER_ADAPTERS}; do
27 while IFS= read -r jinja_template; do
28 echo -e "\n${GEN_CFG} -y ${lab_config} -j ${jinja_template}"
29 if "${GEN_CFG}" -y "${lab_config}" \
30 -j "${jinja_template}" > "${TMPF}"; then
33 echo -e "\nyamllint -s ${jinja_template%.j2}"
34 if yamllint -s "${TMPF}"; then ((pdf_yaml_pass+=1)); fi
40 done < <(find "${adapter}" -name '*.j2')
41 SUMMARY+="${pdf_yaml_pass}/${pdf_inst_pass}/${pdf_inst};"
43 done < <(find 'pharos/config' 'labs' -name 'pod*.yaml')
46 echo -e '\n\nNOTE: tuple fmt: (valid YAML output/sucessful parse/templates).\n'
47 echo -e "${SUMMARY}" | sed -e 's/^/;/g' -e 's/;/;| /g' | column -t -s ';'
51 To troubleshoot PDF parsing against a specific installer adapter,
52 execute the following commands locally (e.g. for zte-pod2/joid):
53 $ git submodule update --remote --init
54 $ ./pharos/config/utils/generate_config.py \\
55 -y labs/zte/pod2.yaml \\
56 -j ./pharos/config/installers/joid/pod_config.yaml.j2