Skip to content

Latest commit

 

History

History
64 lines (50 loc) · 1.01 KB

README.md

File metadata and controls

64 lines (50 loc) · 1.01 KB

Builds Plugin

Hapi builds plugin for the Screwdriver API

Usage

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);
    });
});

Routes

Returns a single build

GET /builds/{id}

Returns a Stream of logs

GET /builds/{id}/logs

Creates a build

POST /builds

Example payload:

{
    "jobId": "d398fb192747c9a0124e9e5b4e6e8e841cf8c71c"
}

Updates a build

PUT /builds/{id}

Example payload:

{
    "status": "FAILURE"
}

Access to Factory methods

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;

    // ...
}