Skip to content

Commit 59d725e

Browse files
add new option for baseline build
1 parent ced2045 commit 59d725e

File tree

7 files changed

+11
-7
lines changed

7 files changed

+11
-7
lines changed

src/commander/commander.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ program
1919
.option('-c --config <filepath>', 'Config file path')
2020
.option('--markBaseline', 'Mark this build baseline')
2121
.option('--baselineBranch <string>', 'Mark this build baseline')
22+
.option('--baselineBuild <string>', 'Mark this build baseline')
2223
.addCommand(exec)
2324
.addCommand(capture)
2425
.addCommand(configWeb)

src/lib/ctx.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ export default (options: Record<string, string>): Context => {
140140
ignorePattern: ignoreFilePattern,
141141
fetchResults: fetchResultObj,
142142
fetchResultsFileName: fetchResultsFileObj,
143-
baselineBranch: options.baselineBranch || ''
143+
baselineBranch: options.baselineBranch || '',
144+
baselineBuild: options.baselineBuild || ''
144145
},
145146
cliVersion: version,
146147
totalSnapshots: -1,

src/lib/httpClient.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export default class httpClient {
202202
}
203203
}
204204

205-
createBuild(git: Git, config: any, log: Logger, buildName: string, isStartExec: boolean, smartGit: boolean, markBaseline: boolean) {
205+
createBuild(git: Git, config: any, log: Logger, buildName: string, isStartExec: boolean, smartGit: boolean, markBaseline: boolean, baselineBuild: string) {
206206
return this.request({
207207
url: '/build',
208208
method: 'POST',
@@ -213,7 +213,8 @@ export default class httpClient {
213213
isStartExec,
214214
packageVersion: pkgJSON.version,
215215
smartGit,
216-
markBaseline
216+
markBaseline,
217+
baselineBuild
217218
}
218219
}, log)
219220
}

src/lib/snapshotQueue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ export default class Queue {
335335
} else {
336336
if (!this.ctx.build?.id) {
337337
if (this.ctx.authenticatedInitially) {
338-
let resp = await this.ctx.client.createBuild(this.ctx.git, this.ctx.config, this.ctx.log, this.ctx.build.name, false, false, false);
338+
let resp = await this.ctx.client.createBuild(this.ctx.git, this.ctx.config, this.ctx.log, this.ctx.build.name, false, false, false, '');
339339
this.ctx.build = {
340340
id: resp.data.buildId,
341341
name: resp.data.buildName,

src/tasks/createBuild.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
1010
updateLogContext({task: 'createBuild'});
1111

1212
try {
13-
let resp = await ctx.client.createBuild(ctx.git, ctx.config, ctx.log, ctx.build.name, ctx.isStartExec, ctx.env.SMART_GIT, ctx.options.markBaseline);
13+
let resp = await ctx.client.createBuild(ctx.git, ctx.config, ctx.log, ctx.build.name, ctx.isStartExec, ctx.env.SMART_GIT, ctx.options.markBaseline, ctx.options.baselineBuild);
1414
ctx.build = {
1515
id: resp.data.buildId,
1616
name: resp.data.buildName,

src/tasks/createBuildExec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export default (ctx: Context): ListrTask<Context, ListrRendererFactory, ListrRen
1212

1313
try {
1414
if (ctx.authenticatedInitially && !ctx.config.skipBuildCreation) {
15-
let resp = await ctx.client.createBuild(ctx.git, ctx.config, ctx.log, ctx.build.name, ctx.isStartExec, ctx.env.SMART_GIT, ctx.options.markBaseline);
15+
let resp = await ctx.client.createBuild(ctx.git, ctx.config, ctx.log, ctx.build.name, ctx.isStartExec, ctx.env.SMART_GIT, ctx.options.markBaseline, ctx.options.baselineBuild);
1616
ctx.build = {
1717
id: resp.data.buildId,
1818
name: resp.data.buildName,

src/types.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ export interface Context {
6060
ignorePattern?: Array<string>,
6161
fetchResults?: boolean,
6262
fetchResultsFileName?: string,
63-
baselineBranch?: string
63+
baselineBranch?: string,
64+
baselineBuild?: string
6465
}
6566
cliVersion: string;
6667
totalSnapshots: number;

0 commit comments

Comments
 (0)