Authored by 姜枫

update default branch

... ... @@ -25,11 +25,11 @@ class Build {
this.silent = true;
}
build(env) {
build(branch) {
if (typeof config.buildDir === 'undefined') {
throw new Error('please config the buildDir');
}
this.branch = this.project.deploy[env].branchName;
this.branch = branch;
let buildTime = moment().format('YYYYMMDDHHmmss')
this.buildTime = buildTime;
... ...
... ... @@ -142,17 +142,19 @@ const p = {
project_build: async(ctx, next) => {
let pid = ctx.params.pid;
let env = ctx.request.body.env;
let branch = ctx.redirect.body.branch;
let p = await Project.findById(pid);
let build = new Build(p);
let {
buildTime,
distFile
} = build.build(env);
} = build.build(branch);
let buildingDoc = await Building.insert({
buildTime: buildTime,
project: p.name,
projectId: pid,
branch: branch,
env: env,
distFile: distFile,
state: 'waiting',
... ...
... ... @@ -32,6 +32,7 @@
<thead>
<tr>
<th>构建版本</th>
<th>分支名称</th>
<th>状态</th>
<th>构建时间</th>
<th>操作</th>
... ... @@ -96,6 +97,7 @@
ajax: '/projects/{{project._id}}/buildings?env=' + env,
columns: [
{ data: "buildTime"},
{ data: "branch"},
{ data: "state"},
{ data: "updatedAt"},
{ data: "_id" }
... ...
... ... @@ -33,11 +33,11 @@
<div class="clearfix mt20">
<div class="col-xs-6 project-env" data-id="{{_id}}" data-env="production">
<h5 class="md-title nomargin">线上环境</h5>
<h4 class="nomargin">23</h4>
<h4 class="nomargin">{{deploy.production.target.length}}</h4>
</div>
<div class="col-xs-6 project-env" data-id="{{_id}}" data-env="test">
<h5 class="md-title nomargin">测试环境</h5>
<h4 class="nomargin">60</h4>
<h4 class="nomargin">{{deploy.test.target.length}}</h4>
</div>
</div>
</div><!-- panel-body -->
... ...