1.0.12 • Published 8 years ago

teamcity-client v1.0.12

Weekly downloads
19
License
ISC
Repository
github
Last release
8 years ago

Build Status

Teamcity Node.js client

const TeamcityClient = require('teamcity-client');

const api = new TeamcityClient({
    host: 'teamcity.domain.com',
    user: 'username', // optional
    password: 'pwd' // optional
});

builds

Get detail info about build

const options = {
    tags: ['production', 'tested'],
    user: 'username'
};

// get last build by criteria
api.build.detail(options)
   .then(buildInfo => console.log(buildInfo))
   .catch(err => console.error(err));

// get build by id
api.build.detail({id: 'my-build-id'})
   .then(buildInfo => console.log(buildInfo))
   .catch(err => console.error(err));

// get build by number
api.build.detail({number: '537'})
   .then(buildInfo => console.log(buildInfo))
   .catch(err => console.error(err));

Get list of builds by criteria

api.build.list({buildType: {id: 'project-id'}})
   .then(buildList => console.log(buildList))

api.build.list({buildType: {id: 'project-id'}, tags: ['production']})
   .then(buildList => console.log(buildList))

You can use all build locator params to get build

artifacts

Download source

const fs = require('q-io/fs');

api.artifact.content(options, 'relative/path/to/source')
   .then(blob => fs.write('data.zip', blob))

Get metadata

api.artifact.meta(options, 'source.json')
   .then(data => console.log(data));

Response example

{
  "name": "source.json",
  "size": 25360,
  "modificationTime": "20151202T183212+0300",
  "href": "/guestAuth/app/rest/builds/id:10/artifacts/metadata/source.json",
  "content": {
    "href": "/guestAuth/app/rest/builds/id:10/artifacts/content/source.json"
  }
}

Get children list

api.artifact.children(options, 'relative/path')
   .then(data => console.log(JSON.stringify(data, null, 2)))

Response example

{
  "count": 1,
  "file": [
    {
      "name": "pathA",
      "modificationTime": "2T183246+0300",
      "href": "/guestAuth/app/rest/builds/id:4869415/artifacts/metadata/relative/path/pathA",
      "children": {
        "href": "/guestAuth/app/rest/builds/id:4869415/artifacts/children/relative/path/pathA"
      }
    },
  ]
}

Download archived sources

Download zip with all js-files in directory relative/path

api.artifact.archived(options, 'relative/path', '**/*.js')
   .then(blob => fs.write('data.zip', blob))

tags

Get tags

api.tags.get(locator)
   .then(data => console.log(data))

Add tags

api.tags.add(locator, ['tag1', 'tag2'])
   .then(data => console.log(data))

api.tags.add(locator, 'new_tag')
   .then(data => console.log(data))

Replace tags

api.tags.replace(locator, ['tag1', 'tag2'])
   .then(data => console.log(data))

api.tags.add(locator, 'new_tag')
   .then(data => console.log(data))

changes

Get changes list

api.changes.list(buildId)
   .then(data => console.log(data))

Get changes list with details

api.changes.list(buildId, {withDetails: true})
   .then(data => console.log(data))

Get particular change details

api.changes.detail(changeId)
   .then(data => console.log(data))
1.0.12

8 years ago

1.0.11

9 years ago

1.0.10

9 years ago

1.0.9

9 years ago

1.0.8

9 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.1

10 years ago