Skip to content

Latest commit

 

History

History
64 lines (47 loc) · 2.56 KB

builds-collection.md

File metadata and controls

64 lines (47 loc) · 2.56 KB

BuildsCollection()

Facade entity which accumulates operations with currently running and db saved builds.

BuildsCollection.create(params:Object, [callback(err,result)]:Function)

Create build by running given project.

  • params.projectName - project to build
  • params.withScmChangesOnly - if true then build will be started only if there is scm changes for project
  • params.queueQueued - if true then currently queued project can be queued again
  • params.initiator - contains information about initiator of the build, must contain type property e.g. when one build triggers another: initiator: {type: 'build', id: 123, number: 10, project: {name: 'project1'}}
  • params.buildParams - params for current build (override project config)
  • params.buildParams.scmRev - target revision for the build
  • params.env - target environment for the build

result will contain created builds if they were created, every build with at least following fields: id, status, completed, project, params, createDate.

BuildsCollection.cancel(params:Object, [callback(err)]:Function)

Cancel build by id. Queued or running build can be canceled.

  • params.buildId - id of target build to cancel
  • params.canceledBy - contains information about initiator of cancel, must contain type property e.g. when canceled via http api: canceledBy: {type: 'httpApi'}

BuildsCollection.get(id:Number, callback(err,build):Function)

Get build by id.

BuildsCollection.getLogLines(params:Object, callback(err,logLinesData):Function)

Get log lines for the given build.

  • params.buildId - target build
  • params.from - if set then lines from that number will be returned
  • params.to - if set then lines to that number will be returned

BuildsCollection.getAvgBuildDuration(builds:Array.)

Calculate average build duration for the given builds.

BuildsCollection.getRecent(params:Object, callback(err,builds):Function)

Get builds sorted by date in descending order.

  • params.projectName - optional project filter
  • params.status - optional status filter, can be used only when params.projectName is set. When used builds in the result will contain only following fields: id, number, startDate, endDate
  • params.filter - custom filter function which accepts build and returns boolean
  • params.limit - maximum builds count to get

BuildsCollection.getDoneStreak(params:Object, callback(err,doneStreak):Function)

Get info about current done builds streak.

  • params.projectName - optional project filter