Skip to content

Commit fc5148f

Browse files
committed
output registry address as output instead
Signed-off-by: Thuan Vo <thuan.votann@gmail.com>
1 parent 73dbd04 commit fc5148f

File tree

3 files changed

+32
-25
lines changed

3 files changed

+32
-25
lines changed

.github/workflows/test.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -198,13 +198,16 @@ jobs:
198198
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
199199

200200
- name: Create kind cluster with registry
201+
id: kind
201202
uses: ./
202203
with:
203204
registry: true
204205
registry_name: custom-registry
205206
registry_port: 5001
206207

207208
- name: Test
209+
env:
210+
LOCAL_REGISTRY: ${{ steps.kind.outputs.LOCAL_REGISTRY }}
208211
run: |
209212
kubectl cluster-info
210213
kubectl get storageclass standard
@@ -228,6 +231,7 @@ jobs:
228231
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
229232

230233
- name: Create kind cluster with registry and delete enabled
234+
id: kind
231235
uses: ./
232236
with:
233237
registry: true
@@ -236,6 +240,8 @@ jobs:
236240
registry_enable_delete: true
237241

238242
- name: Test
243+
env:
244+
LOCAL_REGISTRY: ${{ steps.kind.outputs.LOCAL_REGISTRY }}
239245
run: |
240246
kubectl cluster-info
241247
kubectl get storageclass standard

README.md

+24-23
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,27 @@ For more information on inputs, see the [API Documentation](https://developer.gi
3030
- `install_only`: Skips cluster creation, only install kind (default: false)
3131
- `ignore_failed_clean`: Whether to ignore the post delete cluster action failing (default: false)
3232

33-
## Configuring Local Registry
33+
### Example Workflow
34+
35+
Create a workflow (eg: `.github/workflows/create-cluster.yml`):
36+
37+
```yaml
38+
name: Create Cluster
39+
40+
on: pull_request
41+
42+
jobs:
43+
create-cluster:
44+
runs-on: ubuntu-latest
45+
steps:
46+
- name: Create k8s Kind Cluster
47+
uses: helm/kind-action@v1
48+
```
49+
50+
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.
51+
See [@helm/chart-testing-action](https://github.com/helm/chart-testing-action) for a more practical example.
52+
53+
### Configuring Local Registry
3454
3555
Create a workflow (eg: `.github/workflows/create-cluster-with-registry.yml`):
3656

@@ -45,6 +65,7 @@ jobs:
4565
runs-on: ubuntu-latest
4666
steps:
4767
- name: Kubernetes KinD Cluster
68+
id: kind
4869
uses: helm/kind-action@v1
4970
with:
5071
registry: true
@@ -53,9 +74,9 @@ jobs:
5374
registry_enable_delete: true
5475
```
5576

56-
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`).
77+
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 }}`).
5778

58-
**Note**: If `config` option is used, you must manually configure the cluster with registry config dir enabled at `/etc/containerd/certs.d`. For example:
79+
**Note**: If `config` option is used, you must manually configure the cluster nodes with registry config dir enabled at `/etc/containerd/certs.d`. For example:
5980

6081
```yaml
6182
kind: Cluster
@@ -66,26 +87,6 @@ containerdConfigPatches:
6687
config_path = "/etc/containerd/certs.d"
6788
```
6889

69-
### Example Workflow
70-
71-
Create a workflow (eg: `.github/workflows/create-cluster.yml`):
72-
73-
```yaml
74-
name: Create Cluster
75-
76-
on: pull_request
77-
78-
jobs:
79-
create-cluster:
80-
runs-on: ubuntu-latest
81-
steps:
82-
- name: Create k8s Kind Cluster
83-
uses: helm/kind-action@v1
84-
```
85-
86-
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.
87-
See [@helm/chart-testing-action](https://github.com/helm/chart-testing-action) for a more practical example.
88-
8990
## Code of conduct
9091

9192
Participation in the Helm community is governed by the [Code of Conduct](CODE_OF_CONDUCT.md).

registry.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ create_registry() {
129129
# Local registry is available at $registry_name:$registry_port
130130
echo "127.0.0.1 $registry_name" | sudo tee -a /etc/hosts
131131

132-
# Export environment variable for subsequent steps
133-
echo "LOCAL_REGISTRY=$registry_name:$registry_port" >> "$GITHUB_ENV"
132+
# Write registry address to output for subsequent steps
133+
echo "LOCAL_REGISTRY=$registry_name:$registry_port" >> "$GITHUB_OUTPUT"
134134
}
135135

136136
connect_registry() {

0 commit comments

Comments
 (0)