Skip to content

Commit

Permalink
feat(action): add create new action for compatibility testing (#71)
Browse files Browse the repository at this point in the history
* Add extra helm repo's to cluster prepare
  • Loading branch information
DexterYan authored Aug 5, 2024
1 parent e5e97ed commit 7118df9
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
3 changes: 3 additions & 0 deletions prepare-cluster/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ helm_run_preflights["helm-run-preflights"]
kots_config_values["kots-config-values"]
kots_wait_duration["kots-wait-duration"]
customer_entitlements["customer-entitlements"]
helm_extra_repos["helm-extra-repos"]
cluster_id["cluster-id"]
cluster_kubeconfig["cluster-kubeconfig"]
app_slug ---> prepare_cluster
Expand Down Expand Up @@ -62,6 +63,7 @@ helm_run_preflights ---> prepare_cluster
kots_config_values ---> prepare_cluster
kots_wait_duration ---> prepare_cluster
customer_entitlements ---> prepare_cluster
helm_extra_repos ---> prepare_cluster
prepare_cluster ---> cluster_id
prepare_cluster ---> cluster_kubeconfig
```
Expand Down Expand Up @@ -95,6 +97,7 @@ prepare_cluster ---> cluster_kubeconfig
| kots-config-values | | False | The KOTS config values to use |
| kots-wait-duration | | False | Timeout for KOTS to be used while waiting for individual components to be ready. must be in Go duration format (eg: 10s, 2m) (default "2m") |
| customer-entitlements | | False | Entitlements to assign to the customer.<br>Example:<br><pre>customer-entitlements: \|<br> - name: "number-of-users"<br> value: "10"</pre><br> |
| helm-extra-repos | | True | Extra helm repos to add.<br>Example:<br><pre>helm-extra-repos: \|<br> - repo_name: "cnpg"<br> url: "https://cloudnative-pg.github.io/charts"<br> namespace: "cnpg-system"<br> chart_name: "cloudnative-pg"<br> - repo_name: "minio-operator"<br> url: "https://operator.min.io"<br> namespace: "minio-operator"<br> chart_name: "operator"</pre><br> |

## Outputs
| Name | Description |
Expand Down
35 changes: 35 additions & 0 deletions prepare-cluster/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,19 @@ inputs:
- name: "number-of-users"
value: "10"</pre>
required: false
helm-extra-repos:
description: |
Extra helm repos to add.
Example:
<pre>helm-extra-repos: \|
- repo_name: "cnpg"
url: "https://cloudnative-pg.github.io/charts"
namespace: "cnpg-system"
chart_name: "cloudnative-pg"
- repo_name: "minio-operator"
url: "https://operator.min.io"
namespace: "minio-operator"
chart_name: "operator"</pre>
outputs:
cluster-id: # id of the cluster
description: 'Contains the cluster id.'
Expand Down Expand Up @@ -156,6 +169,28 @@ runs:
INPUT_IP-FAMILY: ${{ inputs.ip-family || '' }}
INPUT_KUBECONFIG-PATH: ${{ inputs.kubeconfig-path || '' }}
INPUT_EXPORT-KUBECONFIG: ${{ inputs.export-kubeconfig || false }}
- uses: azure/k8s-set-context@v4
if: ${{ inputs.helm-extra-repos != '' }}
with:
method: kubeconfig
kubeconfig: ${{ steps.create-cluster.outputs.cluster-kubeconfig }}
- name: helm add extra helm-repos
if: ${{ inputs.helm-extra-repos != '' }}
shell: bash
run: |
repos='${{ inputs.helm-extra-repos }}'
echo "$repos" | yq -o=json | jq -c '.[]' | while read repo; do
name=$(echo $repo | jq -r '.repo_name')
url=$(echo $repo | jq -r '.url')
namespace=$(echo $repo | jq -r '.namespace')
chart=$(echo $repo | jq -r '.chart_name')
echo "Adding repository $name with URL $url"
helm repo add $name $url
helm upgrade --install $name \
--namespace $namespace \
--create-namespace \
$name/$chart
done
- name: Deploy the app with Helm
if: ${{ inputs.chart != '' }}
shell: bash
Expand Down

0 comments on commit 7118df9

Please sign in to comment.