Skip to content

Commit

Permalink
Avoid confusion by exiting if the release is not found (#5)
Browse files Browse the repository at this point in the history
* avoid confusion by exiting if the release is not found

* bump version

* suppress grep output
  • Loading branch information
jzbruno authored Feb 23, 2021
1 parent d2c9cab commit bdb5da1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

A Helm plugin to get debug information about the Kubernetes resources created by a release. The output is useful for troubleshooting in a CI / CD environment where it is valuable to capture the state of a release following a failure. The following information will be output to the output directory.

For best results, it is recommended that your Helm chart specifies a metadata.namespace value for each resource (even if it just the chart default of `{{ .Release.Namespace }}`). The plugin uses the output of `helm get manifest` and `helm get hooks` to determine the resources available for log collection.

* Environment variables
* Helm release list
* Helm user values
Expand All @@ -14,6 +12,8 @@ For best results, it is recommended that your Helm chart specifies a metadata.na
* Kubernetes describe of each pod
* Kubernetes logs for each container

For best results, it is recommended that your Helm chart specifies a metadata.namespace value for each resource (even if it just the chart default of `{{ .Release.Namespace }}`). The plugin uses the output of `helm get manifest` and `helm get hooks` to determine the resources available for log collection.

## Requirements

* Helm v3
Expand Down
2 changes: 1 addition & 1 deletion plugin.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: release-logs
version: 0.4.0
version: 0.5.0
usage: Get debug info about resources created by a release.
description: A Helm plugin to get debug information about the Kubernetes resources creaeted by a release.
command: $HELM_PLUGIN_DIR/release-logs.sh
6 changes: 6 additions & 0 deletions release-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,12 @@ env | grep -v PASS | sort > "${dir}/env"
echo "Saving Helm release list ..."
${helm} ls > "${dir}/releases.log" || true

echo "Checking for Helm release ${release} ..."
if ! ${helm} ls -q | grep -q "${release}"; then
echo "Release ${release} not found. This may mean the namespace is incorrect or the Helm install or upgrade failed."
exit 0
fi

echo "Saving Helm user values ..."
${helm} get values "${release}" > "${dir}/values-user.yaml" || true

Expand Down

0 comments on commit bdb5da1

Please sign in to comment.