Skip to content

codacy/helm-poll

Repository files navigation

helm-poll

Codacy Badge CircleCI

A Helm plugin to poll for a release status.

Project Goals

As per the Helm documentation, a release can have the following final states:

"unknown", "deployed", "deleted", "superseded", "failed"

A final state means that the release does not have any ongoing operations, such as an upgrade.

Therefore, to avoid concurrent installation problems, we have created this plugin that polls for the state of a given release until Helm returns one of the final states mentioned above.

This means that once the release reaches one of these states, there is no ongoing installation and we are free to proceed.

Getting Started

The following command will install this plugin with your local copy of Helm.

Choose the latest version from the releases and install the appropriate version for your OS:

Linux

helm plugin install https://github.com/codacy/helm-poll/releases/download/latest/helm-poll-linux.tgz

MacOS

helm plugin install https://github.com/codacy/helm-poll/releases/download/latest/helm-poll-macos.tgz

Windows

helm plugin install https://github.com/codacy/helm-poll/releases/download/latest/helm-poll-windows.tgz

Prerequisites

Please note that this plugin will poll the state of the releases in the cluster that is in your current kubeconfig context. Make sure you are pointing to the desired cluster before running the plugin.

Build and run

To build the plugin binary, all you really need to do is:

go build .

You can then run the produced binary with

$ ./poll

Usage: poll [--help] [-i value] [-r value] [-t value] [parameters ...]
     --debug  Run with debug messages on
     --help  Help
 -i, --interval=value
             The polling interval in seconds (default: 5)
  -n, --namespace=value
             Namespace where the release is installed. (default: "default")
 -r, --release=value
             Release name to poll for.
 -t, --timeout=value
             The timeout in seconds (default: 300)

Upon success, the plugin will return the JSON output corresponding to the release:

helm poll -r codacy-nightly -n codacy
{
  "Name": "codacy-nightly",
  "Revision": 47,
  "Updated": "Thu Jan 30 13:41:56 2020",
  "Status": "deployed",
  "Chart": "codacy-0.5.0-NIGHTLY.30-01-2020",
  "AppVersion": "0.5.0-NIGHTLY.30-01-2020",
  "Namespace": "codacy-nightly"
}

Polling for a release that does not exist will return an empty release:

{
  "Name": "",
  "Revision": 0,
  "Updated": "",
  "Status": "",
  "Chart": "",
  "AppVersion": "",
  "Namespace": ""
}

Because the output is JSON, you can pipe it through jq for fancier operations.

Running the tests

go test ./... -v

Design

Defaults

Parameter Description Default Required
--release Name of the release to monitor nil True
--namespace Namespace where the release lives default False
--timeout Polling timeout in seconds 300 False
--interval Polling interval in seconds 5 False
--debug Enable debug messages false False

What is Codacy

Codacy is an Automated Code Review Tool that monitors your technical debt, helps you improve your code quality, teaches best practices to your developers, and helps you save time in Code Reviews.

Among Codacy's features

  • Identify new Static Analysis issues
  • Commit and Pull Request Analysis with GitHub, BitBucket/Stash, GitLab (and also direct git repositories)
  • Auto-comments on Commits and Pull Requests
  • Integrations with Slack, HipChat, Jira, YouTrack
  • Track issues in Code Style, Security, Error Proneness, Performance, Unused Code and other categories

Codacy also helps keep track of Code Coverage, Code Duplication, and Code Complexity.

Codacy supports PHP, Python, Ruby, Java, JavaScript, and Scala, among others.

Codacy is free for Open Source projects.

License

helm-poll is available under the MIT license. See the LICENSE file for more info.

About

An Helm plugin to poll for a release status.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors