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

jenkins-wait

v1.3.1

Published

A patient library for automating your automation

Downloads

18

Readme

jenkins-wait

Build Status npm version

code style: prettier Conventional Commits semantic-release

A patient library for automating your automation

You should not need this module.

Sometimes you can't control your corporate jenkins configuration, and have no choice but to trigger jobs manually. This library is made for that situation.

It can be installed globally and invoked from the command line, or imported and used as a part of another script. jenkins-wait will trigger a job, and wait for it to start, and finish, exiting with or returning the status of the triggered job.

Installation

use in your project

npm install --save-dev jenkins-wait

or globally

npm install --global jenkins-wait

Options

| option | required | default | description | | --------------- | -------- | ----------- | ----------------------------------------------------------- | | jenkins-base | yes | | Base jenkins url | | job-location | yes | | Location of the job | | username | no | undefined | username for basic auth | | password | no | undefined | password for basic auth | | poll-interval | no | 1000 | how long to wait before querying jenkins for build status | | use-https | no | true | use https protocol in making jenkins requests | | silent | no | false | suppress console output | | verbose | no | false | verbosely log all output, takes precedence over silent | | print-console | no | false | Print console output of the job after it completes | | parameters | no | undefined | colon-separated parameters to use for a parameterized build |

Command-line

jenkins-wait [options]

or use with npx

npx jenkins-wait [options]

It will exit with 0 when the triggered job returns a status of SUCCESS and a 1 for all other statuses.

API

The library exposes the JenkinsTrigger class

API Examples

Without parameters

const { JenkinsTrigger } = require('jenkins-wait');

const jenkinsJob = new JenkinsTrigger({
  baseJenkins: 'ci.mycompany.com',
  jobLocation: 'topLevel/myProject',
  username: 'itsme',
  password: 'securepassword',
  pollInterval: 1000,
  useHttps: true,
  silent: false
});

jenkinsJob
  .runJob()
  .then(result => {
    //do whatever you want with the result
  })
  .catch(error => {
    // Make sure to handle errors!
  });

With parameters

const { JenkinsTrigger } = require('jenkins-wait');

const jenkinsJob = new JenkinsTrigger({
  baseJenkins: 'ci.mycompany.com',
  jobLocation: 'topLevel/myProject',
  username: 'itsme',
  password: 'securepassword',
  pollInterval: 1000,
  useHttps: true,
  silent: true
});

jenkinsJob
  .runJob({ keyOne: 'valueOne', keyTwo: 'valueTwo' })
  .then(result => {
    // Do whatever you want with the result
  })
  .catch(error => {
    // Make sure to handle errors!
  });

CI Integration

When jenkins-wait is run from a CI environment (TravisCI, CircleCI, Jenkins, etc.) The running seconds count will not be printed to the console. When the CLI is used, it will also be run in verbose mode by default.

Development

Setup

npm install

Run tests

npm test

Build with babel

npm run build

Build in watch mode

Helpful for development

npm run build:watch