npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gocd-api

v0.9.0

Published

Access Go CD API

Downloads

21

Readme

gocd-api

Build Status CircleCI

Module to access data from your Go CD server (http://www.go.cd/), e.g. to feed it into a build monitor.

Will give you access to both current activity (which stage is currently building, what is the state of the latest pipeline run) and history data about past pipeline runs.

Usage

var goCdApi = require('gocd-api');
goCdApi.getInstance({
  url: 'https://1.2.3.4:8154',
  pipeline: 'yourPipelineName',
  user: 'yourGoUser',
  password: 'yourGoPassword',
  debug: true // default: false, will do some verbose logging to console
}).then(function(instanceWithACacheOfInitialData) {

  var gocdData = instanceWithACacheOfInitialData.readData("pipeline-name");
  //...

}).done();

Data

This is what you will get from readData():

{
  activity: {}, // which stage is currently building, what is the state of the latest pipeline run
  history: {}   // historical data about past pipeline runs
}

Activity

Sample: activity

The list of stages will basically contain the properties of Project entries cctray.xml.

Additions:

  • fields info and info2 for user-facing summaries
  • lastBuildStatus will be set to "Cancelled" based on Go.CD history information (cctray.xml only returns 'Success' or 'Failure' out of the box)
  • field gocdActivity can be used to determine if stage is actually building, or still scheduled/prepared/...

History

Sample: history.

Contains the raw data returned by the Go CD's history API endpoint returns.

Additions:

  • build_cause is enhanced with the set of files that were changed in the change set (if build was caused by a VCS change)

  • There is a summary object for each pipeline run with aggregated data that is useful for most build monitors:

    "summary": {
        "result": "passed",
        "text": "[2066] passed | Edward Norton | Some comment 5554 | 15:54:02, December 19th 2014",
        "lastScheduled": 1419000842499,
        "author": {
            "email": "<[email protected]>",
            "name": "Edward Norton",
            "initials": "eno"
        },
        "changeInfo": {
            "committer": "Edward Norton <[email protected]>",
            "comment": "Some comment 5554",
            "revision": "cb855ca1516888541722d8c0ed8973792f30ee57"
        }
    }

Note on how the data is loaded

Your first call to create the instance will fill a cache with all pipelines' history initially, so waiting for the instance might take a bit longer. It will go about 50 history entries into the past. Subsequent calls will get live updates for activities, and also live updates for the latest history. The rest of the data will be taken from the cache.

Development

Run tests

npm test

### Run a few smoke tests against a Go CD instance
GOCD_URL=https://your-gocd:8154 GOCD_USER=your-user GOCD_PASSWORD=your-password GOCD_PIPELINE=your-pipeline-name GOCD_DEBUG=true ./run_spec_integration.sh