Skip to content

Commit

Permalink
Adding prefix suffix
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFarley committed Jul 20, 2023
1 parent 6b296ad commit 3f645e9
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 10 deletions.
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,16 @@ To use this action, your GitHub Actions runner needs to have the following insta

## Inputs

| **Input** | **Required** | **Default** | **Description** |
|-----------------------|--------------|-------------|--------------------------------------------------------------------------------------------------------|
| image-tag | yes | N/A | Image tag to use in each deployment. |
| k8s-namespace | yes | N/A | Deployment namespace in kubernetes. |
| environment-slug | no | N/A | Short name of the deployment environment (dev, prod, etc). Set this if you have a `values-<env>.yaml`. |
| helm-extra-args | no | N/A | Add additional/custom helm arguments/commands. |
| dry-run | no | false | Skip actual deployment and only show a diff. |
| timeout | no | 300s | Timeout time for helm operations. |
| **Input** | **Required** | **Default** | **Description** |
|------------------------|--------------|-------------|--------------------------------------------------------------------------------------------------------|
| image-tag | yes | N/A | Image tag to use in each deployment. |
| k8s-namespace | yes | N/A | Deployment namespace in kubernetes. |
| environment-slug | no | N/A | Short name of the deployment environment (dev, prod, etc). Set this if you have a `values-<env>.yaml`. |
| helm-extra-args | no | N/A | Add additional/custom helm arguments/commands. |
| helm-chart-name-prefix | no | N/A | Add string to prefix helm chart name (eg: dev-) |
| helm-chart-name-suffix | no | N/A | Add string to suffix helm chart name (eg: -dev) |
| dry-run | no | false | Skip actual deployment and only show a diff. |
| timeout | no | 300s | Timeout time for helm operations. |

## Example Usage

Expand Down
12 changes: 10 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ inputs:
helm-extra-args:
description: "Add additional/custom helm arguments/commands."
required: false
helm-chart-name-prefix:
description: "Add string to prefix helm chart name (eg: dev-)"
required: false
helm-chart-name-suffix:
description: "Add string to suffix helm chart name (eg: -dev)"
required: false
dry-run:
description: "Skip the actual deployment and just show a diff."
required: false
Expand All @@ -39,6 +45,8 @@ runs:
HELM_DRY_RUN=${{ inputs.dry-run }}
HELM_EXTRA_ARGS=${{ inputs.helm-extra-args }}
HELM_TIMEOUT=${{ inputs.timeout }}
HELM_CHART_NAME_PREFIX=${{ inputs.helm-chart-name-prefix }}
HELM_CHART_NAME_SUFFIX=${{ inputs.helm-chart-name-suffix }}
cd deployment
Expand All @@ -59,13 +67,13 @@ runs:
VALUES_FILE_ARGS="-f $CURRENT_HELM_CHART/values.yaml${VALUES_ENV_FILE:+ -f $VALUES_ENV_FILE}"
echo "--- HELM DIFF ---"
helm diff upgrade --allow-unreleased --namespace $HELM_K8S_NAMESPACE $HELM_UPDIFF_EXTRA_ARGS $CURRENT_HELM_CHART ./$CURRENT_HELM_CHART \
helm diff upgrade --allow-unreleased --namespace $HELM_K8S_NAMESPACE $HELM_UPDIFF_EXTRA_ARGS $HELM_CHART_NAME_PREFIX$CURRENT_HELM_CHART$HELM_CHART_NAME_SUFFIX ./$CURRENT_HELM_CHART \
$VALUES_FILE_ARGS \
$HELM_EXTRA_ARGS
if [ "$HELM_DRY_RUN" = "false" ]; then
echo "--- HELM UPGRADE ---"
helm upgrade --install --atomic --timeout $HELM_TIMEOUT --namespace $HELM_K8S_NAMESPACE $CURRENT_HELM_CHART ./$CURRENT_HELM_CHART \
helm upgrade --install --atomic --timeout $HELM_TIMEOUT --namespace $HELM_K8S_NAMESPACE $HELM_CHART_NAME_PREFIX$CURRENT_HELM_CHART$HELM_CHART_NAME_SUFFIX ./$CURRENT_HELM_CHART \
$VALUES_FILE_ARGS \
$HELM_EXTRA_ARGS;
fi
Expand Down

0 comments on commit 3f645e9

Please sign in to comment.