Skip to content

Commit 490d3b7

Browse files
AnakinPtHugo Dias
and
Hugo Dias
authored
Add support for helm secrets with vals backend (#38)
* Add support for helm secrets with vals backend * Add an example for the usage of use-secrets-vals in the deployment of a chart --------- Co-authored-by: Hugo Dias <[email protected]>
1 parent 46555a6 commit 490d3b7

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

README.md

+19
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Following inputs can be used as `step.with` keys
4848
| `pass-credentials` | String | Pass credentials to all domains. set (Optional) |
4949
| `username` | String | Chart repository username where to locate the requested chart. |
5050
| `password` | String | Chart repository password where to locate the requested chart. |
51+
| `use-secrets-vals` | Boolean | Use secrets plugin using vals to evaluate the secrets |
5152

5253
## Example 1 - local repo chart
5354

@@ -118,6 +119,24 @@ Following inputs can be used as `step.with` keys
118119
... (put your other arguments here)
119120
```
120121

122+
## Example 5 - Use secrets with vals backend
123+
```yaml
124+
- name: Deploy Helm
125+
uses: bitovi/[email protected]
126+
with:
127+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
128+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
129+
aws-region: us-west-2
130+
cluster-name: mycluster
131+
config-files: .github/values/dev.yaml
132+
chart-path: chart/
133+
namespace: dev
134+
values: key1=value1,key2=value2
135+
name: release_name
136+
use-secrets-vals: true
137+
plugins: https://github.com/jkroepke/helm-secrets
138+
```
139+
121140
## Example Uninstall
122141
123142
```yaml

action.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ inputs:
8989
username:
9090
description: 'Chart repository username where to locate the requested chart.'
9191
required: false
92-
92+
use-secrets-vals:
93+
description: 'Uses the secrets with vals backend to apply the chart'
94+
required: false
9395
runs:
9496
using: 'docker'
9597
image: 'Dockerfile'
@@ -120,3 +122,4 @@ runs:
120122
REPO_USERNAME: ${{ inputs.username }}
121123
REPO_PASSWORD: ${{ inputs.password }}
122124
VERSION: ${{ inputs.version }}
125+
USE_SECRETS_VALS: ${{ inputs.use-secrets-vals }}

deploy.sh

+7-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,13 @@ fi
124124
# Proceed with installation procedure
125125

126126
if [ "${HELM_ACTION}" == "install" ]; then
127-
# Upgrade or install the chart. This does it all.
128-
HELM_COMMAND="helm upgrade --install --create-namespace --timeout ${TIMEOUT} ${HELM_AUTH}"
127+
128+
if [ -n "${USE_SECRETS_VALS}" ]; then
129+
HELM_COMMAND="helm secrets --backend vals --evaluate-templates true upgrade --install --create-namespace --timeout ${TIMEOUT} ${HELM_AUTH}"
130+
else
131+
# Upgrade or install the chart. This does it all.
132+
HELM_COMMAND="helm upgrade --install --create-namespace --timeout ${TIMEOUT} ${HELM_AUTH}"
133+
fi
129134

130135
# If we should wait, then do so
131136
if [ -n "${HELM_WAIT}" ]; then

0 commit comments

Comments
 (0)