Don't validate .placeholder

When creating a new election we need to add a directory per project
(including the 'TC' as a pseudo project) we can't just create an empty
directory in git so we add a '.placeholder' file.

We have recently added a voting job that will run try to validate all
candidate files added in a review.  This includes the placeholder file.
CLearly this file will not pass validation and cause the job to fail.

Adding .placeholder to the zuul irrelevant-files variable wont work, so
instead filter .placeholder from the interesting files.

Change-Id: Ibd2224a5479d4ab9afbac227bac38080359a98bf
This commit is contained in:
Tony Breeds 2019-01-10 14:04:17 +11:00
parent 77c4fe302e
commit 3bf36b7128
2 changed files with 4 additions and 5 deletions

View File

@ -84,7 +84,8 @@ def find_modified_candidate_files():
filenames = [
l.strip()
for l in results.splitlines()
if l.startswith(utils.CANDIDATE_PATH + '/')
if (l.startswith(utils.CANDIDATE_PATH + '/') and
not l.endswith('.placeholder'))
]
return filenames

View File

@ -35,7 +35,7 @@ class TestFindModifiedCandidateFiles(base.ElectionTestCase):
check_output = (('configuration.yaml\n'
'%(path)s/.placeholder\n'
) % ({'path': utils.CANDIDATE_PATH})).encode('utf-8')
expected_filenames = ['%s/.placeholder' % utils.CANDIDATE_PATH]
expected_filenames = []
mock_check_output.return_value = check_output
filenames = \
ci_check_all_candidate_files.find_modified_candidate_files()
@ -48,9 +48,7 @@ class TestFindModifiedCandidateFiles(base.ElectionTestCase):
'%(path)s/cadidate\n'
'%(path)s/.placeholder\n'
) % ({'path': utils.CANDIDATE_PATH})).encode('utf-8')
expected_filenames = ['%s/cadidate' % utils.CANDIDATE_PATH,
'%s/.placeholder' % utils.CANDIDATE_PATH
]
expected_filenames = ['%s/cadidate' % utils.CANDIDATE_PATH]
mock_check_output.return_value = check_output
filenames = \
ci_check_all_candidate_files.find_modified_candidate_files()