Categorygithub.com/rootly-io/cli
module
0.0.4
Repository: https://github.com/rootly-io/cli.git
Documentation: pkg.go.dev

# README

logo

rootly cli

GitHub release (latest by date) GitHub go.mod Go version Golang report card
build lint release test

A command-line interface for rootly

📜 Table of Contents

👋 Getting Started

The rootly command-line tool allows you to interact with rootly in your terminal, CI environment, or anything that can run a simple program. At the moment the main purpose of the cli is to send pulses right from the command line. This is great for sending a pulse at the end of a deploy script for example. You can also send pulses based off the exit status of a given command to run.

🚀 Install

🍎 macOS

Simply run the command below:

brew install rootly-io/homebrew-tap/rootly

🐧 Linux and đŸ–Ĩī¸ Windows

You can grab the binary from the latest release

📟 Commands

â„šī¸ rootly pulse

rootly pulse allows you to send a pulse right from the command-line. The summary for the pulse, which is required, goes at the end of the command as a normal argument.

Flag NameDescriptionExamplesRequiredEnvironment Variable
api-keyA rootly api key--api-key "ABC123"YesROOTLY_API_KEY
api-hostHost url for the rootly api. Default is https://api.rootly.io--api-host "https://rootly.hello.com"NoROOTLY_API_HOST
labelsKey value pair labels (separated with commas with no spaces around =)--labels "version=2, attempt=1"NoROOTLY_LABELS
servicesServices associated with the pulse (separated with commas)--services "elasticsearch-prod"NoROOTLY_SERVICES
environmentsEnvironments associated with the pulse (separated with commas)--environments "staging, production"NoROOTLY_ENVIRONMENTS

Here are some examples:

  • rootly pulse-run --api-key "ABC123" Hello there
    • Summary: Hello there
    • Labels: None
    • Services: None
    • Environments: None
  • rootly pulse --api-key "ABC123" --environments "staging, production" --services "elasticsearch-staging, elasticsearch-prod" Hello World!
    • Summary: Hello World
    • Labels: None
    • Services: elasticsearch-staging and elasticsearch-prod
    • Environments: staging and production
  • rootly pulse --api-key ABC123 --environments "production" --labels "Version=2, Attempt=1" Is this thing on?
    • Summary: Is this thing on?
    • Labels: Version: 2 and Attempt: 1
    • Services: None
    • Environments: production

🏃 rootly pulse-run

rootly pulse-run allows you to wrap a terminal command and send a pulse with a label of the exit code. The summary for the pulse is a flag and if no value is provided it will use the command. The command goes at the end of the command as a normal argument.

Flag NameDescriptionExamplesRequiredEnvironment Variable
api-keyA rootly api key--api-key "ABC123"YesROOTLY_API_KEY
api-hostHost url for the rootly api. Default is https://api.rootly.io--api-host "https://rootly.hello.com"NoROOTLY_API_HOST
summarySummary for the pulse. Default is just the command--summary "Deployed Website"NoROOTLY_SUMMARY
labelsKey value pair labels (separated with commas with no spaces around =)--labels "Version=2, Attempt=1"NoROOTLY_LABELS
servicesServices associated with the pulse (separated with commas)--services "elasticsearch-prod"NoROOTLY_SERVICES
environmentsEnvironments associated with the pulse (separated with commas)--environments "staging, production"NoROOTLY_ENVIRONMENTS

Here are some examples:

  • rootly pulse-run --api-key "ABC123" make publish
    • Summary: make publish
    • Labels: Exit Code: 0
    • Services: None
    • Environments: None
    • Command: make publish
  • rootly pulse-run --api-key "ABC123" --environments "staging, production" --services "elasticsearch-staging, elasticsearch-prod" echo Hello World
    • Summary: echo Hello World
    • Labels: Exit Code: 0
    • Services: elasticsearch-staging and elasticsearch-prod
    • Environments: staging and production
    • Command: echo Hello World
  • rootly pulse --api-key ABC123 --environments "production" --labels "version=2, attempt=1" --summary "Deploy Website" sh deploy.sh
    • Summary: sh deploy.sh
    • Labels: Version: 2, Attempt: 1, and Exit Code: 1
    • Services: None
    • Environments: production
    • Command: sh deploy.sh

đŸ“Ļ Running in CI

When using the rootly CLI in a CI environment there are some useful features to make the process easier. Every single flag can use an environment variable instead. The api-key flag for example could use the environment variable ROOTLY_API_KEY instead. To get the environment variable for a certain flag just replace all hyphens (-) with underscores (_), make all letters uppercase, and add ROOTLY_ to the front.

There is also a GitHub action for rootly pulse that makes it easy to use in a GitHub actions environment. See the rootly-io/pulse-action repository for more information.

# Packages

No description provided by the author
No description provided by the author