Remove old artifacts when building new ones

For local dev, multiple iterations can wind up with multiple
files in the build_artifact dir. Remove them when building so
that the ls command works.

Change-Id: Id309c34679d2c0b6d9380665a381af4b52495d19
This commit is contained in:
Monty Taylor 2020-02-27 08:45:18 -06:00
parent 5936a8f691
commit 40fe366727
2 changed files with 11 additions and 2 deletions

View File

@ -22,6 +22,8 @@ import pbr.version
from ruamel.yaml import YAML
import os
def generate_version_info():
version_info = pbr.version.VersionInfo('openstack-cloud')
@ -39,8 +41,16 @@ def generate_version_info():
yaml.dump(config, fp)
def clean_build():
if not os.path.exists('build_artifact'):
return
for tarball in os.listdir('build_artifact'):
os.unlink('build_artifact/{tarball}'.format(tarball=tarball))
def main():
generate_version_info()
clean_build()
if __name__ == '__main__':

View File

@ -34,8 +34,7 @@ commands =
[testenv:linters]
passenv = *
commands =
{toxinidir}/tools/build.py
ansible-galaxy collection build --force {toxinidir} --output-path {toxinidir}/build_artifact
{[testenv:build]commands}
/bin/bash -c "ansible-galaxy collection install $(ls {toxinidir}/build_artifact/openstack-cloud-*) --force -p {toxinidir}"
/bin/bash -c "cd ansible_collections/openstack/cloud && ansible-test sanity"