Hapi builds plugin for the Screwdriver API
const Hapi = require('hapi');
const server = new Hapi.Server();
const buildsPlugin = require('./');
server.connection({ port: 3000 });
server.register({
register: buildsPlugin,
options: {}
}, () => {
server.start((err) => {
if (err) {
throw err;
}
console.log('Server running at:', server.info.uri);
});
});
GET /builds/{id}
GET /builds/{id}/logs
POST /builds
Example payload:
{
"jobId": "d398fb192747c9a0124e9e5b4e6e8e841cf8c71c"
}
PUT /builds/{id}
Example payload:
{
"status": "FAILURE"
}
The server supplies factories to plugins in the form of server app values:
// handler in buildsPlugin.js
handler: (request, reply) => {
const factory = request.server.app.buildFactory;
// ...
}