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

hubot-deploy-status

v0.4.2

Published

Check deployment statuses from GitHub

Downloads

7

Readme

hubot-deploy-status

Check deployment statuses from GitHub. Tries to use same data and configs that's available for hubot-deploy. Reads app config from apps.json and uses HUBOT_GITHUB_TOKEN or a user's personal deploy token (see hubot-deploy) if that's available to make api requests.

The script will fetch the latest deployment for an app (in specified environment) and display its status compared to the master (repo default) branch.

The script will also allow automatic cron-like deployment status checks, so your hubot can be configured to notify you if some environment for an app is not up to date (for example one component hasn't been deployed to production).

Tokens

Please not that to work, the GitHub tokens used must have user,repo oauth scopes. hubot-deploy requires only repo_deployment scope but that's not enough for this script.

Usage

For app that's configured with name example-app and has environments staging and production, you can say

hubot deploy-status for example-app in staging

and the response will be something like

Hubot:

App example is 4 commits ahead master in staging.
The deployed ref is deploy-with-heaven (e429769).

Commits not in master:
e88769b Mumakil  Bump version
6f23b1a Mumakil  Create a separate group for deploy gems
7e2aaae Mumakil  Use capistrano-flowdock for deploy notifications
e429769 Mumakil  Use double quotes in gemfile

To check which apps and envs can be queried:

hubot deploy-status

To toggle / turn on / turn on / check status of configured automatic checks

# what apps and envs are automatically checked
hubot deploy-status:auto

# Turn all checks off
hubot deploy-status:auto off

# Toggle specific environment
hubot deploy-status:auto toggle app1 in production

# Turn on all environments for an app
hubot deploy-status:auto on for app1

Automatic checks and adapters

It's possible to use a different adapters to handle the automatic status check posting. Currently by default the script will post fairly simple messages to chat. Another option if you're a Flowdock user is to use Flowdock adapter.

TL;DR Supported adapters at the moment are default and flowdock.

Configuration

In general, the script will need HUBOT_GITHUB_TOKEN, which you will probably already have if your hubot interacts with github. If you want to have full functionality, the token must have user,repo oauth scopes.

The following environment variables can be set and will be used as defaults, but individual apps can override the settings. Examples included:

DEPLOY_STATUS_TIMEZONE=Europe/Helsinki
DEPLOY_STATUS_ROOM=acdcabbacd0123456789
DEPLOY_STATUS_ADAPTER=flowdock

Flowdock adapter supports additional:

DEPLOY_STATUS_SOURCE_TOKEN=9559e07bea935d55657bfdcb8d2b9c2c
DEPLOY_STATUS_AUTHOR_NAME=Hubot
DEPLOY_STATUS_AUTHOR_AVATAR=http://www.example.com/avatar.jpg

Then, in apps.json, you can configure the automatic status using cron-like syntax:

{
    // A simple case with just production environment.
    // Check the status once every work day at 8am and post
    // results to the default chat room in env DEPLOY_STATUS_ROOM.
    "example1": {
        "provider": "heroku",
        "repository": "acme/example1",
        "check_deploy_status": {
            "environments": {
                "production": "0 0 8 * * 1-5"
            }
        }
    },
    // A little more complex example with multiple environments.
    // Checks production every workday at 8am and staging environment every
    // two hours overriding adapter and room.
    "example2": {
        "provider": "bundler_capistrano",
        "repository": "acme/example2",
        "environments": ["staging", "production"],
        "check_deploy_status": {
            "environments": {
                "production": "0 0 8 * * 1-5",
                "staging": "0 0 8-18/2 * * 1-5"
            },
            "adapter": "default",
            "room": "14dc03c3-8c97-45a5-8432-59df312e7c1b"
        }
    }
}

The script uses cron package, so the cron pattern can be anything that package understands. Timezones are from time package.