ci/validate: Also validate Zuul YAML config
This commit is contained in:
parent
44ba47cd29
commit
97c49fdb16
1 changed files with 4 additions and 5 deletions
|
@ -22,17 +22,16 @@ def validate_shell(rootfd, name):
|
||||||
|
|
||||||
for root, dirs, files, rootfd in os.fwalk('.'):
|
for root, dirs, files, rootfd in os.fwalk('.'):
|
||||||
# Skip .git, repo, cache, tmp, logs, fedora-comps
|
# Skip .git, repo, cache, tmp, logs, fedora-comps
|
||||||
for d in ['.git', 'repo', 'cache', 'tmp', 'logs', 'fedora-comps', 'ci']:
|
for d in ['.git', 'repo', 'cache', 'tmp', 'logs', 'fedora-comps']:
|
||||||
if d in dirs:
|
if d in dirs:
|
||||||
dirs.remove(d)
|
dirs.remove(d)
|
||||||
for name in files:
|
for name in files:
|
||||||
if name == ".zuul.yaml":
|
|
||||||
continue
|
|
||||||
if name.endswith(('.yaml', '.yml')):
|
if name.endswith(('.yaml', '.yml')):
|
||||||
print("Validating:", name)
|
print("Validating:", name)
|
||||||
with open(os.open(name, dir_fd=rootfd, flags=os.O_RDONLY)) as f:
|
with open(os.open(name, dir_fd=rootfd, flags=os.O_RDONLY)) as f:
|
||||||
yaml.safe_load(f)
|
yaml.safe_load(f)
|
||||||
result = subprocess.run(['grep', '-RniEv', '^( )*[a-z#/-]|^$|^#', name], encoding='UTF-8')
|
result = subprocess.run(['grep', '-RniEv', '^( )*[a-z#/-]|^$|^#', name], encoding='UTF-8',
|
||||||
|
preexec_fn=lambda: os.fchdir(rootfd))
|
||||||
if result.returncode == 0:
|
if result.returncode == 0:
|
||||||
raise Exception("Found likely invalid indentation in YAML file: {}".format(name))
|
raise Exception("Found likely invalid indentation in YAML file: {}".format(name))
|
||||||
validated +=1
|
validated +=1
|
||||||
|
|
Loading…
Reference in a new issue