Skip to content

Commit

Permalink
Ahs extra values (#22)
Browse files Browse the repository at this point in the history
* Support values input to action that is passed to helm (deploy only)

* -z -n

* helmfile, not helm. Use --state-values-set instead of --set

* in more spots

* debug

* try a file

* try a values file

* sub file -> yaml

* fix superfluous flag arg

* cleanup

* revert formatting changes

* fix whitespace

* Echo extra values for visibility

* Revert accidental formatting changes

* Choose option 2: use a yaml file
  • Loading branch information
ozydingo authored Jan 26, 2023
1 parent 398cfbc commit 97b1a23
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
4 changes: 4 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ inputs:
description: The name of the label used to describe the helm release
default: "release"
required: false
values_yaml:
description: YAML string with extra values to use in a helmfile deploy
required: false
outputs:
webapp-url:
description: "Web Application url"
Expand All @@ -58,6 +61,7 @@ runs:
env:
AWS_REGION: ${{ inputs.aws-region }}
ENVIRONMENT: ${{ inputs.environment }}
HELM_VALUES_YAML: ${{ inputs.values_yaml }}
HELMFILE: ${{ inputs.helmfile }}
HELMFILE_PATH: ${{ inputs.helmfile-path }}
NAMESPACE: ${{ inputs.namespace }}
Expand Down
13 changes: 8 additions & 5 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e
export APPLICATION_HELMFILE=$(pwd)/${HELMFILE_PATH}/${HELMFILE}

source /etc/profile.d/aws.sh

# Used for debugging
aws sts --region ${AWS_REGION} get-caller-identity

Expand All @@ -22,8 +22,13 @@ if [[ "${HELM_DEBUG}" == "true" ]]; then
DEBUG_ARGS=" --debug"
fi

if [[ "${OPERATION}" == "deploy" ]]; then
if [[ -n "$HELM_VALUES_YAML" ]]; then
echo -e "Using extra values:\n${HELM_VALUES_YAML}"
export HELM_VALUES_FILE="/tmp/extra_helm_values.yml"
echo "$HELM_VALUES_YAML" > "$HELM_VALUES_FILE"
fi

if [[ "${OPERATION}" == "deploy" ]]; then
OPERATION_COMMAND="helmfile --namespace ${NAMESPACE} --environment ${ENVIRONMENT} --file /deploy/helmfile.yaml $DEBUG_ARGS apply"
echo "Executing: ${OPERATION_COMMAND}"
${OPERATION_COMMAND}
Expand Down Expand Up @@ -55,7 +60,5 @@ elif [[ "${OPERATION}" == "destroy" ]]; then
if [[ "${RELEASES_COUNTS}" == "0" ]]; then
kubectl delete ns ${NAMESPACE}
fi
fi
fi
fi


3 changes: 3 additions & 0 deletions root/deploy/helmfile.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,6 @@ helmfiles:
- path: {{ requiredEnv "APPLICATION_HELMFILE" }}
values:
- /tmp/platform.yaml
{{- if env "HELM_VALUES_FILE" }}
- {{ env "HELM_VALUES_FILE" }}
{{- end }}

0 comments on commit 97b1a23

Please sign in to comment.