From 3f645e92493177e4a5ba255a9f3c910c13beb070 Mon Sep 17 00:00:00 2001 From: Farley Date: Wed, 19 Jul 2023 18:47:19 -0700 Subject: [PATCH] Adding prefix suffix --- README.md | 18 ++++++++++-------- action.yml | 12 ++++++++++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 5198636..d6171b8 100644 --- a/README.md +++ b/README.md @@ -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-.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-.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 diff --git a/action.yml b/action.yml index 1141beb..f68566d 100644 --- a/action.yml +++ b/action.yml @@ -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 @@ -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 @@ -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