Skip to content

Commit

Permalink
Merge pull request #25 from koslib/features/dynamic-plugins-support
Browse files Browse the repository at this point in the history
Features/dynamic plugins support
  • Loading branch information
Konstantinos Livieratos authored Jan 2, 2022
2 parents c5eab04 + 25e7264 commit 92d5ff6
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@ This action was inspired by [kubernetes-action](https://github.com/Jberlinsky/ku

This Github Action was created with EKS in mind, therefore the following example refers to it.

## Input variables

1. `plugins`: you can specify a list of Helm plugins you'd like to install and use later on in your command. eg. helm-secrets or helm-diff. This action does not support only a specific list of Helm plugins, rather any Helm plugin as long as you supply its URL. You can use the following [example](#example) as a reference.
2. `command`: your kubectl/helm command. This supports multiline as per the Github Actions workflow syntax.

example for multiline:
```yaml
...
with:
command: |
helm upgrade --install my-release chart/repo
kubectl get pods
```
## Example
```yaml
Expand Down Expand Up @@ -38,6 +52,7 @@ jobs:
env:
KUBE_CONFIG_DATA: ${{ secrets.KUBE_CONFIG_DATA }}
with:
plugins: "https://github.com/jkroepke/helm-secrets" # optional
command: helm upgrade <release name> --install --wait <chart> -f <path to values.yaml>
```
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ inputs:
command:
description: "Your command (kubectl or helm)"
required: true
plugins:
description: "Comma-separated URLs for the Helm Plugins you need installed"
required: false
outputs:
result:
description: "Output returned by your Helm or kubectl command"
Expand Down
13 changes: 12 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,19 @@ set -e
echo ${KUBE_CONFIG_DATA} | base64 -d > kubeconfig
export KUBECONFIG="${PWD}/kubeconfig"

if [-z $INPUT_PLUGINS]
then
plugins=$(echo $INPUT_PLUGINS | tr ",")

for plugin in $plugins
do
echo "installing helm plugin: [$plugin]"
helm plugin install $plugin
done
fi

echo "running entrypoint command(s)"

response=$(sh -c " $*")
response=$(sh -c " $INPUT_COMMAND")

echo "::set-output name=response::$response"

0 comments on commit 92d5ff6

Please sign in to comment.