1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00

Updated build.py for Travis Check

This commit is contained in:
Vikram Goyal
2021-11-23 08:11:57 +10:00
parent 7aacd30a3f
commit 9706dc331a

View File

@@ -22,6 +22,7 @@ import sys
import time
import yaml
import requests
import tempfile
from aura import cli
@@ -151,9 +152,25 @@ def find_build_config_file():
"""
Finds the build config file to use, as it might be _topic_map.yml or _build_cfg.yml
"""
config = os.path.abspath(os.path.join(CLONE_DIR, "_topic_map.yml"))
# updated 23rd Nov to support files in _topic_maps folder
# load everything from the _topic_maps folder
file_list = os.listdir(os.path.join(CLONE_DIR, "_topic_maps"))
# create a temp file combining all values from that folder
# don't delete it immediately, and give it a suffix of swp which makes it ignored by git
with tempfile.NamedTemporaryFile(dir=CLONE_DIR, delete=False, suffix=".swp") as tmp:
for f in file_list:
with open(os.path.join(CLONE_DIR, "_topic_maps", f), "rb") as infile:
tmp.write(infile.read())
config = os.path.abspath(tmp.name)
log.info(config)
# backup look for a single _topic_map in the cloned directory
if not os.path.isfile(config):
config = os.path.abspath(os.path.join(CLONE_DIR, "_build_cfg.yml"))
config = os.path.abspath(os.path.join(CLONE_DIR, "_topic_map.yml"))
return config