diff --git a/helm-deploy/README.md b/helm-deploy/README.md index 75c4cfa..30b016b 100644 --- a/helm-deploy/README.md +++ b/helm-deploy/README.md @@ -7,7 +7,7 @@ Deploy a service to Kubernetes via Helm over SSH. | Input | Required | Default | Description | |-------|----------|---------|-------------| | `service-name` | Yes | — | Helm release name | -| `helm-host` | Yes | — | SSH target host (e.g. `dsp1-stage.schmalzgroup.net`) | +| `helm-cluster` | Yes | — | Cluster to deploye to (one of `internal_stage` or `internal_prod`) | | `image-tag` | Yes | — | Docker image tag to deploy | | `ssh-key` | Yes | — | Private SSH key content | | `overrides-file` | No | `kubernetes/overrides-pu.yaml` | Local path to Helm values override file | diff --git a/helm-deploy/action.yml b/helm-deploy/action.yml index be3cfc5..cf75ad7 100644 --- a/helm-deploy/action.yml +++ b/helm-deploy/action.yml @@ -5,8 +5,8 @@ inputs: service-name: description: Helm release name required: true - helm-host: - description: SSH target (e.g., dsp1-stage.schmalzgroup.net) + helm-cluster: + description: Name of the target Kubernetes cluster to deploy to required: true overrides-file: description: Local path to Helm values override file @@ -45,10 +45,22 @@ runs: chmod 600 "$SSH_KEY_FILE" echo "SSH_KEY_FILE=$SSH_KEY_FILE" >> "$GITHUB_ENV" + - name: Map cluster name to target host + id: map-host + shell: bash + env: + HELM_CLUSTER: ${{ inputs.helm-cluster }} + run: | + case "$HELM_CLUSTER" in + internal_stage) echo "host=dsp1-stage.schmalzgroup.net" ;; + internal_prod) echo "host=dsp1.schmalzgroup.net" ;; + *) echo "Invalid cluster '$HELM_CLUSTER'. Must be 'internal_stage' or 'internal_prod'." && exit 1 ;; + esac >> "$GITHUB_OUTPUT" + - name: Copy overrides file shell: bash env: - HELM_HOST: ${{ inputs.helm-host }} + HELM_HOST: ${{ steps.map-host.outputs.host }} SERVICE_NAME: ${{ inputs.service-name }} OVERRIDES_FILE: ${{ inputs.overrides-file }} run: | @@ -63,7 +75,7 @@ runs: - name: Helm deploy shell: bash env: - HELM_HOST: ${{ inputs.helm-host }} + HELM_HOST: ${{ steps.map-host.outputs.host }} SERVICE_NAME: ${{ inputs.service-name }} NAMESPACE: ${{ inputs.namespace }} HELM_REPO: ${{ inputs.helm-repo }}