Fix issue with sparse-checkout of include-vars
Path of include-vars were not correctly added to the list of sparse paths for the matching connection/project. Instead they were added to the paths for the last processed playbook connection/project. Change-Id: I4aa0dbcd6f3b4a84c0f412f90cc742483741c22d
This commit is contained in:
1
tests/fixtures/config/workspace-checkout/git/org_project2/zuul.include/vars.yaml
vendored
Normal file
1
tests/fixtures/config/workspace-checkout/git/org_project2/zuul.include/vars.yaml
vendored
Normal file
@@ -0,0 +1 @@
|
||||
foo: project2
|
||||
10
tests/fixtures/config/workspace-checkout/git/org_project2/zuul.yaml
vendored
Normal file
10
tests/fixtures/config/workspace-checkout/git/org_project2/zuul.yaml
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
- job:
|
||||
name: test-workspace-checkout-multi-include-vars
|
||||
parent: test-workspace-checkout-false
|
||||
files: '.*' # Reset parent file matcher
|
||||
include-vars: zuul.include/vars.yaml
|
||||
|
||||
- project:
|
||||
check:
|
||||
jobs:
|
||||
- test-workspace-checkout-multi-include-vars
|
||||
@@ -1473,3 +1473,15 @@ class TestExecutorWorkspaceCheckout(ZuulTestCase, ExecutorReposMixin):
|
||||
for f, expected in file_checks.items():
|
||||
exists = os.path.exists(os.path.join(path, f))
|
||||
self.assertEqual(expected, exists, f)
|
||||
|
||||
def test_workspace_checkout_multi_include_vars(self):
|
||||
A = self.fake_gerrit.addFakeChange('org/project2', 'master', 'A')
|
||||
self.fake_gerrit.addEvent(A.getPatchsetCreatedEvent(1))
|
||||
self.waitUntilSettled()
|
||||
|
||||
self.assertHistory([
|
||||
dict(
|
||||
name='test-workspace-checkout-multi-include-vars',
|
||||
result='SUCCESS'
|
||||
),
|
||||
], ordered=False)
|
||||
|
||||
@@ -2321,6 +2321,7 @@ class AnsibleJob(object):
|
||||
for iv in self.job.include_vars:
|
||||
# For each include-vars, add the contining dir
|
||||
key = (iv['connection'], iv['project'])
|
||||
paths = self.repo_sparse_paths[key]
|
||||
ivpath = os.path.dirname(iv['name'])
|
||||
# Remove any / at the start and add one at the end.
|
||||
ivpath = ivpath.lstrip('/') + '/'
|
||||
|
||||
Reference in New Issue
Block a user