-
Notifications
You must be signed in to change notification settings - Fork 0
267 lines (206 loc) · 10.7 KB
/
test-mock.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
name: "Test Functionality of the Mock cli"
on:
pull_request:
paths:
- '.github/workflows/test-mock.yml'
- 'cli/**'
- 'logger/**'
- 'scripts/**'
- 'go.mod'
- 'go.sum'
types: [ labeled, opened, synchronize, reopened ]
branches: [ main ]
push:
paths:
- 'scripts/**'
- 'logger/**'
- 'cli/**'
- '.github/workflows/test-mock.yml'
- 'go.mod'
- 'go.sum'
branches: [ main ]
jobs:
ksctl-cli-mongodb-driver:
runs-on: ubuntu-latest
if: |
(
github.event.label.name == 'pr/lgtm' ||
contains(github.event.pull_request.labels.*.name, 'pr/lgtm')
) || (
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
)
env:
MONGODB_URI: "mongodb://root:[email protected]:27017"
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.3
- name: build ksctl linux
run: |
set -x
make install_linux
echo "KSCTL_BIN=ksctl" >> "${GITHUB_ENV}"
- name: local version
run: |
${{ env.KSCTL_BIN }} version
- name: local create
run: |
docker run -d \
--name mongodb \
-p 27017:27017 \
-e MONGO_INITDB_ROOT_USERNAME=root \
-e MONGO_INITDB_ROOT_PASSWORD=1234 \
mongo
${{env.KSCTL_BIN}} create local -n demolocal-extmongo -s external-store-mongodb --verbose -1 --yes
${{env.KSCTL_BIN}} info -p local -n demolocal-extmongo -s external-store-mongodb --verbose -1
- name: local get
run: |
${{env.KSCTL_BIN}} get -s external-store-mongodb
- name: local switch
run: |
${{env.KSCTL_BIN}} switch -p local -v -1 -n demolocal-extmongo -s external-store-mongodb
- name: local delete
run: |
${{env.KSCTL_BIN}} delete local -n demolocal-extmongo -v -1 -s external-store-mongodb --yes
ksctl-cli:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
if: |
(
github.event.label.name == 'pr/lgtm' ||
contains(github.event.pull_request.labels.*.name, 'pr/lgtm')
) || (
github.event_name == 'push' &&
github.ref == 'refs/heads/main'
)
runs-on: ${{ matrix.os }}
env:
KSCTL_FAKE_FLAG_ENABLED: "1"
steps:
- name: Checkout
uses: actions/[email protected]
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: 1.22.3
- name: build ksctl windows
if: ${{ matrix.os == 'windows-latest' }}
run: |
Set-PSDebug -Trace 2
cd .\scripts
.\builder-mock.ps1
echo "KSCTL_BIN=$env:LOCALAPPDATA\ksctl\ksctl.exe" >> $env:GITHUB_ENV
- name: build ksctl linux
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
set -x
make install_linux_mock
echo "KSCTL_BIN=ksctl" >> "${GITHUB_ENV}"
- name: build ksctl macos
if: ${{ matrix.os == 'macos-latest' }}
run: |
set -x
make install_macos_intel_mock
echo "KSCTL_BIN=ksctl" >> "${GITHUB_ENV}"
- name: version
run: |
${{ env.KSCTL_BIN }} version
- name: civo create
run: |
${{ env.KSCTL_BIN }} create civo -n demo -r LON1 --nodeSizeMP "g4s.kube.small" --version 1.27.1 --verbose -1 -s store-local --yes
${{ env.KSCTL_BIN }} info -p civo -n demo -r LON1 --verbose -1 -s store-local
${{env.KSCTL_BIN}} create ha-civo -n ha-demo-k3s --nodeSizeDS "fake.small" --version 1.27.1 --nodeSizeLB "fake.small" --nodeSizeCP "fake.small" --nodeSizeWP "fake.small" -s store-local -r LON1 --verbose -1 --yes --bootstrap k3s
${{env.KSCTL_BIN}} info -p ha-civo -n ha-demo-k3s -s store-local -r LON1 --verbose -1
${{env.KSCTL_BIN}} create ha-civo -n ha-demo-kubeadm --nodeSizeDS "fake.small" --version 1.28 --nodeSizeLB "fake.small" --nodeSizeCP "fake.small" --nodeSizeWP "fake.small" -s store-local -r LON1 --verbose -1 --yes --bootstrap kubeadm
${{env.KSCTL_BIN}} info -p ha-civo -n ha-demo-kubeadm -s store-local -r LON1 --verbose -1
- name: azure create
run: |
${{env.KSCTL_BIN}} create azure -n demo -r fake --nodeSizeMP "fake" -s store-local --version 1.27.1 --verbose -1 --yes
${{env.KSCTL_BIN}} info -p azure -n demo -r fake -s store-local --verbose -1
${{env.KSCTL_BIN}} create ha-azure -n ha-demo-k3s --nodeSizeDS "fake" --version 1.27.1 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake --verbose -1 -s store-local --yes --bootstrap k3s
${{env.KSCTL_BIN}} info -p ha-azure -n ha-demo-k3s -r fake -s store-local --verbose -1
${{env.KSCTL_BIN}} create ha-azure -n ha-demo-kubeadm --nodeSizeDS "fake" --version 1.28 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake --verbose -1 -s store-local --yes --bootstrap kubeadm
${{env.KSCTL_BIN}} info -p ha-azure -n ha-demo-kubeadm -r fake -s store-local --verbose -1
- name: aws create
run: |
${{env.KSCTL_BIN}} create aws -n demo -r fake-region --nodeSizeMP "fake" --version 1.30 -s store-local --verbose -1 --yes
${{env.KSCTL_BIN}} info -p aws -n demo -r fake-region -s store-local --verbose -1
${{env.KSCTL_BIN}} create ha-aws -n ha-demo-k3s --nodeSizeDS "fake" --version 1.27.1 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake-region --verbose -1 -s store-local --yes --bootstrap k3s
${{env.KSCTL_BIN}} info -p ha-aws -n ha-demo-k3s -r fake-region -s store-local --verbose -1
${{env.KSCTL_BIN}} create ha-aws -n ha-demo-kubeadm --nodeSizeDS "fake" --version 1.28 --nodeSizeLB "fake" --nodeSizeCP "fake" --nodeSizeWP "fake" -r fake-region --verbose -1 -s store-local --yes --bootstrap kubeadm
${{env.KSCTL_BIN}} info -p ha-aws -n ha-demo-kubeadm -r fake-region -s store-local --verbose -1
- name: local create
run: |
${{env.KSCTL_BIN}} create local -n demolocal --version 1.27.1 --verbose -1 -s store-local --yes
${{env.KSCTL_BIN}} info -p local -n demolocal -s store-local --verbose -1
- name: civo get
run: |
${{env.KSCTL_BIN}} get -s store-local -p civo
- name: azure get
run: |
${{env.KSCTL_BIN}} get -s store-local -p azure
- name: aws get
run: |
${{env.KSCTL_BIN}} get -s store-local -p aws
- name: get all
run: |
${{env.KSCTL_BIN}} get -s store-local
- name: civo switch
run: |
${{env.KSCTL_BIN}} switch -p civo -n demo -s store-local -r LON1
${{env.KSCTL_BIN}} switch -p ha-civo -n ha-demo-k3s -s store-local -r LON1
${{env.KSCTL_BIN}} switch -p ha-civo -n ha-demo-kubeadm -s store-local -r LON1
- name: aws switch
run: |
${{env.KSCTL_BIN}} switch -p aws -n demo -s store-local -r fake-region
${{env.KSCTL_BIN}} switch -p ha-aws -n ha-demo-k3s -s store-local -r fake-region
${{env.KSCTL_BIN}} switch -p ha-aws -n ha-demo-kubeadm -s store-local -r fake-region
- name: azure switch
run: |
${{env.KSCTL_BIN}} switch -p azure -n demo -s store-local -r fake
${{env.KSCTL_BIN}} switch -p ha-azure -n ha-demo-k3s -s store-local -r fake
${{env.KSCTL_BIN}} switch -p ha-azure -n ha-demo-kubeadm -s store-local -r fake
- name: local switch
run: |
${{env.KSCTL_BIN}} switch -p local -n demolocal -s store-local
- name: civo scale up and down
run: |
${{env.KSCTL_BIN}} delete ha-civo del-nodes -n ha-demo-k3s --noWP 0 -r LON1 -s store-local --yes -v -1 --bootstrap k3s
${{env.KSCTL_BIN}} create ha-civo add-nodes -n ha-demo-k3s --noWP 1 --version 1.27.1 --nodeSizeWP "fake.small" -s store-local -r LON1 -v -1 --yes --bootstrap k3s
${{env.KSCTL_BIN}} delete ha-civo del-nodes -n ha-demo-kubeadm --noWP 0 -r LON1 -s store-local --yes -v -1 --bootstrap kubeadm
${{env.KSCTL_BIN}} create ha-civo add-nodes -n ha-demo-kubeadm --noWP 1 --version 1.28 --nodeSizeWP "fake.small" -s store-local -r LON1 -v -1 --yes --bootstrap kubeadm
- name: azure scale up and down
run: |
${{env.KSCTL_BIN}} delete ha-azure del-nodes -n ha-demo-k3s --noWP 0 -r fake -s store-local --yes -v -1 --bootstrap k3s
${{env.KSCTL_BIN}} create ha-azure add-nodes -n ha-demo-k3s --noWP 1 --version 1.27.1 --nodeSizeWP "fake" -s store-local -r fake -v -1 --yes --bootstrap k3s
${{env.KSCTL_BIN}} delete ha-azure del-nodes -n ha-demo-kubeadm --noWP 0 -r fake -s store-local --yes -v -1 --bootstrap kubeadm
${{env.KSCTL_BIN}} create ha-azure add-nodes -n ha-demo-kubeadm --noWP 1 --version 1.28 --nodeSizeWP "fake" -s store-local -r fake -v -1 --yes --bootstrap kubeadm
- name: aws scale up and down
run: |
${{env.KSCTL_BIN}} delete ha-aws del-nodes -n ha-demo-k3s --noWP 0 -r fake-region -s store-local --yes -v -1 --bootstrap k3s
${{env.KSCTL_BIN}} create ha-aws add-nodes -n ha-demo-k3s --noWP 1 --version 1.27.1 --nodeSizeWP "fake" -s store-local -r fake-region -v -1 --yes --bootstrap k3s
${{env.KSCTL_BIN}} delete ha-aws del-nodes -n ha-demo-kubeadm --noWP 0 -r fake-region -s store-local --yes -v -1 --bootstrap kubeadm
${{env.KSCTL_BIN}} create ha-aws add-nodes -n ha-demo-kubeadm --noWP 1 --version 1.28 --nodeSizeWP "fake" -s store-local -r fake-region -v -1 --yes --bootstrap kubeadm
- name: civo delete
run: |
${{env.KSCTL_BIN}} delete civo -n demo -r LON1 -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-civo -n ha-demo-k3s -r LON1 -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-civo -n ha-demo-kubeadm -r LON1 -s store-local -v -1 --yes
- name: azure delete
run: |
${{env.KSCTL_BIN}} delete azure -n demo -r fake -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-azure -n ha-demo-k3s -r fake -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-azure -n ha-demo-kubeadm -r fake -s store-local -v -1 --yes
- name: aws delete
run: |
# ${{env.KSCTL_BIN}} delete aws -n demo -r fake-region -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-aws -n ha-demo-k3s -r fake-region -s store-local -v -1 --yes
${{env.KSCTL_BIN}} delete ha-aws -n ha-demo-kubeadm -r fake-region -s store-local -v -1 --yes
- name: local delete
run: |
${{env.KSCTL_BIN}} delete local -n demolocal -s store-local -v -1 --yes