Exemplo n.º 1
0
def push_release_package(request, release_package_id):
    release_package = DeploymentPackage.objects.get(id=release_package_id)

    if request.method == u'POST':
        branch = Branch.objects.get(id=request.POST.get('cboToBranch'))

        push_package = DeploymentPushStatus()
        push_package.package = release_package
        push_package.keep_package = request.POST.get('chkKeepGenerated') == '1'
        push_package.package_location = '/tmp'
        push_package.test_only = True
        push_package.target_environment = branch
        push_package.save()

        #
        # TODO: Fork project off
        #
        #pr = subprocess.Popen(os.path.join(settings.ROOT_PATH, 'cronjob.sh') + ' ' + repo_name + ' ' + branch_name + ' >/tmp/ssRun.out 2>&1 &', shell=True)
        #logger.debug('Started With pid ' + str(pr.pid))
        #pr.wait()
        #if pr.returncode == 0:
        #    push_package.result = 'i'
        #    push_package.save()

        Deployment.deployPackage(push_package)

        return redirect('/release_push_status/' + str(push_package.id))

    branches = Branch.objects.filter(enabled__exact=True)
    data = {'release_package': release_package, 'branches': branches}

    return render_to_response('release_push_package.html',
                              data,
                              context_instance=RequestContext(request))
Exemplo n.º 2
0
def push_release_package(request, release_package_id):
    release_package= DeploymentPackage.objects.get(id=release_package_id)

    if request.method == u'POST':
        branch = Branch.objects.get(id=request.POST.get('cboToBranch'))
    
        push_package = DeploymentPushStatus()
        push_package.package = release_package
        push_package.keep_package = request.POST.get('chkKeepGenerated') == '1'
        push_package.package_location = '/tmp'
        push_package.test_only = True
        push_package.target_environment = branch
        push_package.save()
        
        #
        # TODO: Fork project off
        #
        #pr = subprocess.Popen(os.path.join(settings.ROOT_PATH, 'cronjob.sh') + ' ' + repo_name + ' ' + branch_name + ' >/tmp/ssRun.out 2>&1 &', shell=True)
        #logger.debug('Started With pid ' + str(pr.pid))
        #pr.wait()
        #if pr.returncode == 0:
        #    push_package.result = 'i'
        #    push_package.save()
        
        Deployment.deployPackage(push_package)
        
        return redirect('/release_push_status/' + str(push_package.id))
    
    branches = Branch.objects.filter(enabled__exact = True)
    data = {'release_package':release_package, 'branches':branches}

    return render_to_response('release_push_package.html', data, context_instance=RequestContext(request))
Exemplo n.º 3
0
 def deploy_stories(self, stories, from_branch, to_branch):
     # get all release objects associated with the stories
     logger = logging.getLogger('deploy')
     rolist = DeployableObject.objects.filter(pending_stories__in=stories)
     deployResult = Deployment.deploy(set(rolist), from_branch, to_branch,  testOnly = False,  retain_package = True)
     if deployResult is not None:
         if not deployResult.success:
             for dm in deployResult.messages:
                 if not dm.success:
                     logger.info('fail: {0} - {1}'.format(dm.fullName, dm.problem))
                 else:
                     logger.info('pass: {0}'.format(dm.fullName))
             raise CommandError('deployment failed')