diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 72f7f27..61aa3dc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -180,6 +180,7 @@ jobs: uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - name: Create kind cluster with registry + id: kind uses: ./ with: registry: true @@ -187,6 +188,8 @@ jobs: registry_port: 5001 - name: Test + env: + LOCAL_REGISTRY: ${{ steps.kind.outputs.LOCAL_REGISTRY }} run: | kubectl cluster-info kubectl get storageclass standard @@ -210,6 +213,7 @@ jobs: uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 - name: Create kind cluster with registry and delete enabled + id: kind uses: ./ with: registry: true @@ -218,6 +222,8 @@ jobs: registry_enable_delete: true - name: Test + env: + LOCAL_REGISTRY: ${{ steps.kind.outputs.LOCAL_REGISTRY }} run: | kubectl cluster-info kubectl get storageclass standard diff --git a/README.md b/README.md index 0cdf905..fbde04b 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,27 @@ For more information on inputs, see the [API Documentation](https://developer.gi - `install_only`: Skips cluster creation, only install kind (default: false) - `ignore_failed_clean`: Whether to ignore the post delete cluster action failing (default: false) -## Configuring Local Registry +### Example Workflow + +Create a workflow (eg: `.github/workflows/create-cluster.yml`): + +```yaml +name: Create Cluster + +on: pull_request + +jobs: + create-cluster: + runs-on: ubuntu-latest + steps: + - name: Create k8s Kind Cluster + uses: helm/kind-action@v1 +``` + +This uses [@helm/kind-action](https://github.com/helm/kind-action) GitHub Action to spin up a [kind](https://kind.sigs.k8s.io/) Kubernetes cluster on every Pull Request. +See [@helm/chart-testing-action](https://github.com/helm/chart-testing-action) for a more practical example. + +### Configuring Local Registry Create a workflow (eg: `.github/workflows/create-cluster-with-registry.yml`): @@ -45,6 +65,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Kubernetes KinD Cluster + id: kind uses: helm/kind-action@v1 with: registry: true @@ -53,7 +74,7 @@ jobs: registry_enable_delete: true ``` -This will configure the cluster with an insecure local registry at `my-registry:5001` on both the host and within cluster. Subsequent steps can refer to the registry address with the environment variable `LOCAL_REGISTRY` (i.e. `my-registry:5001`). +This will configure the cluster with an insecure local registry at `my-registry:5001` on both the host and within cluster. Subsequent steps can refer to the registry address with the output of the kind setup step (i.e. `${{ steps.kind.outputs.LOCAL_REGISTRY }}`). **Note**: If `config` option is used, you must manually configure the cluster with registry config dir enabled at `/etc/containerd/certs.d`. For example: @@ -66,26 +87,6 @@ containerdConfigPatches: config_path = "/etc/containerd/certs.d" ``` -### Example Workflow - -Create a workflow (eg: `.github/workflows/create-cluster.yml`): - -```yaml -name: Create Cluster - -on: pull_request - -jobs: - create-cluster: - runs-on: ubuntu-latest - steps: - - name: Create k8s Kind Cluster - uses: helm/kind-action@v1 -``` - -This uses [@helm/kind-action](https://github.com/helm/kind-action) GitHub Action to spin up a [kind](https://kind.sigs.k8s.io/) Kubernetes cluster on every Pull Request. -See [@helm/chart-testing-action](https://github.com/helm/chart-testing-action) for a more practical example. - ## Code of conduct Participation in the Helm community is governed by the [Code of Conduct](CODE_OF_CONDUCT.md). diff --git a/registry.sh b/registry.sh index 6dce12f..1938608 100755 --- a/registry.sh +++ b/registry.sh @@ -129,8 +129,8 @@ create_registry() { # Local registry is available at $registry_name:$registry_port echo "127.0.0.1 $registry_name" | sudo tee -a /etc/hosts - # Export environment variable for subsequent steps - echo "LOCAL_REGISTRY=$registry_name:$registry_port" >> "$GITHUB_ENV" + # Write registry address to output for subsequent steps + echo "LOCAL_REGISTRY=$registry_name:$registry_port" >> "$GITHUB_OUTPUT" } connect_registry() {