Start on the new build view
This commit is contained in:
		
							parent
							
								
									5cc1c90021
								
							
						
					
					
						commit
						e227d7e526
					
				
					 30 changed files with 816 additions and 11 deletions
				
			
		|  | @ -93,7 +93,11 @@ def build_status_view(build_obj, can_write=False): | |||
|     'is_writer': can_write, | ||||
|     'trigger': trigger_view(build_obj.trigger), | ||||
|     'resource_key': build_obj.resource_key, | ||||
|     'pull_robot': user_view(build_obj.pull_robot) if build_obj.pull_robot else None | ||||
|     'pull_robot': user_view(build_obj.pull_robot) if build_obj.pull_robot else None, | ||||
|     'repository': { | ||||
|       'namespace': build_obj.repository.namespace_user.username, | ||||
|       'name': build_obj.repository.name | ||||
|     } | ||||
|   } | ||||
| 
 | ||||
|   if can_write: | ||||
|  | @ -214,6 +218,18 @@ class RepositoryBuildList(RepositoryParamResource): | |||
| @path_param('build_uuid', 'The UUID of the build') | ||||
| class RepositoryBuildResource(RepositoryParamResource): | ||||
|   """ Resource for dealing with repository builds. """ | ||||
|   @require_repo_read | ||||
|   @nickname('getRepoBuild') | ||||
|   def get(self, namespace, repository, build_uuid): | ||||
|     """ Returns information about a build. """ | ||||
|     try: | ||||
|       build = model.get_repository_build(build_uuid) | ||||
|     except model.InvalidRepositoryBuildException: | ||||
|       raise NotFound() | ||||
| 
 | ||||
|     can_write = ModifyRepositoryPermission(namespace, repository).can() | ||||
|     return build_status_view(build, can_write) | ||||
| 
 | ||||
|   @require_repo_admin | ||||
|   @nickname('cancelRepoBuild') | ||||
|   def delete(self, namespace, repository, build_uuid): | ||||
|  |  | |||
|  | @ -421,7 +421,8 @@ class ActivateBuildTrigger(RepositoryParamResource): | |||
|       pull_robot_name = model.get_pull_robot_name(trigger) | ||||
| 
 | ||||
|       build_request = start_build(repo, dockerfile_id, tags, name, subdir, True, | ||||
|                                   pull_robot_name=pull_robot_name, trigger_metadata=metadata) | ||||
|                                   trigger=trigger, pull_robot_name=pull_robot_name, | ||||
|                                   trigger_metadata=metadata) | ||||
|     except TriggerStartException as tse: | ||||
|       raise InvalidRequest(tse.message) | ||||
| 
 | ||||
|  |  | |||
		Reference in a new issue