Skip to content
This repository has been archived by the owner on Dec 15, 2018. It is now read-only.

Commit

Permalink
fixed an issue where we would not pass artifact-search-path if None v…
Browse files Browse the repository at this point in the history
…alue was saved in jobstep.data['artifact_search_path']

Summary: This fixes the issue that causes artifacts not to be collected, causing a bunch of build failures.

Test Plan: unit tests

Reviewers: anupc

Reviewed By: anupc

Subscribers: changesbot, kylec

Differential Revision: https://tails.corp.dropbox.com/D225935
  • Loading branch information
Naphat Sanguansin committed Sep 2, 2016
1 parent 55ec291 commit 75bfc23
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
4 changes: 3 additions & 1 deletion changes/buildsteps/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,8 +495,10 @@ def _image_for_job_id(self, job_id):
return self._jobid2image[job_id]

def get_allocation_params(self, jobstep):
artifact_search_path = jobstep.data.get('artifact_search_path', None)
artifact_search_path = artifact_search_path if artifact_search_path is not None else self.artifact_search_path
params = {
'artifact-search-path': jobstep.data.get('artifact_search_path', self.artifact_search_path),
'artifact-search-path': artifact_search_path,
'artifacts-server': current_app.config['ARTIFACTS_SERVER'],
'adapter': self.get_client_adapter(),
'server': build_internal_uri('/api/0/'),
Expand Down
27 changes: 27 additions & 0 deletions tests/changes/buildsteps/test_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,33 @@ def test_get_allocation_params_with_artifact_search_path_from_jobstep(self):
'use-path-in-artifact-name': 'false',
}

def test_get_allocation_params_with_artifact_search_path_from_jobstep_none(self):
project = self.create_project()
build = self.create_build(project)
job = self.create_job(build)
jobphase = self.create_jobphase(job)
jobstep = self.create_jobstep(jobphase, data={
'artifact_search_path': None
})

buildstep = self.get_buildstep(repo_path='source', path='tests')
result = buildstep.get_allocation_params(jobstep)
assert result == {
'adapter': 'basic',
'server': 'http://changes-int.example.com/api/0/',
'jobstep_id': jobstep.id.hex,
'release': 'precise',
's3-bucket': 'snapshot-bucket',
'pre-launch': 'echo pre',
'post-launch': 'echo post',
'artifacts-server': 'http://localhost:1234',
'artifact-search-path': 'source/tests',
'artifact-suffix': '',
'use-external-env': 'false',
'dist': 'ubuntu',
'use-path-in-artifact-name': 'false',
}

def test_get_allocation_params_use_path_in_artifact_name(self):
project = self.create_project()
build = self.create_build(project)
Expand Down

0 comments on commit 75bfc23

Please sign in to comment.