File tree 4 files changed +31
-2
lines changed
4 files changed +31
-2
lines changed Original file line number Diff line number Diff line change 48
48
K3S : ${{ steps.install.outputs.k3s-version }}
49
49
K8S : ${{ steps.install.outputs.k8s-version }}
50
50
51
+ test-skip-creation :
52
+ name : Skip creation
53
+ runs-on : ubuntu-22.04
54
+ steps :
55
+ - uses : actions/checkout@v3
56
+ - uses : ./ # normally: nolar/setup-k3d-k3s@v1
57
+ with :
58
+ github-token : ${{ secrets.GITHUB_TOKEN }}
59
+ skip-creation : true
60
+
51
61
test-skip-readiness :
52
62
name : Skip readiness
53
63
runs-on : ubuntu-22.04
Original file line number Diff line number Diff line change @@ -105,6 +105,16 @@ with:
105
105
` ` `
106
106
107
107
108
+ # ## `skip-creation`
109
+
110
+ Whether to return from the action as soon as possible
111
+ without the cluster creation (the cluster readiness is also skipped).
112
+ This can be useful to only install the tools for manual cluster creation,
113
+ or to parse the available versions and return them as the action's outputs.
114
+
115
+ By default (`false`), the cluster is created.
116
+
117
+
108
118
# ## `skip-readiness`
109
119
110
120
Whether to return from the action as soon as possible,
Original file line number Diff line number Diff line change @@ -77,11 +77,15 @@ echo "k3s-version=${K3S}" >> $GITHUB_OUTPUT
77
77
echo " k8s-version=${K8S} " >> $GITHUB_OUTPUT
78
78
79
79
# Start a cluster. It takes 20 seconds usually.
80
- k3d cluster create ${K3D_NAME:- } --wait --image=rancher/k3s:" ${K3S// +/ -} " ${K3D_ARGS:- }
80
+ if [[ -z " ${SKIP_CREATION} " ]]; then
81
+ k3d cluster create ${K3D_NAME:- } --wait --image=rancher/k3s:" ${K3S// +/ -} " ${K3D_ARGS:- }
82
+ else
83
+ echo " Skipping the cluster creation. The cluster can be not fully ready yet."
84
+ fi
81
85
82
86
# Sometimes, the service account is not created immediately. Nice trick, but no:
83
87
# we need to wait until the cluster is fully ready before starting the tests.
84
- if [[ -z " ${SKIP_READINESS} " ]]; then
88
+ if [[ -z " ${SKIP_CREATION} " && -z " ${ SKIP_READINESS}" ]]; then
85
89
echo " ::group::Waiting for cluster readiness"
86
90
while ! kubectl get serviceaccount default > /dev/null; do sleep 1; done
87
91
echo " ::endgroup::"
Original file line number Diff line number Diff line change @@ -22,6 +22,9 @@ inputs:
22
22
github-token :
23
23
description : Optional GitHub token to overcome API rate limiting.
24
24
required : false
25
+ skip-creation :
26
+ description : Skip creating the cluster and waiting for its readiness?
27
+ required : false
25
28
skip-readiness :
26
29
description : Skip waiting for full cluster readiness?
27
30
required : false
47
50
K3D_NAME : ${{ inputs.k3d-name }}
48
51
K3D_ARGS : ${{ inputs.k3d-args }}
49
52
GITHUB_TOKEN : ${{ inputs.github-token }}
53
+ SKIP_CREATION : ${{ inputs.skip-creation && 'yes' || '' }}
50
54
SKIP_READINESS : ${{ inputs.skip-readiness && 'yes' || '' }}
51
55
52
56
# Validate that everything is installed, is on PATH, and generally works.
53
57
- shell : bash
54
58
run : kubectl version
59
+ if : ${{ !inputs.skip-creation }}
You can’t perform that action at this time.
0 commit comments