Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(action): add create new action for compatibility testing #71

Merged
merged 5 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this also include

if: ${{ inputs.helm-extra-repos != '' }}

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch. I have added it

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