0.0.1 • Published 10 years ago

gitlab-ci-client v0.0.1

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

gitlab-ci-client

Easy access to GitLab CI for node

Install

$ npm install --save gitlab-ci-client

Tests

$ npm test

Coverage

$ npm run cover

Usage

var gitlab = require('gitlab-ci-client')({
  apiUrl: 'https://ci.gitlab.com'
, token: '<your token>'
, gitlabUrl: 'https://gitlab.com'
, strictSSL: true
, runnerToken: '<your runner token>'
})

API

Projects

var projects = gitlab.projects

Projects.list()

List all projects, all owned projects, or a single project with the given id

Params
NameTypeDesc
idString, Numberowned or project id (optional)
cbFunctionfunction(err, projects, res)

Projects.create()

Create a new project with the given data

Params
NameTypeDesc
dataObjectThe params to create
cbFunctionfunction(err, body)

Where data requires:

  • name The project name
  • gitlab_id The GitLab Project ID
  • gitlab_url The web url of the project on GitLab
  • ssh_url_to_repo The ssh url of the project on GitLab

And can also have:

  • scripts (Array or string)
  • default_ref (Defaults to master)

Projects.update()

Updates the project with the given id

Params
NameTypeDesc
idString, NumberThe project id
dataObjectThe params to create
cbFunctionfunction(err, body)

Where data requires:

  • name The project name
  • gitlab_id The GitLab Project ID
  • gitlab_url The web url of the project on GitLab
  • ssh_url_to_repo The ssh url of the project on GitLab

And can also have:

  • scripts (Array or string)
  • default_ref (Defaults to master)

Projects.del()

Deletes the project with the given id

Params
NameTypeDesc
idString, NumberThe project id
cbFunctionfunction(err, body)

Projects.link()

Adds a runner to the given project id

Params
NameTypeDesc
idString, NumberThe project id
runnerIdString, NumberThe runner id
cbFunctionfunction(err, body)

Projects.unlink()

Remove a runner from the given project id

Params
NameTypeDesc
idString, NumberThe project id
runnerIdString, NumberThe runner id
cbFunctionfunction(err, body)

Runners

var runners = gitlab.runners

Runners.list()

List all of the registered runners

Params
NameTypeDesc
cbFunctionfunction(err, body)

Runners.register()

Registers the runner with the given data

Params
NameTypeDesc
dataObjectThe runner info
cbFunctionfunction(err, body)

Builds

var builds = gitlab.builds

Builds.run()

Tells the coordinator to run this next build

Params
NameTypeDesc
tokenStringThe runner token
cbFunctionfunction(err, body)

Builds.update()

Updates the coordinator with the info for the given build id

Params
NameTypeDesc
idNumberThe build id
tokenStringThe runner token
dataObjectThe build info
cbFunctionfunction(err, body)

Where data can have:

  • state (String)
  • trace (String)

Author

Evan Lucas

License

MIT