
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
node-hydra-connector
Advanced tools
A Node.js module that allows remote control of a Hydra instance: a Nix-based continuous integration service
Remotely control Hydra: a Nix-based continuous integration server by invoking its REST API from a Node.js application.
There are two ways this package can installed.
To install this package through the Nix package manager, obtain a copy of Nixpkgs and run:
$ nix-env -f '<nixpkgs>' -iA nodePackages.node-hydra-connector
Alternatively, this package can also be installed through NPM by running:
$ npm install -g node-hydra-connector
Instantiate a HydraConnector
object and then call any of the supported
operations.
The following example code connects to a Hydra instance running on localhost
,
queries all projects and displays their names:
var HydraConnector = require('hydra-connector').HydraConnector;
var hydraConnector = new HydraConnector("http://localhost");
hydraConnector.queryProjects(function(err, projects) {
if(err) {
console.log("Some error occurred: "+err);
} else {
for(var i = 0; i < projects.length; i++) {
var project = projects[i];
console.log("Project: "+project.name);
}
}
});
Some operations, e.g. the write operations require user authentication.
By invoking the login()
method, we can authenticate ourselves:
hydraConnector.login("admin", "myverysecretpassword", function(err) {
if(err) {
console.log("Login succeeded!");
} else {
console.log("Some error occurred: "+err);
}
});
Likewise, we can also logout by invoking:
hydraConnector.logout(function(err) {
if(err) {
console.log("Logout succeeded!");
} else {
console.log("Some error occurred: "+err);
}
});
A private Hydra server may be hidden behind a reverse proxy that requires HTTP
basic authentication. To authenticate, we can provide the HTTP basic credentials
to the HydraConnector
constructor:
var HydraConnector = require('hydra-connector').HydraConnector;
var hydraConnector = new HydraConnector("http://localhost", "sander", "12345"); // HTTP basic credentials
This package also includes a command-line utility using the API to communicate with a Hydra instance from the command-line.
$ hydra-connect --help
When using the tool, you typically want to start with an overview of projects:
$ hydra-connect --url http://localhost --projects
For each request, the tool will provide command suggestions that can be used to obtain more detailed information, such as querying the properties of an individual project:
$ hydra-connect --url http://localhost --project MyProject
All requests that display information can also provide the underlying JSON representation that comes from Hydra's REST API:
$ hydra-connect --url http://localhost --project MyProject --json
This package includes API documentation, which can be generated with JSDoc.
MIT
FAQs
A Node.js module that allows remote control of a Hydra instance: a Nix-based continuous integration service
We found that node-hydra-connector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.