/harbor-client

JavaScript client library for Harbor

Primary LanguageJavaScriptOtherNOASSERTION

harbor-client

JavaScript client for Harbor. Both CLI and library. It's isomorphic which means it can be used in both node.js and browsers (using a tool like Browserify).

usage (cli)

install into project

$ npm install --save-dev https://github.com/turnerlabs/harbor-client.git

or install globally

$ npm install -g https://github.com/turnerlabs/harbor-client.git

then

deploy shipment

$ harbor deploy --shipment myapp --environment dev --container myapp --image registry.services.dmtio.net/myapp:1.0.0 --buildtoken zcdcNMgHuusHm6pDtOGJ01CJxwJCUKz9

delete shipment

$ harbor delete --shipment myapp --user foo

update a shipment

Currently only supports updating environment variables. Note that this does a delete/add against the api.

$ harbor update --file dev.json --user foo

The expected file format is

{
  "shipment": "my-app",
  "environment": "dev",
  "envVars": {
    "SOME_VARIABLE": "foo",
    "ANOTHER_VARIABLE": "bar"
  }
}

usage (library)

var harbor = require('harbor-client');

var options = {
  shipment: 'myapp',
  environment: 'dev',
  container: 'myapp',
  image: 'registry.services.dmtio.net/myapp:1.0.0',
  buildToken: 'zcdcNMgHuusHm6pDtOGJ01CJxwJCUKz9'
};

harbor.deploy(options, function(err, result) {
  if (!err && result.success)
    console.log('deploy succeeded!');
  else
    console.error('deploy failed');
});

options = {
  shipment: 'myapp',
  username: 'foo',
  password: 'bar'
};

harbor.deleteShipment(options, function(err, result) {
  if (!err && result.success)
    console.log('shipment deleted!');
  else
    console.error('delete shipment failed');
});

options = {
  shipment: 'myapp',
  environment: 'dev',
  envVarsFile: '/path/to/my/file.json',
  username: 'foo',
  password: 'bar'
};

harbor.updateEnvVars(options, function(err, result) {
  if (!err && result.success)
    console.log('shipment updated!');
  else
    console.error('update shipment failed');
});