mirror of https://github.com/openspug/spug
				
				
				
			fix issue
							parent
							
								
									4e45fe9136
								
							
						
					
					
						commit
						c21c5db83d
					
				| 
						 | 
				
			
			@ -67,6 +67,7 @@ def _ext1_deploy(req, helper, env):
 | 
			
		|||
            version=req.version,
 | 
			
		||||
            spug_version=req.spug_version,
 | 
			
		||||
            extra=req.extra,
 | 
			
		||||
            remarks='SPUG AUTO MAKE',
 | 
			
		||||
            created_by_id=req.created_by_id
 | 
			
		||||
        )
 | 
			
		||||
        build_repository(rep, helper)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -104,19 +104,24 @@ def get_detail(request, r_id):
 | 
			
		|||
    if not repository:
 | 
			
		||||
        return json_response(error='未找到指定构建记录')
 | 
			
		||||
    rds, counter = get_redis_connection(), 0
 | 
			
		||||
    key = f'{settings.BUILD_KEY}:{repository.spug_version}'
 | 
			
		||||
    if repository.remarks == 'SPUG AUTO MAKE':
 | 
			
		||||
        req = repository.deployrequest_set.last()
 | 
			
		||||
        key = f'{settings.REQUEST_KEY}:{req.id}'
 | 
			
		||||
    else:
 | 
			
		||||
        key = f'{settings.BUILD_KEY}:{repository.spug_version}'
 | 
			
		||||
    data = rds.lrange(key, counter, counter + 9)
 | 
			
		||||
    response = AttrDict(data='', step=0, s_status='process', status=repository.status)
 | 
			
		||||
    while data:
 | 
			
		||||
        for item in data:
 | 
			
		||||
            counter += 1
 | 
			
		||||
            item = json.loads(item.decode())
 | 
			
		||||
            if 'data' in item:
 | 
			
		||||
                response.data += item['data']
 | 
			
		||||
            if 'step' in item:
 | 
			
		||||
                response.step = item['step']
 | 
			
		||||
            if 'status' in item:
 | 
			
		||||
                response.status = item['status']
 | 
			
		||||
            if item['key'] == 'local':
 | 
			
		||||
                if 'data' in item:
 | 
			
		||||
                    response.data += item['data']
 | 
			
		||||
                if 'step' in item:
 | 
			
		||||
                    response.step = item['step']
 | 
			
		||||
                if 'status' in item:
 | 
			
		||||
                    response.status = item['status']
 | 
			
		||||
        data = rds.lrange(key, counter, counter + 9)
 | 
			
		||||
    response.index = counter
 | 
			
		||||
    if repository.status in ('0', '1'):
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue