diff --git a/packages/client/src/client.js b/packages/client/src/client.js index 8b0e6661b..b8cdac1e3 100644 --- a/packages/client/src/client.js +++ b/packages/client/src/client.js @@ -136,6 +136,10 @@ export class PercyClient { // done more seemlessly without manually tracking build ids async createBuild({ resources = [], projectType, cliStartTime = null } = {}) { this.log.debug('Creating a new build...'); + let source = 'user_created'; + if (process.env.PERCY_AUTO_ENABLED_GROUP_BUILD === 'true') { + source = 'auto_enabled_group'; + } let tagsArr = tagsList(this.labels); @@ -159,7 +163,8 @@ export class PercyClient { 'parallel-total-shards': this.env.parallel.total, partial: this.env.partial, tags: tagsArr, - 'cli-start-time': cliStartTime + 'cli-start-time': cliStartTime, + source: source }, relationships: { resources: { diff --git a/packages/client/test/client.test.js b/packages/client/test/client.test.js index e73e2871b..d039b690e 100644 --- a/packages/client/test/client.test.js +++ b/packages/client/test/client.test.js @@ -166,6 +166,7 @@ describe('PercyClient', () => { 'parallel-nonce': client.env.parallel.nonce, 'parallel-total-shards': client.env.parallel.total, 'cli-start-time': null, + source: 'user_created', partial: client.env.partial, tags: [] } @@ -201,6 +202,7 @@ describe('PercyClient', () => { 'parallel-nonce': client.env.parallel.nonce, 'parallel-total-shards': client.env.parallel.total, 'cli-start-time': null, + source: 'user_created', partial: client.env.partial, tags: [] } @@ -283,6 +285,7 @@ describe('PercyClient', () => { 'parallel-nonce': client.env.parallel.nonce, 'parallel-total-shards': client.env.parallel.total, 'cli-start-time': null, + source: 'user_created', partial: client.env.partial, tags: [] } @@ -322,6 +325,7 @@ describe('PercyClient', () => { 'parallel-nonce': client.env.parallel.nonce, 'parallel-total-shards': client.env.parallel.total, 'cli-start-time': null, + source: 'user_created', partial: client.env.partial, tags: [{ id: null, name: 'tag1' }, { id: null, name: 'tag2' }] } @@ -329,6 +333,7 @@ describe('PercyClient', () => { }); it('creates a new build with cliStartTime', async () => { + process.env.PERCY_AUTO_ENABLED_GROUP_BUILD = 'true'; client = new PercyClient({ token: 'PERCY_TOKEN', labels: 'tag1,tag2' @@ -361,6 +366,7 @@ describe('PercyClient', () => { 'parallel-nonce': client.env.parallel.nonce, 'parallel-total-shards': client.env.parallel.total, 'cli-start-time': cliStartTime, + source: 'auto_enabled_group', partial: client.env.partial, tags: [{ id: null, name: 'tag1' }, { id: null, name: 'tag2' }] }