Merge "Put legacy jobs down a directory level into workspace" into feature/zuulv3

This commit is contained in:
Zuul 2017-09-27 13:34:14 +00:00 committed by Gerrit Code Review
commit d02448dff7
2 changed files with 12 additions and 2 deletions

View File

@ -25,7 +25,7 @@ def zuul_legacy_vars(zuul):
ZUUL_SHORT_PROJECT_NAME=short_name, ZUUL_SHORT_PROJECT_NAME=short_name,
ZUUL_PIPELINE=zuul['pipeline'], ZUUL_PIPELINE=zuul['pipeline'],
ZUUL_VOTING=zuul['voting'], ZUUL_VOTING=zuul['voting'],
WORKSPACE='/home/zuul') WORKSPACE='/home/zuul/workspace')
if 'branch' in zuul: if 'branch' in zuul:
params['ZUUL_BRANCH'] = zuul['branch'] params['ZUUL_BRANCH'] = zuul['branch']

View File

@ -630,7 +630,7 @@ class Job:
if scpfile.get('copy-console'): if scpfile.get('copy-console'):
continue continue
else: else:
src = "{{ ansible_user_dir }}/" src = "{{ ansible_user_dir }}/workspace/"
rsync_opts = self._getRsyncOptions(scpfile['source']) rsync_opts = self._getRsyncOptions(scpfile['source'])
target = scpfile['target'] target = scpfile['target']
@ -705,6 +705,7 @@ class Job:
task['shell']['cmd'] = data task['shell']['cmd'] = data
if shell: if shell:
task['shell']['executable'] = shell task['shell']['executable'] = shell
task['shell']['chdir'] = '{{ ansible_user_dir }}/workspace'
if syntax_check: if syntax_check:
# Emit a test playbook with this shell task in it then run # Emit a test playbook with this shell task in it then run
@ -761,6 +762,7 @@ class Job:
task = self._emitScriptContent( task = self._emitScriptContent(
builder['shell'], playbook_dir, sequence) builder['shell'], playbook_dir, sequence)
task['environment'] = ENVIRONMENT task['environment'] = ENVIRONMENT
return task return task
def _transformPublishers(self, jjb_job): def _transformPublishers(self, jjb_job):
@ -806,7 +808,15 @@ class Job:
run_playbook = os.path.join(self.job_path, 'run.yaml') run_playbook = os.path.join(self.job_path, 'run.yaml')
post_playbook = os.path.join(self.job_path, 'post.yaml') post_playbook = os.path.join(self.job_path, 'post.yaml')
tasks = [] tasks = []
workspace_task = collections.OrderedDict()
workspace_task['name'] = "Ensure legacy workspace directory"
workspace_task['file'] = collections.OrderedDict()
workspace_task['file']['path'] = '{{ ansible_user_dir }}/workspace'
workspace_task['file']['state'] = 'directory'
tasks.append(workspace_task)
sequence = 0 sequence = 0
for builder in self.jjb_job.get('builders', []): for builder in self.jjb_job.get('builders', []):
if 'shell' in builder: if 'shell' in builder: