2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 Linux Foundation and others.
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
13 export PATH=$PATH:/usr/local/bin/
15 GEN_CFG='./config/utils/generate_config.py'
16 INSTALLER_ADAPTERS='./config/installers/*'
17 TMPF='/tmp/out.yml' # should be outside Jenkins WS to prevent data leakage
20 echo "Using $(yamllint --version)"
22 # Build a table header, using ';' as column sep
23 for adapter in 'PDF Verify Matrix' ${INSTALLER_ADAPTERS}; do
24 SUMMARY+="$(basename "${adapter}");"
27 # Iterate all PDFs, check with each installer adapter, log results
28 while IFS= read -r lab_config; do
29 SUMMARY+="\n${lab_config#labs/};"
30 echo "###################### ${lab_config} ######################"
31 for adapter in ${INSTALLER_ADAPTERS}; do
35 while IFS= read -r jinja_template; do
36 pdf_gen_cmd="${GEN_CFG} -y ${lab_config} -j ${jinja_template}"
37 if ${pdf_gen_cmd} > "${TMPF}"; then
39 echo "[GENERATE] [OK] ${pdf_gen_cmd}"
40 if yamllint -s <(sed 's|ENC\[PKCS.*\]|opnfv|g' "${TMPF}"); then
42 echo "[YAMLLINT] [OK] yamllint -s ${jinja_template%.j2}"
44 echo "[YAMLLINT] [ERROR] yamllint -s ${jinja_template%.j2}"
47 echo "[GENERATE] [ERROR] ${pdf_gen_cmd}"
52 done < <(find "${adapter}" -name '*.j2')
53 SUMMARY+="${pdf_yaml_pass}/${pdf_inst_pass}/${pdf_inst};"
55 done < <(find 'labs' -name 'pod*.yaml')
59 ###################### Result Matrix ######################
61 NOTE: tuple fmt: (valid YAML output/sucessful parse/templates).
63 $(echo -e "${SUMMARY}" | sed -e 's/^/;/g' -e 's/;/;| /g' | column -t -s ';')
65 To troubleshoot PDF parsing against a specific installer adapter,
66 execute the following commands locally (e.g. for zte-pod2/joid):
67 $ ./config/utils/generate_config.py \\
68 -y labs/zte/pod2.yaml \\
69 -j config/installers/joid/pod_config.yaml.j2