##// END OF EJS Templates
feat(dev-tools): allow running celery/celeryd for dev in more flexible ways...
super-admin -
Show More
@@ -1,2652 +1,2887 b''
1 #!/usr/bin/env bash
1 #!/usr/bin/env bash
2 # This script was generated by bashly 1.0.8 (https://bashly.dannyb.co)
2 # This script was generated by bashly 1.0.8 (https://bashly.dannyb.co)
3 # Modifying it manually is not recommended
3 # Modifying it manually is not recommended
4
4
5 # :wrapper.bash3_bouncer
5 # :wrapper.bash3_bouncer
6 if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
6 if [[ "${BASH_VERSINFO:-0}" -lt 4 ]]; then
7 printf "bash version 4 or higher is required\n" >&2
7 printf "bash version 4 or higher is required\n" >&2
8 exit 1
8 exit 1
9 fi
9 fi
10
10
11 # :command.master_script
11 # :command.master_script
12
12
13 # :command.version_command
13 # :command.version_command
14 version_command() {
14 version_command() {
15 echo "$version"
15 echo "$version"
16 }
16 }
17
17
18 # :command.usage
18 # :command.usage
19 dev_tools_usage() {
19 dev_tools_usage() {
20 if [[ -n $long_usage ]]; then
20 if [[ -n $long_usage ]]; then
21 printf "dev-tools - CLI for various dev-tools operation on the stack\n"
21 printf "dev-tools - CLI for various dev-tools operation on the stack\n"
22 echo
22 echo
23
23
24 else
24 else
25 printf "dev-tools - CLI for various dev-tools operation on the stack\n"
25 printf "dev-tools - CLI for various dev-tools operation on the stack\n"
26 echo
26 echo
27
27
28 fi
28 fi
29
29
30 printf "%s\n" "Usage:"
30 printf "%s\n" "Usage:"
31 printf " dev-tools COMMAND\n"
31 printf " dev-tools COMMAND\n"
32 printf " dev-tools [COMMAND] --help | -h\n"
32 printf " dev-tools [COMMAND] --help | -h\n"
33 printf " dev-tools --version | -v\n"
33 printf " dev-tools --version | -v\n"
34 echo
34 echo
35 # :command.usage_commands
35 # :command.usage_commands
36 printf "%s\n" "dev-env Commands:"
36 printf "%s\n" "dev-env Commands:"
37 printf " %s run bash console for vcsserver\n" "vcs "
37 printf " %s run bash console for vcsserver\n" "vcs "
38 printf " %s run bash console for rhodecode-ee\n" "ee "
38 printf " %s run bash console for rhodecode-ee\n" "ee "
39 printf " %s run bash console for rhodecode-ce\n" "ce "
39 printf " %s run bash console for rhodecode-ce\n" "ce "
40 printf " %s run bash console for svn web\n" "svn "
40 printf " %s run bash console for svn web\n" "svn "
41 printf " %s run bash console for rhodecode-celery\n" "celery "
41 printf " %s run bash console for rhodecode-celery\n" "celery "
42 printf " %s run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n" "celeryd "
42 printf " %s run bash console for rhodecode-sshd\n" "sshd "
43 printf " %s run bash console for rhodecode-sshd\n" "sshd "
43 printf " %s run bash console for rhodecode-tools-ce\n" "tools "
44 printf " %s run bash console for rhodecode-tools-ce\n" "tools "
44 printf " %s create dev env required to run vcsserver and rhodecode\n" "dev-env "
45 printf " %s create dev env required to run vcsserver and rhodecode\n" "dev-env "
45 echo
46 echo
46 printf "%s\n" "Cleanup Commands:"
47 printf "%s\n" "Cleanup Commands:"
47 printf " %s clears docker images\n" "prune "
48 printf " %s clears docker images\n" "prune "
48 printf " %s clears docker images and system cache, full cleanup. Be cautious !\n" "prune-all "
49 printf " %s clears docker images and system cache, full cleanup. Be cautious !\n" "prune-all "
49 echo
50 echo
50 printf "%s\n" "CLI generation Commands:"
51 printf "%s\n" "CLI generation Commands:"
51 printf " %s pull latest image of bashly\n" "cli-generate-pull "
52 printf " %s pull latest image of bashly\n" "cli-generate-pull "
52 printf " %s print out help about bashly\n" "cli-generate-help "
53 printf " %s print out help about bashly\n" "cli-generate-help "
53 printf " %s set the version for rcstack\n" "stack-cli-version "
54 printf " %s set the version for rcstack\n" "stack-cli-version "
54 printf " %s run a ./rcstack generation script\n" "cli-generate-rc "
55 printf " %s run a ./rcstack generation script\n" "cli-generate-rc "
55 printf " %s run a ./dev-tools generation script\n" "cli-generate-dev "
56 printf " %s run a ./dev-tools generation script\n" "cli-generate-dev "
56 echo
57 echo
57 printf "%s\n" "Build Commands:"
58 printf "%s\n" "Build Commands:"
58 printf " %s Fetch Artifacts to run installer based build\n" "get-build-artifacts"
59 printf " %s Fetch Artifacts to run installer based build\n" "get-build-artifacts"
59 printf " %s Build RhodeCode image from installer, ./dev-tools get-build-artifacts initially\n" "build-installer "
60 printf " %s Build RhodeCode image from installer, ./dev-tools get-build-artifacts initially\n" "build-installer "
60 printf " %s Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" "get-build-source "
61 printf " %s Fetch RhodeCode sources, store in .source dir to run a source-based builds\n" "get-build-source "
61 printf " %s Build RhodeCode image from source, requires ./dev-tools get-build-source initially\n" "build-source "
62 printf " %s Build RhodeCode image from source, requires ./dev-tools get-build-source initially\n" "build-source "
62 echo
63 echo
63
64
64 # :command.long_usage
65 # :command.long_usage
65 if [[ -n $long_usage ]]; then
66 if [[ -n $long_usage ]]; then
66 printf "%s\n" "Options:"
67 printf "%s\n" "Options:"
67
68
68 # :command.usage_fixed_flags
69 # :command.usage_fixed_flags
69 printf " %s\n" "--help, -h"
70 printf " %s\n" "--help, -h"
70 printf " Show this help\n"
71 printf " Show this help\n"
71 echo
72 echo
72 printf " %s\n" "--version, -v"
73 printf " %s\n" "--version, -v"
73 printf " Show version number\n"
74 printf " Show version number\n"
74 echo
75 echo
75
76
76 # :command.footer
77 # :command.footer
77 printf "RhodeCode Inc 2023\n\n"
78 printf "RhodeCode Inc 2024\n\n"
78 echo
79 echo
79
80
80 fi
81 fi
81 }
82 }
82
83
83 # :command.usage
84 # :command.usage
84 dev_tools_vcs_usage() {
85 dev_tools_vcs_usage() {
85 if [[ -n $long_usage ]]; then
86 if [[ -n $long_usage ]]; then
86 printf "dev-tools vcs - run bash console for vcsserver\n"
87 printf "dev-tools vcs - run bash console for vcsserver\n"
87 echo
88 echo
88
89
89 else
90 else
90 printf "dev-tools vcs - run bash console for vcsserver\n"
91 printf "dev-tools vcs - run bash console for vcsserver\n"
91 echo
92 echo
92
93
93 fi
94 fi
94
95
95 printf "Alias: v\n"
96 printf "Alias: v\n"
96 echo
97 echo
97
98
98 printf "%s\n" "Usage:"
99 printf "%s\n" "Usage:"
99 printf " dev-tools vcs\n"
100 printf " dev-tools vcs\n"
100 printf " dev-tools vcs --help | -h\n"
101 printf " dev-tools vcs --help | -h\n"
101 echo
102 echo
102
103
103 # :command.long_usage
104 # :command.long_usage
104 if [[ -n $long_usage ]]; then
105 if [[ -n $long_usage ]]; then
105 printf "%s\n" "Options:"
106 printf "%s\n" "Options:"
106
107
107 # :command.usage_fixed_flags
108 # :command.usage_fixed_flags
108 printf " %s\n" "--help, -h"
109 printf " %s\n" "--help, -h"
109 printf " Show this help\n"
110 printf " Show this help\n"
110 echo
111 echo
111
112
112 fi
113 fi
113 }
114 }
114
115
115 # :command.usage
116 # :command.usage
116 dev_tools_ee_usage() {
117 dev_tools_ee_usage() {
117 if [[ -n $long_usage ]]; then
118 if [[ -n $long_usage ]]; then
118 printf "dev-tools ee - run bash console for rhodecode-ee\n"
119 printf "dev-tools ee - run bash console for rhodecode-ee\n"
119 echo
120 echo
120
121
121 else
122 else
122 printf "dev-tools ee - run bash console for rhodecode-ee\n"
123 printf "dev-tools ee - run bash console for rhodecode-ee\n"
123 echo
124 echo
124
125
125 fi
126 fi
126
127
127 printf "Alias: e\n"
128 printf "Alias: e\n"
128 echo
129 echo
129
130
130 printf "%s\n" "Usage:"
131 printf "%s\n" "Usage:"
131 printf " dev-tools ee\n"
132 printf " dev-tools ee\n"
132 printf " dev-tools ee --help | -h\n"
133 printf " dev-tools ee --help | -h\n"
133 echo
134 echo
134
135
135 # :command.long_usage
136 # :command.long_usage
136 if [[ -n $long_usage ]]; then
137 if [[ -n $long_usage ]]; then
137 printf "%s\n" "Options:"
138 printf "%s\n" "Options:"
138
139
139 # :command.usage_fixed_flags
140 # :command.usage_fixed_flags
140 printf " %s\n" "--help, -h"
141 printf " %s\n" "--help, -h"
141 printf " Show this help\n"
142 printf " Show this help\n"
142 echo
143 echo
143
144
144 fi
145 fi
145 }
146 }
146
147
147 # :command.usage
148 # :command.usage
148 dev_tools_ce_usage() {
149 dev_tools_ce_usage() {
149 if [[ -n $long_usage ]]; then
150 if [[ -n $long_usage ]]; then
150 printf "dev-tools ce - run bash console for rhodecode-ce\n"
151 printf "dev-tools ce - run bash console for rhodecode-ce\n"
151 echo
152 echo
152
153
153 else
154 else
154 printf "dev-tools ce - run bash console for rhodecode-ce\n"
155 printf "dev-tools ce - run bash console for rhodecode-ce\n"
155 echo
156 echo
156
157
157 fi
158 fi
158
159
159 printf "Alias: c\n"
160 printf "Alias: c\n"
160 echo
161 echo
161
162
162 printf "%s\n" "Usage:"
163 printf "%s\n" "Usage:"
163 printf " dev-tools ce\n"
164 printf " dev-tools ce\n"
164 printf " dev-tools ce --help | -h\n"
165 printf " dev-tools ce --help | -h\n"
165 echo
166 echo
166
167
167 # :command.long_usage
168 # :command.long_usage
168 if [[ -n $long_usage ]]; then
169 if [[ -n $long_usage ]]; then
169 printf "%s\n" "Options:"
170 printf "%s\n" "Options:"
170
171
171 # :command.usage_fixed_flags
172 # :command.usage_fixed_flags
172 printf " %s\n" "--help, -h"
173 printf " %s\n" "--help, -h"
173 printf " Show this help\n"
174 printf " Show this help\n"
174 echo
175 echo
175
176
176 fi
177 fi
177 }
178 }
178
179
179 # :command.usage
180 # :command.usage
180 dev_tools_svn_usage() {
181 dev_tools_svn_usage() {
181 if [[ -n $long_usage ]]; then
182 if [[ -n $long_usage ]]; then
182 printf "dev-tools svn - run bash console for svn web\n"
183 printf "dev-tools svn - run bash console for svn web\n"
183 echo
184 echo
184
185
185 else
186 else
186 printf "dev-tools svn - run bash console for svn web\n"
187 printf "dev-tools svn - run bash console for svn web\n"
187 echo
188 echo
188
189
189 fi
190 fi
190
191
191 printf "Alias: s\n"
192 printf "Alias: s\n"
192 echo
193 echo
193
194
194 printf "%s\n" "Usage:"
195 printf "%s\n" "Usage:"
195 printf " dev-tools svn\n"
196 printf " dev-tools svn\n"
196 printf " dev-tools svn --help | -h\n"
197 printf " dev-tools svn --help | -h\n"
197 echo
198 echo
198
199
199 # :command.long_usage
200 # :command.long_usage
200 if [[ -n $long_usage ]]; then
201 if [[ -n $long_usage ]]; then
201 printf "%s\n" "Options:"
202 printf "%s\n" "Options:"
202
203
203 # :command.usage_fixed_flags
204 # :command.usage_fixed_flags
204 printf " %s\n" "--help, -h"
205 printf " %s\n" "--help, -h"
205 printf " Show this help\n"
206 printf " Show this help\n"
206 echo
207 echo
207
208
208 fi
209 fi
209 }
210 }
210
211
211 # :command.usage
212 # :command.usage
212 dev_tools_celery_usage() {
213 dev_tools_celery_usage() {
213 if [[ -n $long_usage ]]; then
214 if [[ -n $long_usage ]]; then
214 printf "dev-tools celery - run bash console for rhodecode-celery\n"
215 printf "dev-tools celery - run bash console for rhodecode-celery\n"
215 echo
216 echo
216
217
217 else
218 else
218 printf "dev-tools celery - run bash console for rhodecode-celery\n"
219 printf "dev-tools celery - run bash console for rhodecode-celery\n"
219 echo
220 echo
220
221
221 fi
222 fi
222
223
223 printf "%s\n" "Usage:"
224 printf "%s\n" "Usage:"
224 printf " dev-tools celery\n"
225 printf " dev-tools celery [OPTIONS]\n"
225 printf " dev-tools celery --help | -h\n"
226 printf " dev-tools celery --help | -h\n"
226 echo
227 echo
227
228
228 # :command.long_usage
229 # :command.long_usage
229 if [[ -n $long_usage ]]; then
230 if [[ -n $long_usage ]]; then
230 printf "%s\n" "Options:"
231 printf "%s\n" "Options:"
231
232
233 # :command.usage_flags
234 # :flag.usage
235 printf " %s\n" "--workdir WORKDIR"
236 printf " workdir to run the pip install -e on top of can be ce or ee only\n"
237 printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n"
238 echo
239
240 # :flag.usage
241 printf " %s\n" "--cmd CMD"
242 printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
243 printf " Default: .dev/cmd-celery.sh\n"
244 echo
245
246 # :command.usage_fixed_flags
247 printf " %s\n" "--help, -h"
248 printf " Show this help\n"
249 echo
250
251 fi
252 }
253
254 # :command.usage
255 dev_tools_celeryd_usage() {
256 if [[ -n $long_usage ]]; then
257 printf "dev-tools celeryd - run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n"
258 echo
259
260 else
261 printf "dev-tools celeryd - run celery instance on top of mounted source code, e.g ./dev-tools celeryd&\n"
262 echo
263
264 fi
265
266 printf "%s\n" "Usage:"
267 printf " dev-tools celeryd [OPTIONS]\n"
268 printf " dev-tools celeryd --help | -h\n"
269 echo
270
271 # :command.long_usage
272 if [[ -n $long_usage ]]; then
273 printf "%s\n" "Options:"
274
275 # :command.usage_flags
276 # :flag.usage
277 printf " %s\n" "--workdir WORKDIR"
278 printf " workdir to run the pip install -e on top of can be ce or ee only\n"
279 printf " Default: /home/rhodecode/rhodecode-enterprise-ce\n"
280 echo
281
282 # :flag.usage
283 printf " %s\n" "--cmd CMD"
284 printf " cmd script to run, this is on host machine, relative to $WORKSPACE_HOME\n"
285 printf " Default: .dev/cmd-celeryd.sh\n"
286 echo
287
232 # :command.usage_fixed_flags
288 # :command.usage_fixed_flags
233 printf " %s\n" "--help, -h"
289 printf " %s\n" "--help, -h"
234 printf " Show this help\n"
290 printf " Show this help\n"
235 echo
291 echo
236
292
237 fi
293 fi
238 }
294 }
239
295
240 # :command.usage
296 # :command.usage
241 dev_tools_sshd_usage() {
297 dev_tools_sshd_usage() {
242 if [[ -n $long_usage ]]; then
298 if [[ -n $long_usage ]]; then
243 printf "dev-tools sshd - run bash console for rhodecode-sshd\n"
299 printf "dev-tools sshd - run bash console for rhodecode-sshd\n"
244 echo
300 echo
245
301
246 else
302 else
247 printf "dev-tools sshd - run bash console for rhodecode-sshd\n"
303 printf "dev-tools sshd - run bash console for rhodecode-sshd\n"
248 echo
304 echo
249
305
250 fi
306 fi
251
307
252 printf "%s\n" "Usage:"
308 printf "%s\n" "Usage:"
253 printf " dev-tools sshd\n"
309 printf " dev-tools sshd\n"
254 printf " dev-tools sshd --help | -h\n"
310 printf " dev-tools sshd --help | -h\n"
255 echo
311 echo
256
312
257 # :command.long_usage
313 # :command.long_usage
258 if [[ -n $long_usage ]]; then
314 if [[ -n $long_usage ]]; then
259 printf "%s\n" "Options:"
315 printf "%s\n" "Options:"
260
316
261 # :command.usage_fixed_flags
317 # :command.usage_fixed_flags
262 printf " %s\n" "--help, -h"
318 printf " %s\n" "--help, -h"
263 printf " Show this help\n"
319 printf " Show this help\n"
264 echo
320 echo
265
321
266 fi
322 fi
267 }
323 }
268
324
269 # :command.usage
325 # :command.usage
270 dev_tools_tools_usage() {
326 dev_tools_tools_usage() {
271 if [[ -n $long_usage ]]; then
327 if [[ -n $long_usage ]]; then
272 printf "dev-tools tools - run bash console for rhodecode-tools-ce\n"
328 printf "dev-tools tools - run bash console for rhodecode-tools-ce\n"
273 echo
329 echo
274
330
275 else
331 else
276 printf "dev-tools tools - run bash console for rhodecode-tools-ce\n"
332 printf "dev-tools tools - run bash console for rhodecode-tools-ce\n"
277 echo
333 echo
278
334
279 fi
335 fi
280
336
281 printf "Alias: t\n"
337 printf "Alias: t\n"
282 echo
338 echo
283
339
284 printf "%s\n" "Usage:"
340 printf "%s\n" "Usage:"
285 printf " dev-tools tools\n"
341 printf " dev-tools tools\n"
286 printf " dev-tools tools --help | -h\n"
342 printf " dev-tools tools --help | -h\n"
287 echo
343 echo
288
344
289 # :command.long_usage
345 # :command.long_usage
290 if [[ -n $long_usage ]]; then
346 if [[ -n $long_usage ]]; then
291 printf "%s\n" "Options:"
347 printf "%s\n" "Options:"
292
348
293 # :command.usage_fixed_flags
349 # :command.usage_fixed_flags
294 printf " %s\n" "--help, -h"
350 printf " %s\n" "--help, -h"
295 printf " Show this help\n"
351 printf " Show this help\n"
296 echo
352 echo
297
353
298 fi
354 fi
299 }
355 }
300
356
301 # :command.usage
357 # :command.usage
302 dev_tools_dev_env_usage() {
358 dev_tools_dev_env_usage() {
303 if [[ -n $long_usage ]]; then
359 if [[ -n $long_usage ]]; then
304 printf "dev-tools dev-env - create dev env required to run vcsserver and rhodecode\n"
360 printf "dev-tools dev-env - create dev env required to run vcsserver and rhodecode\n"
305 echo
361 echo
306
362
307 else
363 else
308 printf "dev-tools dev-env - create dev env required to run vcsserver and rhodecode\n"
364 printf "dev-tools dev-env - create dev env required to run vcsserver and rhodecode\n"
309 echo
365 echo
310
366
311 fi
367 fi
312
368
313 printf "%s\n" "Usage:"
369 printf "%s\n" "Usage:"
314 printf " dev-tools dev-env\n"
370 printf " dev-tools dev-env\n"
315 printf " dev-tools dev-env --help | -h\n"
371 printf " dev-tools dev-env --help | -h\n"
316 echo
372 echo
317
373
318 # :command.long_usage
374 # :command.long_usage
319 if [[ -n $long_usage ]]; then
375 if [[ -n $long_usage ]]; then
320 printf "%s\n" "Options:"
376 printf "%s\n" "Options:"
321
377
322 # :command.usage_fixed_flags
378 # :command.usage_fixed_flags
323 printf " %s\n" "--help, -h"
379 printf " %s\n" "--help, -h"
324 printf " Show this help\n"
380 printf " Show this help\n"
325 echo
381 echo
326
382
327 fi
383 fi
328 }
384 }
329
385
330 # :command.usage
386 # :command.usage
331 dev_tools_prune_usage() {
387 dev_tools_prune_usage() {
332 if [[ -n $long_usage ]]; then
388 if [[ -n $long_usage ]]; then
333 printf "dev-tools prune - clears docker images\n"
389 printf "dev-tools prune - clears docker images\n"
334 echo
390 echo
335
391
336 else
392 else
337 printf "dev-tools prune - clears docker images\n"
393 printf "dev-tools prune - clears docker images\n"
338 echo
394 echo
339
395
340 fi
396 fi
341
397
342 printf "%s\n" "Usage:"
398 printf "%s\n" "Usage:"
343 printf " dev-tools prune\n"
399 printf " dev-tools prune\n"
344 printf " dev-tools prune --help | -h\n"
400 printf " dev-tools prune --help | -h\n"
345 echo
401 echo
346
402
347 # :command.long_usage
403 # :command.long_usage
348 if [[ -n $long_usage ]]; then
404 if [[ -n $long_usage ]]; then
349 printf "%s\n" "Options:"
405 printf "%s\n" "Options:"
350
406
351 # :command.usage_fixed_flags
407 # :command.usage_fixed_flags
352 printf " %s\n" "--help, -h"
408 printf " %s\n" "--help, -h"
353 printf " Show this help\n"
409 printf " Show this help\n"
354 echo
410 echo
355
411
356 fi
412 fi
357 }
413 }
358
414
359 # :command.usage
415 # :command.usage
360 dev_tools_prune_all_usage() {
416 dev_tools_prune_all_usage() {
361 if [[ -n $long_usage ]]; then
417 if [[ -n $long_usage ]]; then
362 printf "dev-tools prune-all - clears docker images and system cache, full cleanup. Be cautious !\n"
418 printf "dev-tools prune-all - clears docker images and system cache, full cleanup. Be cautious !\n"
363 echo
419 echo
364
420
365 else
421 else
366 printf "dev-tools prune-all - clears docker images and system cache, full cleanup. Be cautious !\n"
422 printf "dev-tools prune-all - clears docker images and system cache, full cleanup. Be cautious !\n"
367 echo
423 echo
368
424
369 fi
425 fi
370
426
371 printf "%s\n" "Usage:"
427 printf "%s\n" "Usage:"
372 printf " dev-tools prune-all\n"
428 printf " dev-tools prune-all\n"
373 printf " dev-tools prune-all --help | -h\n"
429 printf " dev-tools prune-all --help | -h\n"
374 echo
430 echo
375
431
376 # :command.long_usage
432 # :command.long_usage
377 if [[ -n $long_usage ]]; then
433 if [[ -n $long_usage ]]; then
378 printf "%s\n" "Options:"
434 printf "%s\n" "Options:"
379
435
380 # :command.usage_fixed_flags
436 # :command.usage_fixed_flags
381 printf " %s\n" "--help, -h"
437 printf " %s\n" "--help, -h"
382 printf " Show this help\n"
438 printf " Show this help\n"
383 echo
439 echo
384
440
385 fi
441 fi
386 }
442 }
387
443
388 # :command.usage
444 # :command.usage
389 dev_tools_cli_generate_pull_usage() {
445 dev_tools_cli_generate_pull_usage() {
390 if [[ -n $long_usage ]]; then
446 if [[ -n $long_usage ]]; then
391 printf "dev-tools cli-generate-pull - pull latest image of bashly\n"
447 printf "dev-tools cli-generate-pull - pull latest image of bashly\n"
392 echo
448 echo
393
449
394 else
450 else
395 printf "dev-tools cli-generate-pull - pull latest image of bashly\n"
451 printf "dev-tools cli-generate-pull - pull latest image of bashly\n"
396 echo
452 echo
397
453
398 fi
454 fi
399
455
400 printf "%s\n" "Usage:"
456 printf "%s\n" "Usage:"
401 printf " dev-tools cli-generate-pull\n"
457 printf " dev-tools cli-generate-pull\n"
402 printf " dev-tools cli-generate-pull --help | -h\n"
458 printf " dev-tools cli-generate-pull --help | -h\n"
403 echo
459 echo
404
460
405 # :command.long_usage
461 # :command.long_usage
406 if [[ -n $long_usage ]]; then
462 if [[ -n $long_usage ]]; then
407 printf "%s\n" "Options:"
463 printf "%s\n" "Options:"
408
464
409 # :command.usage_fixed_flags
465 # :command.usage_fixed_flags
410 printf " %s\n" "--help, -h"
466 printf " %s\n" "--help, -h"
411 printf " Show this help\n"
467 printf " Show this help\n"
412 echo
468 echo
413
469
414 fi
470 fi
415 }
471 }
416
472
417 # :command.usage
473 # :command.usage
418 dev_tools_cli_generate_help_usage() {
474 dev_tools_cli_generate_help_usage() {
419 if [[ -n $long_usage ]]; then
475 if [[ -n $long_usage ]]; then
420 printf "dev-tools cli-generate-help - print out help about bashly\n"
476 printf "dev-tools cli-generate-help - print out help about bashly\n"
421 echo
477 echo
422
478
423 else
479 else
424 printf "dev-tools cli-generate-help - print out help about bashly\n"
480 printf "dev-tools cli-generate-help - print out help about bashly\n"
425 echo
481 echo
426
482
427 fi
483 fi
428
484
429 printf "%s\n" "Usage:"
485 printf "%s\n" "Usage:"
430 printf " dev-tools cli-generate-help\n"
486 printf " dev-tools cli-generate-help\n"
431 printf " dev-tools cli-generate-help --help | -h\n"
487 printf " dev-tools cli-generate-help --help | -h\n"
432 echo
488 echo
433
489
434 # :command.long_usage
490 # :command.long_usage
435 if [[ -n $long_usage ]]; then
491 if [[ -n $long_usage ]]; then
436 printf "%s\n" "Options:"
492 printf "%s\n" "Options:"
437
493
438 # :command.usage_fixed_flags
494 # :command.usage_fixed_flags
439 printf " %s\n" "--help, -h"
495 printf " %s\n" "--help, -h"
440 printf " Show this help\n"
496 printf " Show this help\n"
441 echo
497 echo
442
498
443 fi
499 fi
444 }
500 }
445
501
446 # :command.usage
502 # :command.usage
447 dev_tools_stack_cli_version_usage() {
503 dev_tools_stack_cli_version_usage() {
448 if [[ -n $long_usage ]]; then
504 if [[ -n $long_usage ]]; then
449 printf "dev-tools stack-cli-version - set the version for rcstack\n"
505 printf "dev-tools stack-cli-version - set the version for rcstack\n"
450 echo
506 echo
451
507
452 else
508 else
453 printf "dev-tools stack-cli-version - set the version for rcstack\n"
509 printf "dev-tools stack-cli-version - set the version for rcstack\n"
454 echo
510 echo
455
511
456 fi
512 fi
457
513
458 printf "%s\n" "Usage:"
514 printf "%s\n" "Usage:"
459 printf " dev-tools stack-cli-version VERSION\n"
515 printf " dev-tools stack-cli-version VERSION\n"
460 printf " dev-tools stack-cli-version --help | -h\n"
516 printf " dev-tools stack-cli-version --help | -h\n"
461 echo
517 echo
462
518
463 # :command.long_usage
519 # :command.long_usage
464 if [[ -n $long_usage ]]; then
520 if [[ -n $long_usage ]]; then
465 printf "%s\n" "Options:"
521 printf "%s\n" "Options:"
466
522
467 # :command.usage_fixed_flags
523 # :command.usage_fixed_flags
468 printf " %s\n" "--help, -h"
524 printf " %s\n" "--help, -h"
469 printf " Show this help\n"
525 printf " Show this help\n"
470 echo
526 echo
471
527
472 # :command.usage_args
528 # :command.usage_args
473 printf "%s\n" "Arguments:"
529 printf "%s\n" "Arguments:"
474
530
475 # :argument.usage
531 # :argument.usage
476 printf " %s\n" "VERSION"
532 printf " %s\n" "VERSION"
477 printf " Version to set e.g '5.0.0'\n"
533 printf " Version to set e.g '5.0.0'\n"
478 echo
534 echo
479
535
480 fi
536 fi
481 }
537 }
482
538
483 # :command.usage
539 # :command.usage
484 dev_tools_cli_generate_rc_usage() {
540 dev_tools_cli_generate_rc_usage() {
485 if [[ -n $long_usage ]]; then
541 if [[ -n $long_usage ]]; then
486 printf "dev-tools cli-generate-rc - run a ./rcstack generation script\n"
542 printf "dev-tools cli-generate-rc - run a ./rcstack generation script\n"
487 echo
543 echo
488
544
489 else
545 else
490 printf "dev-tools cli-generate-rc - run a ./rcstack generation script\n"
546 printf "dev-tools cli-generate-rc - run a ./rcstack generation script\n"
491 echo
547 echo
492
548
493 fi
549 fi
494
550
495 printf "%s\n" "Usage:"
551 printf "%s\n" "Usage:"
496 printf " dev-tools cli-generate-rc [OPTIONS]\n"
552 printf " dev-tools cli-generate-rc [OPTIONS]\n"
497 printf " dev-tools cli-generate-rc --help | -h\n"
553 printf " dev-tools cli-generate-rc --help | -h\n"
498 echo
554 echo
499
555
500 # :command.long_usage
556 # :command.long_usage
501 if [[ -n $long_usage ]]; then
557 if [[ -n $long_usage ]]; then
502 printf "%s\n" "Options:"
558 printf "%s\n" "Options:"
503
559
504 # :command.usage_flags
560 # :command.usage_flags
505 # :flag.usage
561 # :flag.usage
506 printf " %s\n" "--one-time, -o"
562 printf " %s\n" "--one-time, -o"
507 printf " run the command a single time without watch\n"
563 printf " run the command a single time without watch\n"
508 echo
564 echo
509
565
510 # :command.usage_fixed_flags
566 # :command.usage_fixed_flags
511 printf " %s\n" "--help, -h"
567 printf " %s\n" "--help, -h"
512 printf " Show this help\n"
568 printf " Show this help\n"
513 echo
569 echo
514
570
515 fi
571 fi
516 }
572 }
517
573
518 # :command.usage
574 # :command.usage
519 dev_tools_cli_generate_dev_usage() {
575 dev_tools_cli_generate_dev_usage() {
520 if [[ -n $long_usage ]]; then
576 if [[ -n $long_usage ]]; then
521 printf "dev-tools cli-generate-dev - run a ./dev-tools generation script\n"
577 printf "dev-tools cli-generate-dev - run a ./dev-tools generation script\n"
522 echo
578 echo
523
579
524 else
580 else
525 printf "dev-tools cli-generate-dev - run a ./dev-tools generation script\n"
581 printf "dev-tools cli-generate-dev - run a ./dev-tools generation script\n"
526 echo
582 echo
527
583
528 fi
584 fi
529
585
530 printf "%s\n" "Usage:"
586 printf "%s\n" "Usage:"
531 printf " dev-tools cli-generate-dev [OPTIONS]\n"
587 printf " dev-tools cli-generate-dev [OPTIONS]\n"
532 printf " dev-tools cli-generate-dev --help | -h\n"
588 printf " dev-tools cli-generate-dev --help | -h\n"
533 echo
589 echo
534
590
535 # :command.long_usage
591 # :command.long_usage
536 if [[ -n $long_usage ]]; then
592 if [[ -n $long_usage ]]; then
537 printf "%s\n" "Options:"
593 printf "%s\n" "Options:"
538
594
539 # :command.usage_flags
595 # :command.usage_flags
540 # :flag.usage
596 # :flag.usage
541 printf " %s\n" "--one-time, -o"
597 printf " %s\n" "--one-time, -o"
542 printf " run the command a single time without watch\n"
598 printf " run the command a single time without watch\n"
543 echo
599 echo
544
600
545 # :command.usage_fixed_flags
601 # :command.usage_fixed_flags
546 printf " %s\n" "--help, -h"
602 printf " %s\n" "--help, -h"
547 printf " Show this help\n"
603 printf " Show this help\n"
548 echo
604 echo
549
605
550 fi
606 fi
551 }
607 }
552
608
553 # :command.usage
609 # :command.usage
554 dev_tools_get_build_artifacts_usage() {
610 dev_tools_get_build_artifacts_usage() {
555 if [[ -n $long_usage ]]; then
611 if [[ -n $long_usage ]]; then
556 printf "dev-tools get-build-artifacts - Fetch Artifacts to run installer based build\n"
612 printf "dev-tools get-build-artifacts - Fetch Artifacts to run installer based build\n"
557 echo
613 echo
558
614
559 else
615 else
560 printf "dev-tools get-build-artifacts - Fetch Artifacts to run installer based build\n"
616 printf "dev-tools get-build-artifacts - Fetch Artifacts to run installer based build\n"
561 echo
617 echo
562
618
563 fi
619 fi
564
620
565 printf "%s\n" "Usage:"
621 printf "%s\n" "Usage:"
566 printf " dev-tools get-build-artifacts [OPTIONS]\n"
622 printf " dev-tools get-build-artifacts [OPTIONS]\n"
567 printf " dev-tools get-build-artifacts --help | -h\n"
623 printf " dev-tools get-build-artifacts --help | -h\n"
568 echo
624 echo
569
625
570 # :command.long_usage
626 # :command.long_usage
571 if [[ -n $long_usage ]]; then
627 if [[ -n $long_usage ]]; then
572 printf "%s\n" "Options:"
628 printf "%s\n" "Options:"
573
629
574 # :command.usage_flags
630 # :command.usage_flags
575 # :flag.usage
631 # :flag.usage
576 printf " %s\n" "--auth AUTH"
632 printf " %s\n" "--auth AUTH"
577 printf " Specify custom auth for curl e.g -u admin:secret\n"
633 printf " Specify custom auth for curl e.g -u admin:secret\n"
578 printf " Default: \n"
634 printf " Default: \n"
579 echo
635 echo
580
636
581 # :flag.usage
637 # :flag.usage
582 printf " %s\n" "--installer-url INSTALLER_URL"
638 printf " %s\n" "--installer-url INSTALLER_URL"
583 printf " Installer Download URL\n"
639 printf " Installer Download URL\n"
584 printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n"
640 printf " Default: https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee\n"
585 echo
641 echo
586
642
587 # :flag.usage
643 # :flag.usage
588 printf " %s\n" "--manifest-url MANIFEST_URL"
644 printf " %s\n" "--manifest-url MANIFEST_URL"
589 printf " Manifest file url\n"
645 printf " Manifest file url\n"
590 printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n"
646 printf " Default: https://dls.rhodecode.com/linux/MANIFEST\n"
591 echo
647 echo
592
648
593 # :flag.usage
649 # :flag.usage
594 printf " %s\n" "--version-name VERSION_NAME"
650 printf " %s\n" "--version-name VERSION_NAME"
595 printf " Specify custom build ver e.g 4.27.0\n"
651 printf " Specify custom build ver e.g 4.27.0\n"
596 printf " Default: $RC_CLI_VERSION_NAME\n"
652 printf " Default: $RC_CLI_VERSION_NAME\n"
597 echo
653 echo
598
654
599 # :command.usage_fixed_flags
655 # :command.usage_fixed_flags
600 printf " %s\n" "--help, -h"
656 printf " %s\n" "--help, -h"
601 printf " Show this help\n"
657 printf " Show this help\n"
602 echo
658 echo
603
659
604 fi
660 fi
605 }
661 }
606
662
607 # :command.usage
663 # :command.usage
608 dev_tools_build_installer_usage() {
664 dev_tools_build_installer_usage() {
609 if [[ -n $long_usage ]]; then
665 if [[ -n $long_usage ]]; then
610 printf "dev-tools build-installer - Build RhodeCode image from installer, ./dev-tools get-build-artifacts initially\n"
666 printf "dev-tools build-installer - Build RhodeCode image from installer, ./dev-tools get-build-artifacts initially\n"
611 echo
667 echo
612
668
613 else
669 else
614 printf "dev-tools build-installer - Build RhodeCode image from installer, ./dev-tools get-build-artifacts initially\n"
670 printf "dev-tools build-installer - Build RhodeCode image from installer, ./dev-tools get-build-artifacts initially\n"
615 echo
671 echo
616
672
617 fi
673 fi
618
674
619 printf "%s\n" "Usage:"
675 printf "%s\n" "Usage:"
620 printf " dev-tools build-installer [OPTIONS]\n"
676 printf " dev-tools build-installer [OPTIONS]\n"
621 printf " dev-tools build-installer --help | -h\n"
677 printf " dev-tools build-installer --help | -h\n"
622 echo
678 echo
623
679
624 # :command.long_usage
680 # :command.long_usage
625 if [[ -n $long_usage ]]; then
681 if [[ -n $long_usage ]]; then
626 printf "%s\n" "Options:"
682 printf "%s\n" "Options:"
627
683
628 # :command.usage_flags
684 # :command.usage_flags
629 # :flag.usage
685 # :flag.usage
630 printf " %s\n" "--version-name VERSION_NAME"
686 printf " %s\n" "--version-name VERSION_NAME"
631 printf " Specify custom build ver e.g 4.27.0\n"
687 printf " Specify custom build ver e.g 4.27.0\n"
632 printf " Default: $RC_CLI_VERSION_NAME\n"
688 printf " Default: $RC_CLI_VERSION_NAME\n"
633 echo
689 echo
634
690
635 # :command.usage_fixed_flags
691 # :command.usage_fixed_flags
636 printf " %s\n" "--help, -h"
692 printf " %s\n" "--help, -h"
637 printf " Show this help\n"
693 printf " Show this help\n"
638 echo
694 echo
639
695
640 fi
696 fi
641 }
697 }
642
698
643 # :command.usage
699 # :command.usage
644 dev_tools_get_build_source_usage() {
700 dev_tools_get_build_source_usage() {
645 if [[ -n $long_usage ]]; then
701 if [[ -n $long_usage ]]; then
646 printf "dev-tools get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
702 printf "dev-tools get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
647 echo
703 echo
648
704
649 else
705 else
650 printf "dev-tools get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
706 printf "dev-tools get-build-source - Fetch RhodeCode sources, store in .source dir to run a source-based builds\n"
651 echo
707 echo
652
708
653 fi
709 fi
654
710
655 printf "%s\n" "Usage:"
711 printf "%s\n" "Usage:"
656 printf " dev-tools get-build-source [OPTIONS]\n"
712 printf " dev-tools get-build-source [OPTIONS]\n"
657 printf " dev-tools get-build-source --help | -h\n"
713 printf " dev-tools get-build-source --help | -h\n"
658 echo
714 echo
659
715
660 # :command.long_usage
716 # :command.long_usage
661 if [[ -n $long_usage ]]; then
717 if [[ -n $long_usage ]]; then
662 printf "%s\n" "Options:"
718 printf "%s\n" "Options:"
663
719
664 # :command.usage_flags
720 # :command.usage_flags
665 # :flag.usage
721 # :flag.usage
666 printf " %s\n" "--revision REVISION"
722 printf " %s\n" "--revision REVISION"
667 printf " revision to download\n"
723 printf " revision to download\n"
668 printf " Default: default\n"
724 printf " Default: default\n"
669 echo
725 echo
670
726
671 # :flag.usage
727 # :flag.usage
672 printf " %s\n" "--auth-token AUTH_TOKEN"
728 printf " %s\n" "--auth-token AUTH_TOKEN"
673 printf " Specify AUTH TOKEN to obtain sources\n"
729 printf " Specify AUTH TOKEN to obtain sources\n"
674 echo
730 echo
675
731
676 # :flag.usage
732 # :flag.usage
677 printf " %s\n" "--server-url SERVER_URL"
733 printf " %s\n" "--server-url SERVER_URL"
678 printf " Specify RhodeCode server location where projects should be downloaded\n"
734 printf " Specify RhodeCode server location where projects should be downloaded\n"
679 printf " Default: https://code.rhodecode.com\n"
735 printf " Default: https://code.rhodecode.com\n"
680 echo
736 echo
681
737
682 # :command.usage_fixed_flags
738 # :command.usage_fixed_flags
683 printf " %s\n" "--help, -h"
739 printf " %s\n" "--help, -h"
684 printf " Show this help\n"
740 printf " Show this help\n"
685 echo
741 echo
686
742
687 # :command.usage_examples
743 # :command.usage_examples
688 printf "%s\n" "Examples:"
744 printf "%s\n" "Examples:"
689 printf " ./dev-tools get-sources $RC_CLI_VERSION_NAME\n"
745 printf " ./dev-tools get-sources $RC_CLI_VERSION_NAME\n"
690 printf " ./dev-tools get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n"
746 printf " ./dev-tools get-sources default --auth-token xyxyxyx --server-url\n https://secret.repo/\n"
691 echo
747 echo
692
748
693 fi
749 fi
694 }
750 }
695
751
696 # :command.usage
752 # :command.usage
697 dev_tools_build_source_usage() {
753 dev_tools_build_source_usage() {
698 if [[ -n $long_usage ]]; then
754 if [[ -n $long_usage ]]; then
699 printf "dev-tools build-source - Build RhodeCode image from source, requires ./dev-tools get-build-source initially\n"
755 printf "dev-tools build-source - Build RhodeCode image from source, requires ./dev-tools get-build-source initially\n"
700 echo
756 echo
701
757
702 else
758 else
703 printf "dev-tools build-source - Build RhodeCode image from source, requires ./dev-tools get-build-source initially\n"
759 printf "dev-tools build-source - Build RhodeCode image from source, requires ./dev-tools get-build-source initially\n"
704 echo
760 echo
705
761
706 fi
762 fi
707
763
708 printf "%s\n" "Usage:"
764 printf "%s\n" "Usage:"
709 printf " dev-tools build-source [OPTIONS]\n"
765 printf " dev-tools build-source [OPTIONS]\n"
710 printf " dev-tools build-source --help | -h\n"
766 printf " dev-tools build-source --help | -h\n"
711 echo
767 echo
712
768
713 # :command.long_usage
769 # :command.long_usage
714 if [[ -n $long_usage ]]; then
770 if [[ -n $long_usage ]]; then
715 printf "%s\n" "Options:"
771 printf "%s\n" "Options:"
716
772
717 # :command.usage_flags
773 # :command.usage_flags
718 # :flag.usage
774 # :flag.usage
719 printf " %s\n" "--version-name VERSION_NAME"
775 printf " %s\n" "--version-name VERSION_NAME"
720 printf " Specify custom build ver e.g 4.27.0\n"
776 printf " Specify custom build ver e.g 4.27.0\n"
721 printf " Default: $RC_CLI_VERSION_NAME\n"
777 printf " Default: $RC_CLI_VERSION_NAME\n"
722 echo
778 echo
723
779
724 # :flag.usage
780 # :flag.usage
725 printf " %s\n" "--source-build-yaml BUILD_SOURCE_YAML"
781 printf " %s\n" "--source-build-yaml BUILD_SOURCE_YAML"
726 printf " yaml file to build source against\n"
782 printf " yaml file to build source against\n"
727 printf " Default: build_yaml/docker-compose-apps.5.yaml\n"
783 printf " Default: build_yaml/docker-compose-apps.5.yaml\n"
728 echo
784 echo
729
785
730 # :flag.usage
786 # :flag.usage
731 printf " %s\n" "--tag TAG (repeatable)"
787 printf " %s\n" "--tag TAG (repeatable)"
732 printf " tag build image\n"
788 printf " tag build image\n"
733 echo
789 echo
734
790
735 # :command.usage_fixed_flags
791 # :command.usage_fixed_flags
736 printf " %s\n" "--help, -h"
792 printf " %s\n" "--help, -h"
737 printf " Show this help\n"
793 printf " Show this help\n"
738 echo
794 echo
739
795
740 # :command.usage_examples
796 # :command.usage_examples
741 printf "%s\n" "Examples:"
797 printf "%s\n" "Examples:"
742 printf " ./dev-tools build-source --source-build-yaml\n build_yaml/docker-compose-apps.5.yaml --version-name 5.0.0.beta1 --tag beta\n"
798 printf " ./dev-tools build-source --source-build-yaml\n build_yaml/docker-compose-apps.5.yaml --version-name 5.0.0.beta1 --tag beta\n"
743 printf " ./dev-tools build-source --source-build-yaml\n build_yaml/docker-compose-apps.4.yaml --version-name 4.28.0 --tag stable\n"
799 printf " ./dev-tools build-source --source-build-yaml\n build_yaml/docker-compose-apps.4.yaml --version-name 4.28.0 --tag stable\n"
744 echo
800 echo
745
801
746 fi
802 fi
747 }
803 }
748
804
749 # :command.normalize_input
805 # :command.normalize_input
750 normalize_input() {
806 normalize_input() {
751 local arg flags
807 local arg flags
752
808
753 while [[ $# -gt 0 ]]; do
809 while [[ $# -gt 0 ]]; do
754 arg="$1"
810 arg="$1"
755 if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
811 if [[ $arg =~ ^(--[a-zA-Z0-9_\-]+)=(.+)$ ]]; then
756 input+=("${BASH_REMATCH[1]}")
812 input+=("${BASH_REMATCH[1]}")
757 input+=("${BASH_REMATCH[2]}")
813 input+=("${BASH_REMATCH[2]}")
758 elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
814 elif [[ $arg =~ ^(-[a-zA-Z0-9])=(.+)$ ]]; then
759 input+=("${BASH_REMATCH[1]}")
815 input+=("${BASH_REMATCH[1]}")
760 input+=("${BASH_REMATCH[2]}")
816 input+=("${BASH_REMATCH[2]}")
761 elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
817 elif [[ $arg =~ ^-([a-zA-Z0-9][a-zA-Z0-9]+)$ ]]; then
762 flags="${BASH_REMATCH[1]}"
818 flags="${BASH_REMATCH[1]}"
763 for ((i = 0; i < ${#flags}; i++)); do
819 for ((i = 0; i < ${#flags}; i++)); do
764 input+=("-${flags:i:1}")
820 input+=("-${flags:i:1}")
765 done
821 done
766 else
822 else
767 input+=("$arg")
823 input+=("$arg")
768 fi
824 fi
769
825
770 shift
826 shift
771 done
827 done
772 }
828 }
773 # :command.inspect_args
829 # :command.inspect_args
774 inspect_args() {
830 inspect_args() {
775 if ((${#args[@]})); then
831 if ((${#args[@]})); then
776 readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
832 readarray -t sorted_keys < <(printf '%s\n' "${!args[@]}" | sort)
777 echo args:
833 echo args:
778 for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
834 for k in "${sorted_keys[@]}"; do echo "- \${args[$k]} = ${args[$k]}"; done
779 else
835 else
780 echo args: none
836 echo args: none
781 fi
837 fi
782
838
783 if ((${#other_args[@]})); then
839 if ((${#other_args[@]})); then
784 echo
840 echo
785 echo other_args:
841 echo other_args:
786 echo "- \${other_args[*]} = ${other_args[*]}"
842 echo "- \${other_args[*]} = ${other_args[*]}"
787 for i in "${!other_args[@]}"; do
843 for i in "${!other_args[@]}"; do
788 echo "- \${other_args[$i]} = ${other_args[$i]}"
844 echo "- \${other_args[$i]} = ${other_args[$i]}"
789 done
845 done
790 fi
846 fi
791
847
792 if ((${#deps[@]})); then
848 if ((${#deps[@]})); then
793 readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
849 readarray -t sorted_keys < <(printf '%s\n' "${!deps[@]}" | sort)
794 echo
850 echo
795 echo deps:
851 echo deps:
796 for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done
852 for k in "${sorted_keys[@]}"; do echo "- \${deps[$k]} = ${deps[$k]}"; done
797 fi
853 fi
798
854
799 }
855 }
800
856
801 # :command.command_functions
857 # :command.command_functions
802 # :command.function
858 # :command.function
803 dev_tools_vcs_command() {
859 dev_tools_vcs_command() {
804 # src/vcs_command.sh
860 # src/vcs_command.sh
805 container_name=dev-vcsserver
861 container_name=dev-vcsserver
806 dev_env_file="/home/rhodecode/rhodecode-vcsserver/.dev/dev-env.sh"
862 dev_env_file="/home/rhodecode/rhodecode-vcsserver/.dev/dev-env.sh"
807 env_file=".custom/.dev.env"
863 env_file=".custom/.dev.env"
808
864
809 docker_id=$(docker ps -q --filter "name=$container_name")
865 docker_id=$(docker ps -q --filter "name=$container_name")
810
866
811 if [[ $docker_id ]]; then
867 if [[ $docker_id ]]; then
812 echo $container_name FOUND, Killing old one !
868 echo $container_name FOUND, Killing old one !
813 docker kill -s 9 $docker_id
869 docker kill -s 9 $docker_id
814 sleep 5
870 sleep 5
815 docker rm -fv $container_name
871 docker rm -fv $container_name
816 echo "done..."
872 echo "done..."
817 else
873 else
818 echo $container_name not found
874 echo $container_name not found
819 # # bootstrap dev-env.sh
875 # # bootstrap dev-env.sh
820 # if [[ ! -f $dev_env_file ]]; then
876 # if [[ ! -f $dev_env_file ]]; then
821 # echo "bootstrap of new dev-env file under $dev_env_file"
877 # echo "bootstrap of new dev-env file under $dev_env_file"
822 # fi
878 # fi
823 fi
879 fi
824
880
825 if [[ -v WORKSPACE_HOME ]];
881 if [[ -v WORKSPACE_HOME ]];
826 then
882 then
827 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
883 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
828 else
884 else
829 echo "WORKSPACE_HOME env var is not set"
885 echo "WORKSPACE_HOME env var is not set"
830 exit 1
886 exit 1
831 fi
887 fi
832
888
833 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
889 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
834
890
835 eval "
891 eval "
836 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
892 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
837 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
893 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
838 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh \
894 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh \
839 --publish 10010:10010 --rm --use-aliases \
895 --publish 10010:10010 --rm --use-aliases \
840 --workdir=\"/home/rhodecode/rhodecode-vcsserver\" \
896 --workdir=\"/home/rhodecode/rhodecode-vcsserver\" \
841 --interactive --tty \
897 --interactive --tty \
842 --name=\"$container_name\" vcsserver bash $dev_env_file"
898 --name=\"$container_name\" vcsserver bash $dev_env_file"
843
899
844 }
900 }
845
901
846 # :command.function
902 # :command.function
847 dev_tools_ee_command() {
903 dev_tools_ee_command() {
848 # src/ee_command.sh
904 # src/ee_command.sh
849 container_name=dev-enterprise-ee
905 container_name=dev-enterprise-ee
850 dev_env_file="/home/rhodecode/rhodecode-enterprise-ee/.dev/dev-env.sh"
906 dev_env_file="/home/rhodecode/rhodecode-enterprise-ee/.dev/dev-env.sh"
851 env_file=".custom/.dev.env"
907 env_file=".custom/.dev.env"
852
908
853 docker_id=$(docker ps -q --filter "name=$container_name")
909 docker_id=$(docker ps -q --filter "name=$container_name")
854
910
855 if [[ $docker_id ]]; then
911 if [[ $docker_id ]]; then
856 echo $container_name FOUND, Killing old one !
912 echo $container_name FOUND, Killing old one !
857 docker kill -s 9 $docker_id
913 docker kill -s 9 $docker_id
858 sleep 5
914 sleep 5
859 docker rm -fv $container_name
915 docker rm -fv $container_name
860 echo "done..."
916 echo "done..."
861 else
917 else
862 echo $container_name not found
918 echo $container_name not found
863 # # bootstrap dev-env.sh
919 # # bootstrap dev-env.sh
864 # if [[ ! -f $dev_env_file ]]; then
920 # if [[ ! -f $dev_env_file ]]; then
865 # echo "bootstrap of new dev-env file under $dev_env_file"
921 # echo "bootstrap of new dev-env file under $dev_env_file"
866 # fi
922 # fi
867 fi
923 fi
868
924
869 if [[ -v WORKSPACE_HOME ]];
925 if [[ -v WORKSPACE_HOME ]];
870 then
926 then
871 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
927 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
872 else
928 else
873 echo "WORKSPACE_HOME env var is not set"
929 echo "WORKSPACE_HOME env var is not set"
874 exit 1
930 exit 1
875 fi
931 fi
876
932
877 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
933 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
878
934
879 eval "
935 eval "
880 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
936 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
881 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
937 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
882 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
938 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
883 --publish 10020:10020 --rm --use-aliases \
939 --publish 10020:10020 --rm --use-aliases \
884 --workdir=\"/home/rhodecode/rhodecode-enterprise-ee\" \
940 --workdir=\"/home/rhodecode/rhodecode-enterprise-ee\" \
885 --interactive --tty \
941 --interactive --tty \
886 --name=\"$container_name\" rhodecode bash $dev_env_file"
942 --name=\"$container_name\" rhodecode bash $dev_env_file"
887 }
943 }
888
944
889 # :command.function
945 # :command.function
890 dev_tools_ce_command() {
946 dev_tools_ce_command() {
891 # src/ce_command.sh
947 # src/ce_command.sh
892 container_name=dev-enterprise-ce
948 container_name=dev-enterprise-ce
893 dev_env_file="/home/rhodecode/rhodecode-enterprise-ce/.dev/dev-env.sh"
949 dev_env_file="/home/rhodecode/rhodecode-enterprise-ce/.dev/dev-env.sh"
894 env_file=".custom/.dev.env"
950 env_file=".custom/.dev.env"
895
951
896 docker_id=$(docker ps -q --filter "name=$container_name")
952 docker_id=$(docker ps -q --filter "name=$container_name")
897
953
898 if [[ $docker_id ]]; then
954 if [[ $docker_id ]]; then
899 echo $container_name FOUND, Killing old one !
955 echo $container_name FOUND, Killing old one !
900 docker kill -s 9 $docker_id
956 docker kill -s 9 $docker_id
901 sleep 5
957 sleep 5
902 docker rm -fv $container_name
958 docker rm -fv $container_name
903 echo "done..."
959 echo "done..."
904 else
960 else
905 echo $container_name not found
961 echo $container_name not found
906 # # bootstrap dev-env.sh
962 # # bootstrap dev-env.sh
907 # if [[ ! -f $dev_env_file ]]; then
963 # if [[ ! -f $dev_env_file ]]; then
908 # echo "bootstrap of new dev-env file under $dev_env_file"
964 # echo "bootstrap of new dev-env file under $dev_env_file"
909 # fi
965 # fi
910 fi
966 fi
911
967
912 if [[ -v WORKSPACE_HOME ]];
968 if [[ -v WORKSPACE_HOME ]];
913 then
969 then
914 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
970 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
915 else
971 else
916 echo "WORKSPACE_HOME env var is not set"
972 echo "WORKSPACE_HOME env var is not set"
917 exit 1
973 exit 1
918 fi
974 fi
919
975
920 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
976 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
921
977
922 eval "
978 eval "
923 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
979 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
924 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
980 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
925 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
981 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
926 --publish 10020:10020 --rm --use-aliases \
982 --publish 10020:10020 --rm --use-aliases \
927 --workdir=\"/home/rhodecode/rhodecode-enterprise-ce\" \
983 --workdir=\"/home/rhodecode/rhodecode-enterprise-ce\" \
928 --interactive --tty \
984 --interactive --tty \
929 --name=\"$container_name\" rhodecode bash $dev_env_file"
985 --name=\"$container_name\" rhodecode bash $dev_env_file"
930
986
931 }
987 }
932
988
933 # :command.function
989 # :command.function
934 dev_tools_svn_command() {
990 dev_tools_svn_command() {
935 # src/svn_command.sh
991 # src/svn_command.sh
936 container_name=dev-svn
992 container_name=dev-svn
937
993
938 docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found
994 docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found
939 docker ps -q --filter "name=$container_name" | grep -q . && docker stop -t 120 $container_name && docker rm -fv $container_name
995 docker ps -q --filter "name=$container_name" | grep -q . && docker stop -t 120 $container_name && docker rm -fv $container_name
940
996
941 if [[ -v WORKSPACE_HOME ]];
997 if [[ -v WORKSPACE_HOME ]];
942 then
998 then
943 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
999 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
944 else
1000 else
945 echo "WORKSPACE_HOME env var is not set"
1001 echo "WORKSPACE_HOME env var is not set"
946 exit 1
1002 exit 1
947 fi
1003 fi
948
1004
949 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
1005 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
950
1006
951 eval "
1007 eval "
952 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
1008 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
953 ./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \
1009 ./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \
954 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_svn_bash \
1010 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_svn_bash \
955 --rm --use-aliases \
1011 --rm --use-aliases \
956 --workdir=\"/home/rhodecode\" \
1012 --workdir=\"/home/rhodecode\" \
957 --interactive --tty \
1013 --interactive --tty \
958 --name=\"$container_name\" svn bash"
1014 --name=\"$container_name\" svn bash"
959
1015
960 }
1016 }
961
1017
962 # :command.function
1018 # :command.function
963 dev_tools_celery_command() {
1019 dev_tools_celery_command() {
964 # src/celery_command.sh
1020 # src/celery_command.sh
1021 code_workdir=${args[--workdir]}
1022 cmd_script=${args[--cmd]}
1023
1024 exec_script=$WORKSPACE_HOME/$cmd_script
965 container_name=dev-celery
1025 container_name=dev-celery
966
1026
1027 echo "Using exec script: $exec_script"
1028
1029 if [[ ! -f $exec_script ]]; then
1030 echo "Generating new $exec_script file..."
1031 mkdir -p $(dirname $exec_script)
1032
1033 cat <<< "
1034 # Generated dev-env script for celery
1035
1036 echo \"Run celery dev using the following command:\"
1037 echo \"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\"
1038 echo \"celery --no-color --app=rhodecode.lib.celerylib.loader worker --autoscale=4,2 --max-tasks-per-child=100 --task-events --loglevel=DEBUG --ini=.dev/dev.ini\"
1039 echo \"++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\"
1040 make sh
1041 " > $exec_script
1042 chmod +x $exec_script
1043 fi
1044
1045 docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
1046
967 docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found
1047 docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found
968 docker ps -q --filter "name=$container_name" | grep -q . && docker stop $container_name && docker rm -fv $container_name
1048 docker ps -q --filter "name=$container_name" | grep -q . && docker stop $container_name && docker rm -fv $container_name
969
1049
970 eval "
1050 eval "
971 ./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \
1051 ./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \
972 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
1052 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
973 --workdir=\"/home/rhodecode/rhodecode-enterprise-ce\" \
1053 --workdir=\"$code_workdir\" \
974 --name=\"$container_name\" rhodecode bash /home/rhodecode/rhodecode-enterprise-ce/.dev/dev-env-celery.sh"
1054 --name=\"$container_name\" rhodecode bash $docker_exec_script"
1055
1056 }
1057
1058 # :command.function
1059 dev_tools_celeryd_command() {
1060 # src/celeryd_command.sh
1061 code_workdir=${args[--workdir]}
1062 cmd_script=${args[--cmd]}
1063
1064 exec_script=$WORKSPACE_HOME/$cmd_script
1065 container_name=dev-celeryd
1066
1067 echo "Using exec script: $exec_script"
1068
1069 if [[ ! -f $exec_script ]]; then
1070 echo "Generating new $exec_script file..."
1071 mkdir -p $(dirname $exec_script)
1072
1073 cat <<< "
1074 # Generated dev-env script for celery
1075
1076 echo \"Run celery dev using the following command:\"
1077 make dev-env && celery --no-color --app=rhodecode.lib.celerylib.loader worker --autoscale=4,2 --max-tasks-per-child=100 --task-events --loglevel=DEBUG --ini=.dev/dev.ini
1078 " > $exec_script
1079 chmod +x $exec_script
1080 fi
1081
1082 docker_exec_script="/var/opt/rhodecode_repo_store/$cmd_script"
1083
1084 docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found
1085 docker ps -q --filter "name=$container_name" | grep -q . && docker stop $container_name && docker rm -fv $container_name
1086
1087 eval "
1088 ./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \
1089 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sh --rm --use-aliases \
1090 --workdir=\"$code_workdir\" \
1091 --name=\"$container_name\" rhodecode $docker_exec_script"
975
1092
976 }
1093 }
977
1094
978 # :command.function
1095 # :command.function
979 dev_tools_sshd_command() {
1096 dev_tools_sshd_command() {
980 # src/sshd_command.sh
1097 # src/sshd_command.sh
981 container_name=dev-enterprise-sshd
1098 container_name=dev-enterprise-sshd
982 dev_env_file="/home/rhodecode/rhodecode-enterprise-ce/.dev/dev-env-sshd.sh"
1099 dev_env_file="/home/rhodecode/rhodecode-enterprise-ce/.dev/dev-env-sshd.sh"
983 env_file=".custom/.dev.env"
1100 env_file=".custom/.dev.env"
984
1101
985 docker_id=$(docker ps -q --filter "name=$container_name")
1102 docker_id=$(docker ps -q --filter "name=$container_name")
986
1103
987 if [[ $docker_id ]]; then
1104 if [[ $docker_id ]]; then
988 echo $container_name FOUND, Killing old one !
1105 echo $container_name FOUND, Killing old one !
989 docker kill -s 9 $docker_id
1106 docker kill -s 9 $docker_id
990 sleep 5
1107 sleep 5
991 docker rm -fv $container_name
1108 docker rm -fv $container_name
992 echo "done..."
1109 echo "done..."
993 else
1110 else
994 echo $container_name not found
1111 echo $container_name not found
995 # # bootstrap dev-env.sh
1112 # # bootstrap dev-env.sh
996 # if [[ ! -f $dev_env_file ]]; then
1113 # if [[ ! -f $dev_env_file ]]; then
997 # echo "bootstrap of new dev-env file under $dev_env_file"
1114 # echo "bootstrap of new dev-env file under $dev_env_file"
998 # fi
1115 # fi
999 fi
1116 fi
1000
1117
1001 if [[ -v WORKSPACE_HOME ]];
1118 if [[ -v WORKSPACE_HOME ]];
1002 then
1119 then
1003 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
1120 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
1004 else
1121 else
1005 echo "WORKSPACE_HOME env var is not set"
1122 echo "WORKSPACE_HOME env var is not set"
1006 exit 1
1123 exit 1
1007 fi
1124 fi
1008
1125
1009 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
1126 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
1010
1127
1011 RC_SSH_PORT=9022
1128 RC_SSH_PORT=9022
1012
1129
1013 eval "
1130 eval "
1014 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
1131 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
1015 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1132 ./rcstack stack --env-file-path $env_file rhodecode -f docker-compose-apps.dev.yaml \
1016 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sshd --rm --use-aliases \
1133 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_sshd --rm --use-aliases \
1017 --publish $RC_SSH_PORT:$RC_SSH_PORT --rm --use-aliases \
1134 --publish $RC_SSH_PORT:$RC_SSH_PORT --rm --use-aliases \
1018 --workdir=\"/home/rhodecode/rhodecode-enterprise-ce\" \
1135 --workdir=\"/home/rhodecode/rhodecode-enterprise-ce\" \
1019 --interactive --tty \
1136 --interactive --tty \
1020 --name=\"$container_name\" sshd bash $dev_env_file"
1137 --name=\"$container_name\" sshd bash $dev_env_file"
1021
1138
1022 }
1139 }
1023
1140
1024 # :command.function
1141 # :command.function
1025 dev_tools_tools_command() {
1142 dev_tools_tools_command() {
1026 # src/tools_command.sh
1143 # src/tools_command.sh
1027 container_name=dev-tools
1144 container_name=dev-tools
1028
1145
1029 docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found
1146 docker ps -q --filter "name=$container_name" | grep -q . && echo $container_name found || echo $container_name not found
1030 docker ps -q --filter "name=$container_name" | grep -q . && docker stop -t 120 $container_name && docker rm -fv $container_name
1147 docker ps -q --filter "name=$container_name" | grep -q . && docker stop -t 120 $container_name && docker rm -fv $container_name
1031
1148
1032 if [[ -v WORKSPACE_HOME ]];
1149 if [[ -v WORKSPACE_HOME ]];
1033 then
1150 then
1034 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
1151 DEFAULT_WORKSPACE_HOME=$WORKSPACE_HOME
1035 else
1152 else
1036 echo "WORKSPACE_HOME env var is not set"
1153 echo "WORKSPACE_HOME env var is not set"
1037 exit 1
1154 exit 1
1038 fi
1155 fi
1039
1156
1040 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
1157 echo "Using default WORKSPACE_HOME path: $DEFAULT_WORKSPACE_HOME"
1041
1158
1042 eval "
1159 eval "
1043 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
1160 WORKSPACE_HOME=$DEFAULT_WORKSPACE_HOME \
1044 ./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \
1161 ./rcstack stack --env-file-path .custom/.dev.env rhodecode -f docker-compose-apps.dev.yaml \
1045 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_tools_bash \
1162 run -e ENV_FILE= -e RC_ENV_FILE= -e RC_APP_TYPE=rhodecode_tools_bash \
1046 --rm --use-aliases \
1163 --rm --use-aliases \
1047 --workdir=\"/home/rhodecode/rhodecode-tools-ce\" \
1164 --workdir=\"/home/rhodecode/rhodecode-tools-ce\" \
1048 --interactive --tty \
1165 --interactive --tty \
1049 --name=\"$container_name\" rhodecode bash /home/rhodecode/rhodecode-tools-ce/.dev/dev-env.sh"
1166 --name=\"$container_name\" rhodecode bash /home/rhodecode/rhodecode-tools-ce/.dev/dev-env.sh"
1050
1167
1051 }
1168 }
1052
1169
1053 # :command.function
1170 # :command.function
1054 dev_tools_dev_env_command() {
1171 dev_tools_dev_env_command() {
1055 # src/dev_env_command.sh
1172 # src/dev_env_command.sh
1056 eval " \
1173 eval " \
1057 ./rcstack stack metrics up --detach statsd-exporter && \
1174 ./rcstack stack metrics up --detach statsd-exporter && \
1058 ./rcstack stack services up --detach && \
1175 ./rcstack stack services up --detach && \
1059 ./rcstack stack rhodecode up --detach svn celery celery-beat && \
1176 ./rcstack stack rhodecode up --detach svn celery celery-beat && \
1060 ./rcstack stack services up --detach httpbin && \
1177 ./rcstack stack services up --detach httpbin && \
1061 ./rcstack stack services up --detach ldap-server && \
1178 ./rcstack stack services up --detach ldap-server && \
1062 ./rcstack status"
1179 ./rcstack status"
1063 }
1180 }
1064
1181
1065 # :command.function
1182 # :command.function
1066 dev_tools_prune_command() {
1183 dev_tools_prune_command() {
1067 # src/prune_command.sh
1184 # src/prune_command.sh
1068 docker container prune -f
1185 docker container prune -f
1069 docker image prune -f
1186 docker image prune -f
1070 docker builder prune -f
1187 docker builder prune -f
1071 docker system df
1188 docker system df
1072 }
1189 }
1073
1190
1074 # :command.function
1191 # :command.function
1075 dev_tools_prune_all_command() {
1192 dev_tools_prune_all_command() {
1076 # src/prune_all_command.sh
1193 # src/prune_all_command.sh
1077 docker container prune -f
1194 docker container prune -f
1078 docker image prune -f
1195 docker image prune -f
1079 docker builder prune -f
1196 docker builder prune -f
1080 docker system prune -f
1197 docker system prune -f
1081 docker system df
1198 docker system df
1082 }
1199 }
1083
1200
1084 # :command.function
1201 # :command.function
1085 dev_tools_cli_generate_pull_command() {
1202 dev_tools_cli_generate_pull_command() {
1086 # src/cli_generate_pull_command.sh
1203 # src/cli_generate_pull_command.sh
1087 docker pull $bashly_image
1204 docker pull $bashly_image
1088 }
1205 }
1089
1206
1090 # :command.function
1207 # :command.function
1091 dev_tools_cli_generate_help_command() {
1208 dev_tools_cli_generate_help_command() {
1092 # src/cli_generate_help_command.sh
1209 # src/cli_generate_help_command.sh
1093 source_dir=/media/psf/Home/workspace/rcstack-cli-modules/dev-tools
1210 source_dir=/media/psf/Home/workspace/rcstack-cli-modules/dev-tools
1094 target_dir=/media/psf/Home/workspace/rhodecode-docker/scripts/dev-tools
1211 target_dir=/media/psf/Home/workspace/rhodecode-docker/scripts/dev-tools
1095
1212
1096 echo "To pull latest image:"
1213 echo "To pull latest image:"
1097 echo " docker pull $bashly_image"
1214 echo " docker pull $bashly_image"
1098
1215
1099 echo "To run generation manually:"
1216 echo "To run generation manually:"
1100 echo " docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate"
1217 echo " docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate"
1101
1218
1102 echo "To upgrade builting scripts:"
1219 echo "To upgrade builting scripts:"
1103 echo " docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --upgrade"
1220 echo " docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --upgrade"
1104
1221
1105 #bashly generate --upgrade
1222 #bashly generate --upgrade
1106
1223
1107 # bashly add completions_script && source ./completions.bash
1224 # bashly add completions_script && source ./completions.bash
1108
1225
1109 #alias bashly='docker run --rm -it --user $(id -u):$(id -g) --volume "$PWD:/app" dannyben/bashly:edge'
1226 #alias bashly='docker run --rm -it --user $(id -u):$(id -g) --volume "$PWD:/app" dannyben/bashly:edge'
1110 }
1227 }
1111
1228
1112 # :command.function
1229 # :command.function
1113 dev_tools_stack_cli_version_command() {
1230 dev_tools_stack_cli_version_command() {
1114 # src/stack_cli_version_command.sh
1231 # src/stack_cli_version_command.sh
1115 version=${args[version]}
1232 version=${args[version]}
1116 version_file=$(pwd)/VERSION
1233 version_file=$(pwd)/VERSION
1117 yaml_file=$(pwd)/scripts/rcstack/src/bashly.yml
1234 yaml_file=$(pwd)/scripts/rcstack/src/bashly.yml
1118
1235
1119 echo "Setting $version to $version_file"
1236 echo "Setting $version to $version_file"
1120 echo -n $version > $version_file
1237 echo -n $version > $version_file
1121
1238
1122 echo "Setting $version to $yaml_file"
1239 echo "Setting $version to $yaml_file"
1123 sed -i -E "s/version:.+/version: $version/" $yaml_file
1240 sed -i -E "s/version:.+/version: $version/" $yaml_file
1124
1241
1125 }
1242 }
1126
1243
1127 # :command.function
1244 # :command.function
1128 dev_tools_cli_generate_rc_command() {
1245 dev_tools_cli_generate_rc_command() {
1129 # src/cli_generate_rc_command.sh
1246 # src/cli_generate_rc_command.sh
1130 one_time=${args[--one-time]}
1247 one_time=${args[--one-time]}
1131
1248
1132 echo "Using scripts/scripts/rcstack/bashly.yaml @ $bashly_image"
1249 echo "Using scripts/scripts/rcstack/bashly.yaml @ $bashly_image"
1133 source_dir=/media/psf/Home/workspace/rcstack-cli-modules/rcstack
1250 source_dir=/media/psf/Home/workspace/rcstack-cli-modules/rcstack
1134 target_dir=/media/psf/Home/workspace/rhodecode-docker/scripts/rcstack
1251 target_dir=/media/psf/Home/workspace/rhodecode-docker/scripts/rcstack
1135
1252
1136 if [[ $one_time ]]; then
1253 if [[ $one_time ]]; then
1137 docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --upgrade
1254 docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --upgrade
1138 else
1255 else
1139 docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --watch
1256 docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --watch
1140 fi
1257 fi
1141
1258
1142 }
1259 }
1143
1260
1144 # :command.function
1261 # :command.function
1145 dev_tools_cli_generate_dev_command() {
1262 dev_tools_cli_generate_dev_command() {
1146 # src/cli_generate_dev_command.sh
1263 # src/cli_generate_dev_command.sh
1147 one_time=${args[--one-time]}
1264 one_time=${args[--one-time]}
1148
1265
1149 echo "Using scripts/dev-tools/bashly.yaml @ $bashly_image"
1266 echo "Using scripts/dev-tools/bashly.yaml @ $bashly_image"
1150 source_dir=/media/psf/Home/workspace/rcstack-cli-modules/dev-tools
1267 source_dir=/media/psf/Home/workspace/rcstack-cli-modules/dev-tools
1151 target_dir=/media/psf/Home/workspace/rhodecode-docker/scripts/dev-tools
1268 target_dir=/media/psf/Home/workspace/rhodecode-docker/scripts/dev-tools
1152
1269
1153 if [[ $one_time ]]; then
1270 if [[ $one_time ]]; then
1154 docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --upgrade
1271 docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --upgrade
1155 else
1272 else
1156 docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --watch
1273 docker run --rm -it --user $(id -u):$(id -g) --volume "$source_dir:/app" --volume "$target_dir:/dest" -e BASHLY_TARGET_DIR=/dest $bashly_image generate --watch
1157 fi
1274 fi
1158
1275
1159 }
1276 }
1160
1277
1161 # :command.function
1278 # :command.function
1162 dev_tools_get_build_artifacts_command() {
1279 dev_tools_get_build_artifacts_command() {
1163 # src/get_build_artifacts_command.sh
1280 # src/get_build_artifacts_command.sh
1164
1281
1165 DEBUG=${args[--debug]}
1282 DEBUG=${args[--debug]}
1166 AUTH=${args[--auth]}
1283 AUTH=${args[--auth]}
1167 INSTALLER_URL=${args[--installer-url]}
1284 INSTALLER_URL=${args[--installer-url]}
1168 MANIFEST_URL=${args[--manifest-url]}
1285 MANIFEST_URL=${args[--manifest-url]}
1169 RC_VERSION=${args[--version-name]}
1286 RC_VERSION=${args[--version-name]}
1170 VER=$RC_VERSION
1287 VER=$RC_VERSION
1171
1288
1172 CACHE_DIR=$PWD/.cache
1289 CACHE_DIR=$PWD/.cache
1173 VER_REGEX="$VER+x86_64"
1290 VER_REGEX="$VER+x86_64"
1174
1291
1175 if [[ $VER == "" ]]; then
1292 if [[ $VER == "" ]]; then
1176 msg="Version is empty, please set --version-name correctly"
1293 msg="Version is empty, please set --version-name correctly"
1177 echo "$(red $msg)"
1294 echo "$(red $msg)"
1178 exit 1
1295 exit 1
1179 fi
1296 fi
1180
1297
1181 echo "Downloading Artifacts for version: $VER"
1298 echo "Downloading Artifacts for version: $VER"
1182 mkdir -p $CACHE_DIR
1299 mkdir -p $CACHE_DIR
1183
1300
1184 echo "1/4 Checking available downloads from MANIFEST file"
1301 echo "1/4 Checking available downloads from MANIFEST file"
1185
1302
1186 ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2)
1303 ARTS=$(curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2)
1187
1304
1188 if [[ $DEBUG ]]; then
1305 if [[ $DEBUG ]]; then
1189 echo "DEBUG START"
1306 echo "DEBUG START"
1190 curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match"
1307 curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" || echo "no regex match"
1191 curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2
1308 curl -s $AUTH $MANIFEST_URL | grep --ignore-case "$VER_REGEX" | cut -d ' ' -f 2
1192 echo "Found following artifacts:"
1309 echo "Found following artifacts:"
1193 echo $ARTS
1310 echo $ARTS
1194 echo "DEBUG END"
1311 echo "DEBUG END"
1195 fi
1312 fi
1196
1313
1197 if [[ $ARTS == "" ]]; then
1314 if [[ $ARTS == "" ]]; then
1198 MSG="Failed to found any MANIFEST entries for version $VER make sure there exists release with that version or use --version to specify different version"
1315 MSG="Failed to found any MANIFEST entries for version $VER make sure there exists release with that version or use --version to specify different version"
1199 echo "$(red $MSG)"
1316 echo "$(red $MSG)"
1200 exit 1
1317 exit 1
1201 fi
1318 fi
1202
1319
1203 echo "2/4 Downloading locale-archive"
1320 echo "2/4 Downloading locale-archive"
1204 curl -L https://dls.rhodecode.com/assets/locale-archive -J -O
1321 curl -L https://dls.rhodecode.com/assets/locale-archive -J -O
1205 mv -v locale-archive "$CACHE_DIR"
1322 mv -v locale-archive "$CACHE_DIR"
1206
1323
1207 # vcsserver/ce/ee
1324 # vcsserver/ce/ee
1208 echo "3/4 Downloading installer artifacts"
1325 echo "3/4 Downloading installer artifacts"
1209 for url in $ARTS; do
1326 for url in $ARTS; do
1210 echo "Downloading $url with $AUTH"
1327 echo "Downloading $url with $AUTH"
1211 curl $AUTH --fail-early -L ${url} -J -O
1328 curl $AUTH --fail-early -L ${url} -J -O
1212 done
1329 done
1213
1330
1214 #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do
1331 #for url in $(curl -s $MANIFEST_URL | grep --ignore-case -E 'control.+\+x86_64' | cut -d ' ' -f 2); do
1215 # echo "Downloading $url"
1332 # echo "Downloading $url"
1216 # curl -L ${url} -J -O
1333 # curl -L ${url} -J -O
1217 #done
1334 #done
1218
1335
1219 echo "4/4 Downloading installer from $INSTALLER_URL"
1336 echo "4/4 Downloading installer from $INSTALLER_URL"
1220 curl $AUTH -L $INSTALLER_URL -J -O
1337 curl $AUTH -L $INSTALLER_URL -J -O
1221
1338
1222 INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1)
1339 INSTALLER=$(ls -Art RhodeCode-installer-* | tail -n 1)
1223 if [[ -n $INSTALLER ]]; then
1340 if [[ -n $INSTALLER ]]; then
1224 chmod +x "${INSTALLER}"
1341 chmod +x "${INSTALLER}"
1225 fi
1342 fi
1226
1343
1227 echo "Copying artifacts into $CACHE_DIR"
1344 echo "Copying artifacts into $CACHE_DIR"
1228
1345
1229 mv -v "${INSTALLER}" $CACHE_DIR
1346 mv -v "${INSTALLER}" $CACHE_DIR
1230 mv -v *.bz2 $CACHE_DIR
1347 mv -v *.bz2 $CACHE_DIR
1231 ls -lh $CACHE_DIR
1348 ls -lh $CACHE_DIR
1232
1349
1233 }
1350 }
1234
1351
1235 # :command.function
1352 # :command.function
1236 dev_tools_build_installer_command() {
1353 dev_tools_build_installer_command() {
1237 # src/build_installer_command.sh
1354 # src/build_installer_command.sh
1238
1355
1239 rc_version=${args[--version-name]}
1356 rc_version=${args[--version-name]}
1240 export RC_VERSION=$rc_version
1357 export RC_VERSION=$rc_version
1241 eval "echo INSTALLER BASED BUILDING${RC_VERSION}"
1358 eval "echo INSTALLER BASED BUILDING${RC_VERSION}"
1242
1359
1243 RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode build --progress plain rhodecode
1360 RC_VERSION=$rc_version ./$RC_SCRIPT_NAME stack rhodecode build --progress plain rhodecode
1244
1361
1245 }
1362 }
1246
1363
1247 # :command.function
1364 # :command.function
1248 dev_tools_get_build_source_command() {
1365 dev_tools_get_build_source_command() {
1249 # src/get_build_source_command.sh
1366 # src/get_build_source_command.sh
1250
1367
1251 DEBUG=${args[--debug]}
1368 DEBUG=${args[--debug]}
1252 AUTH_TOKEN=${args[--auth-token]}
1369 AUTH_TOKEN=${args[--auth-token]}
1253 SERVER_URL=${args[--server-url]}
1370 SERVER_URL=${args[--server-url]}
1254 revision=${args[--revision]}
1371 revision=${args[--revision]}
1255
1372
1256 SOURCE_DIR=$PWD/.source
1373 SOURCE_DIR=$PWD/.source
1257
1374
1258 RHODECODE_VCS_HASH=$revision
1375 RHODECODE_VCS_HASH=$revision
1259 RHODECODE_CE_HASH=$revision
1376 RHODECODE_CE_HASH=$revision
1260 RHODECODE_EE_HASH=$revision
1377 RHODECODE_EE_HASH=$revision
1261
1378
1262 # download sources
1379 # download sources
1263 echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **"
1380 echo "** download rhodecode source for build from $SERVER_URL using '$revision' hash **"
1264 mkdir -p $SOURCE_DIR
1381 mkdir -p $SOURCE_DIR
1265
1382
1266 echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz"
1383 echo "getting $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz"
1267 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
1384 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-vcsserver/archive/$RHODECODE_VCS_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
1268
1385
1269 echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz"
1386 echo "getting $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz"
1270 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
1387 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ce/archive/$RHODECODE_CE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
1271
1388
1272 echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz"
1389 echo "getting $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz"
1273 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
1390 curl --fail --header "X-Rc-Auth-Token: $AUTH_TOKEN" -L $SERVER_URL/rhodecode-enterprise-ee/archive/$RHODECODE_EE_HASH.tgz?with_hash=0 | tar -xz -C $SOURCE_DIR
1274
1391
1275 rm -rf $SOURCE_DIR/rhodecode-vcsserver && \
1392 rm -rf $SOURCE_DIR/rhodecode-vcsserver && \
1276 mv $SOURCE_DIR/*rhodecode-vcsserver-* $SOURCE_DIR/rhodecode-vcsserver
1393 mv $SOURCE_DIR/*rhodecode-vcsserver-* $SOURCE_DIR/rhodecode-vcsserver
1277 rm -rf $SOURCE_DIR/rhodecode-vcsserver/.hg
1394 rm -rf $SOURCE_DIR/rhodecode-vcsserver/.hg
1278
1395
1279 rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \
1396 rm -rf $SOURCE_DIR/rhodecode-enterprise-ce && \
1280 mv $SOURCE_DIR/*rhodecode-enterprise-ce-* $SOURCE_DIR/rhodecode-enterprise-ce
1397 mv $SOURCE_DIR/*rhodecode-enterprise-ce-* $SOURCE_DIR/rhodecode-enterprise-ce
1281 rm -rf $SOURCE_DIR/rhodecode-enterprise-ce/.hg
1398 rm -rf $SOURCE_DIR/rhodecode-enterprise-ce/.hg
1282
1399
1283 rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \
1400 rm -rf $SOURCE_DIR/rhodecode-enterprise-ee && \
1284 mv $SOURCE_DIR/*rhodecode-enterprise-ee-* $SOURCE_DIR/rhodecode-enterprise-ee
1401 mv $SOURCE_DIR/*rhodecode-enterprise-ee-* $SOURCE_DIR/rhodecode-enterprise-ee
1285 rm -rf $SOURCE_DIR/rhodecode-enterprise-ee/.hg
1402 rm -rf $SOURCE_DIR/rhodecode-enterprise-ee/.hg
1286
1403
1287 echo "downloading sources done to $SOURCE_DIR, directory now consists:"
1404 echo "downloading sources done to $SOURCE_DIR, directory now consists:"
1288 ls -l $SOURCE_DIR
1405 ls -l $SOURCE_DIR
1289
1406
1290 echo ""
1407 echo ""
1291 date_formatted=$(date +%Y.%m.%d.1)
1408 date_formatted=$(date +%Y.%m.%d.1)
1292 echo "to create source based build run:"
1409 echo "to create source based build run:"
1293 echo " ./$RC_SCRIPT_NAME build-source --version-name 4.28.0.$date_formatted --tag beta"
1410 echo " ./$RC_SCRIPT_NAME build-source --version-name 4.28.0.$date_formatted --tag beta"
1294 echo " ./$RC_SCRIPT_NAME build-source --version-name 5.0.0.$date_formatted --tag beta"
1411 echo " ./$RC_SCRIPT_NAME build-source --version-name 5.0.0.$date_formatted --tag beta"
1295
1412
1296 }
1413 }
1297
1414
1298 # :command.function
1415 # :command.function
1299 dev_tools_build_source_command() {
1416 dev_tools_build_source_command() {
1300 # src/build_source_command.sh
1417 # src/build_source_command.sh
1301
1418
1302 rc_version=${args[--version-name]}
1419 rc_version=${args[--version-name]}
1303 source_build_yaml=${args[--source-build-yaml]}
1420 source_build_yaml=${args[--source-build-yaml]}
1304
1421
1305 eval "tags_data=(${args[--tag]})"
1422 eval "tags_data=(${args[--tag]})"
1306
1423
1307 export RC_VERSION=$rc_version
1424 export RC_VERSION=$rc_version
1308 export RC_EDITION=ee
1425 export RC_EDITION=ee
1309
1426
1310 VCS_SHA=$(cat .source/rhodecode-vcsserver/.archival.txt | grep commit_id | cut -d ":" -f 2 | cut -c 1-6)
1427 VCS_SHA=$(cat .source/rhodecode-vcsserver/.archival.txt | grep commit_id | cut -d ":" -f 2 | cut -c 1-6)
1311 CE_SHA=$(cat .source/rhodecode-enterprise-ce/.archival.txt | grep commit_id | cut -d ":" -f 2 | cut -c 1-6)
1428 CE_SHA=$(cat .source/rhodecode-enterprise-ce/.archival.txt | grep commit_id | cut -d ":" -f 2 | cut -c 1-6)
1312 EE_SHA=$(cat .source/rhodecode-enterprise-ee/.archival.txt | grep commit_id | cut -d ":" -f 2 | cut -c 1-6)
1429 EE_SHA=$(cat .source/rhodecode-enterprise-ee/.archival.txt | grep commit_id | cut -d ":" -f 2 | cut -c 1-6)
1313
1430
1314 echo "build_source: SOURCE BASED BUILDING: $rc_version @ vcs:$VCS_SHA ce:$CE_SHA ee:$EE_SHA"
1431 echo "build_source: SOURCE BASED BUILDING: $rc_version @ vcs:$VCS_SHA ce:$CE_SHA ee:$EE_SHA"
1315 echo "build_source: tags:" ${tags_data[@]}
1432 echo "build_source: tags:" ${tags_data[@]}
1316 echo ""
1433 echo ""
1317
1434
1318 RC_SCRIPT_NAME=rcstack
1435 RC_SCRIPT_NAME=rcstack
1319 DOCKER_SCAN_SUGGEST=false RC_VERSION=$rc_version \
1436 DOCKER_SCAN_SUGGEST=false RC_VERSION=$rc_version \
1320 ./$RC_SCRIPT_NAME stack rhodecode -f $source_build_yaml \
1437 ./$RC_SCRIPT_NAME stack rhodecode -f $source_build_yaml \
1321 --progress plain \
1438 --progress plain \
1322 build \
1439 build \
1323 --build-arg VCS_SHA=$VCS_SHA \
1440 --build-arg VCS_SHA=$VCS_SHA \
1324 --build-arg CE_SHA=$CE_SHA \
1441 --build-arg CE_SHA=$CE_SHA \
1325 --build-arg EE_SHA=$EE_SHA \
1442 --build-arg EE_SHA=$EE_SHA \
1326 rhodecode
1443 rhodecode
1327
1444
1328 # now tag the ee to ce
1445 # now tag the ee to ce
1329 docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$rc_version
1446 docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$rc_version
1330
1447
1331 # apply the tags
1448 # apply the tags
1332 for tag in "${tags_data[@]}"; do
1449 for tag in "${tags_data[@]}"; do
1333 echo "build_source: creating tag:$tag"
1450 echo "build_source: creating tag:$tag"
1334 docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ee:$tag
1451 docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ee:$tag
1335 docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$tag
1452 docker tag rhodecode/rhodecode-ee:$rc_version rhodecode/rhodecode-ce:$tag
1336 done
1453 done
1337
1454
1338 echo "build_source: consider setting release version using"
1455 echo "build_source: consider setting release version using"
1339 echo " ./$RC_SCRIPT_NAME cli set-runtime-image $rc_version"
1456 echo " ./$RC_SCRIPT_NAME cli set-runtime-image $rc_version"
1340
1457
1341 echo "build_source: push this image using"
1458 echo "build_source: push this image using"
1342 echo " docker push rhodecode/rhodecode-ee:$rc_version"
1459 echo " docker push rhodecode/rhodecode-ee:$rc_version"
1343 echo " docker push rhodecode/rhodecode-ce:$rc_version"
1460 echo " docker push rhodecode/rhodecode-ce:$rc_version"
1344
1461
1345 for tag in "${tags_data[@]}"; do
1462 for tag in "${tags_data[@]}"; do
1346 echo " docker push rhodecode/rhodecode-ee:$tag"
1463 echo " docker push rhodecode/rhodecode-ee:$tag"
1347 echo " docker push rhodecode/rhodecode-ce:$tag"
1464 echo " docker push rhodecode/rhodecode-ce:$tag"
1348 done
1465 done
1349 }
1466 }
1350
1467
1351 # :command.parse_requirements
1468 # :command.parse_requirements
1352 parse_requirements() {
1469 parse_requirements() {
1353 # :command.fixed_flags_filter
1470 # :command.fixed_flags_filter
1354 while [[ $# -gt 0 ]]; do
1471 while [[ $# -gt 0 ]]; do
1355 case "${1:-}" in
1472 case "${1:-}" in
1356 --version | -v)
1473 --version | -v)
1357 version_command
1474 version_command
1358 exit
1475 exit
1359 ;;
1476 ;;
1360
1477
1361 --help | -h)
1478 --help | -h)
1362 long_usage=yes
1479 long_usage=yes
1363 dev_tools_usage
1480 dev_tools_usage
1364 exit
1481 exit
1365 ;;
1482 ;;
1366
1483
1367 *)
1484 *)
1368 break
1485 break
1369 ;;
1486 ;;
1370
1487
1371 esac
1488 esac
1372 done
1489 done
1373
1490
1374 # :command.command_filter
1491 # :command.command_filter
1375 action=${1:-}
1492 action=${1:-}
1376
1493
1377 case $action in
1494 case $action in
1378 -*) ;;
1495 -*) ;;
1379
1496
1380 vcs | v)
1497 vcs | v)
1381 action="vcs"
1498 action="vcs"
1382 shift
1499 shift
1383 dev_tools_vcs_parse_requirements "$@"
1500 dev_tools_vcs_parse_requirements "$@"
1384 shift $#
1501 shift $#
1385 ;;
1502 ;;
1386
1503
1387 ee | e)
1504 ee | e)
1388 action="ee"
1505 action="ee"
1389 shift
1506 shift
1390 dev_tools_ee_parse_requirements "$@"
1507 dev_tools_ee_parse_requirements "$@"
1391 shift $#
1508 shift $#
1392 ;;
1509 ;;
1393
1510
1394 ce | c)
1511 ce | c)
1395 action="ce"
1512 action="ce"
1396 shift
1513 shift
1397 dev_tools_ce_parse_requirements "$@"
1514 dev_tools_ce_parse_requirements "$@"
1398 shift $#
1515 shift $#
1399 ;;
1516 ;;
1400
1517
1401 svn | s)
1518 svn | s)
1402 action="svn"
1519 action="svn"
1403 shift
1520 shift
1404 dev_tools_svn_parse_requirements "$@"
1521 dev_tools_svn_parse_requirements "$@"
1405 shift $#
1522 shift $#
1406 ;;
1523 ;;
1407
1524
1408 celery)
1525 celery)
1409 action="celery"
1526 action="celery"
1410 shift
1527 shift
1411 dev_tools_celery_parse_requirements "$@"
1528 dev_tools_celery_parse_requirements "$@"
1412 shift $#
1529 shift $#
1413 ;;
1530 ;;
1414
1531
1532 celeryd)
1533 action="celeryd"
1534 shift
1535 dev_tools_celeryd_parse_requirements "$@"
1536 shift $#
1537 ;;
1538
1415 sshd)
1539 sshd)
1416 action="sshd"
1540 action="sshd"
1417 shift
1541 shift
1418 dev_tools_sshd_parse_requirements "$@"
1542 dev_tools_sshd_parse_requirements "$@"
1419 shift $#
1543 shift $#
1420 ;;
1544 ;;
1421
1545
1422 tools | t)
1546 tools | t)
1423 action="tools"
1547 action="tools"
1424 shift
1548 shift
1425 dev_tools_tools_parse_requirements "$@"
1549 dev_tools_tools_parse_requirements "$@"
1426 shift $#
1550 shift $#
1427 ;;
1551 ;;
1428
1552
1429 dev-env)
1553 dev-env)
1430 action="dev-env"
1554 action="dev-env"
1431 shift
1555 shift
1432 dev_tools_dev_env_parse_requirements "$@"
1556 dev_tools_dev_env_parse_requirements "$@"
1433 shift $#
1557 shift $#
1434 ;;
1558 ;;
1435
1559
1436 prune)
1560 prune)
1437 action="prune"
1561 action="prune"
1438 shift
1562 shift
1439 dev_tools_prune_parse_requirements "$@"
1563 dev_tools_prune_parse_requirements "$@"
1440 shift $#
1564 shift $#
1441 ;;
1565 ;;
1442
1566
1443 prune-all)
1567 prune-all)
1444 action="prune-all"
1568 action="prune-all"
1445 shift
1569 shift
1446 dev_tools_prune_all_parse_requirements "$@"
1570 dev_tools_prune_all_parse_requirements "$@"
1447 shift $#
1571 shift $#
1448 ;;
1572 ;;
1449
1573
1450 cli-generate-pull)
1574 cli-generate-pull)
1451 action="cli-generate-pull"
1575 action="cli-generate-pull"
1452 shift
1576 shift
1453 dev_tools_cli_generate_pull_parse_requirements "$@"
1577 dev_tools_cli_generate_pull_parse_requirements "$@"
1454 shift $#
1578 shift $#
1455 ;;
1579 ;;
1456
1580
1457 cli-generate-help)
1581 cli-generate-help)
1458 action="cli-generate-help"
1582 action="cli-generate-help"
1459 shift
1583 shift
1460 dev_tools_cli_generate_help_parse_requirements "$@"
1584 dev_tools_cli_generate_help_parse_requirements "$@"
1461 shift $#
1585 shift $#
1462 ;;
1586 ;;
1463
1587
1464 stack-cli-version)
1588 stack-cli-version)
1465 action="stack-cli-version"
1589 action="stack-cli-version"
1466 shift
1590 shift
1467 dev_tools_stack_cli_version_parse_requirements "$@"
1591 dev_tools_stack_cli_version_parse_requirements "$@"
1468 shift $#
1592 shift $#
1469 ;;
1593 ;;
1470
1594
1471 cli-generate-rc)
1595 cli-generate-rc)
1472 action="cli-generate-rc"
1596 action="cli-generate-rc"
1473 shift
1597 shift
1474 dev_tools_cli_generate_rc_parse_requirements "$@"
1598 dev_tools_cli_generate_rc_parse_requirements "$@"
1475 shift $#
1599 shift $#
1476 ;;
1600 ;;
1477
1601
1478 cli-generate-dev)
1602 cli-generate-dev)
1479 action="cli-generate-dev"
1603 action="cli-generate-dev"
1480 shift
1604 shift
1481 dev_tools_cli_generate_dev_parse_requirements "$@"
1605 dev_tools_cli_generate_dev_parse_requirements "$@"
1482 shift $#
1606 shift $#
1483 ;;
1607 ;;
1484
1608
1485 get-build-artifacts)
1609 get-build-artifacts)
1486 action="get-build-artifacts"
1610 action="get-build-artifacts"
1487 shift
1611 shift
1488 dev_tools_get_build_artifacts_parse_requirements "$@"
1612 dev_tools_get_build_artifacts_parse_requirements "$@"
1489 shift $#
1613 shift $#
1490 ;;
1614 ;;
1491
1615
1492 build-installer)
1616 build-installer)
1493 action="build-installer"
1617 action="build-installer"
1494 shift
1618 shift
1495 dev_tools_build_installer_parse_requirements "$@"
1619 dev_tools_build_installer_parse_requirements "$@"
1496 shift $#
1620 shift $#
1497 ;;
1621 ;;
1498
1622
1499 get-build-source)
1623 get-build-source)
1500 action="get-build-source"
1624 action="get-build-source"
1501 shift
1625 shift
1502 dev_tools_get_build_source_parse_requirements "$@"
1626 dev_tools_get_build_source_parse_requirements "$@"
1503 shift $#
1627 shift $#
1504 ;;
1628 ;;
1505
1629
1506 build-source)
1630 build-source)
1507 action="build-source"
1631 action="build-source"
1508 shift
1632 shift
1509 dev_tools_build_source_parse_requirements "$@"
1633 dev_tools_build_source_parse_requirements "$@"
1510 shift $#
1634 shift $#
1511 ;;
1635 ;;
1512
1636
1513 # :command.command_fallback
1637 # :command.command_fallback
1514 "")
1638 "")
1515 dev_tools_usage >&2
1639 dev_tools_usage >&2
1516 exit 1
1640 exit 1
1517 ;;
1641 ;;
1518
1642
1519 *)
1643 *)
1520 printf "invalid command: %s\n" "$action" >&2
1644 printf "invalid command: %s\n" "$action" >&2
1521 exit 1
1645 exit 1
1522 ;;
1646 ;;
1523
1647
1524 esac
1648 esac
1525
1649
1526 # :command.parse_requirements_while
1650 # :command.parse_requirements_while
1527 while [[ $# -gt 0 ]]; do
1651 while [[ $# -gt 0 ]]; do
1528 key="$1"
1652 key="$1"
1529 case "$key" in
1653 case "$key" in
1530
1654
1531 -?*)
1655 -?*)
1532 printf "invalid option: %s\n" "$key" >&2
1656 printf "invalid option: %s\n" "$key" >&2
1533 exit 1
1657 exit 1
1534 ;;
1658 ;;
1535
1659
1536 *)
1660 *)
1537 # :command.parse_requirements_case
1661 # :command.parse_requirements_case
1538 # :command.parse_requirements_case_simple
1662 # :command.parse_requirements_case_simple
1539 printf "invalid argument: %s\n" "$key" >&2
1663 printf "invalid argument: %s\n" "$key" >&2
1540 exit 1
1664 exit 1
1541
1665
1542 ;;
1666 ;;
1543
1667
1544 esac
1668 esac
1545 done
1669 done
1546
1670
1547 }
1671 }
1548
1672
1549 # :command.parse_requirements
1673 # :command.parse_requirements
1550 dev_tools_vcs_parse_requirements() {
1674 dev_tools_vcs_parse_requirements() {
1551 # :command.fixed_flags_filter
1675 # :command.fixed_flags_filter
1552 while [[ $# -gt 0 ]]; do
1676 while [[ $# -gt 0 ]]; do
1553 case "${1:-}" in
1677 case "${1:-}" in
1554 --help | -h)
1678 --help | -h)
1555 long_usage=yes
1679 long_usage=yes
1556 dev_tools_vcs_usage
1680 dev_tools_vcs_usage
1557 exit
1681 exit
1558 ;;
1682 ;;
1559
1683
1560 *)
1684 *)
1561 break
1685 break
1562 ;;
1686 ;;
1563
1687
1564 esac
1688 esac
1565 done
1689 done
1566
1690
1567 # :command.command_filter
1691 # :command.command_filter
1568 action="vcs"
1692 action="vcs"
1569
1693
1570 # :command.parse_requirements_while
1694 # :command.parse_requirements_while
1571 while [[ $# -gt 0 ]]; do
1695 while [[ $# -gt 0 ]]; do
1572 key="$1"
1696 key="$1"
1573 case "$key" in
1697 case "$key" in
1574
1698
1575 -?*)
1699 -?*)
1576 printf "invalid option: %s\n" "$key" >&2
1700 printf "invalid option: %s\n" "$key" >&2
1577 exit 1
1701 exit 1
1578 ;;
1702 ;;
1579
1703
1580 *)
1704 *)
1581 # :command.parse_requirements_case
1705 # :command.parse_requirements_case
1582 # :command.parse_requirements_case_simple
1706 # :command.parse_requirements_case_simple
1583 printf "invalid argument: %s\n" "$key" >&2
1707 printf "invalid argument: %s\n" "$key" >&2
1584 exit 1
1708 exit 1
1585
1709
1586 ;;
1710 ;;
1587
1711
1588 esac
1712 esac
1589 done
1713 done
1590
1714
1591 }
1715 }
1592
1716
1593 # :command.parse_requirements
1717 # :command.parse_requirements
1594 dev_tools_ee_parse_requirements() {
1718 dev_tools_ee_parse_requirements() {
1595 # :command.fixed_flags_filter
1719 # :command.fixed_flags_filter
1596 while [[ $# -gt 0 ]]; do
1720 while [[ $# -gt 0 ]]; do
1597 case "${1:-}" in
1721 case "${1:-}" in
1598 --help | -h)
1722 --help | -h)
1599 long_usage=yes
1723 long_usage=yes
1600 dev_tools_ee_usage
1724 dev_tools_ee_usage
1601 exit
1725 exit
1602 ;;
1726 ;;
1603
1727
1604 *)
1728 *)
1605 break
1729 break
1606 ;;
1730 ;;
1607
1731
1608 esac
1732 esac
1609 done
1733 done
1610
1734
1611 # :command.command_filter
1735 # :command.command_filter
1612 action="ee"
1736 action="ee"
1613
1737
1614 # :command.parse_requirements_while
1738 # :command.parse_requirements_while
1615 while [[ $# -gt 0 ]]; do
1739 while [[ $# -gt 0 ]]; do
1616 key="$1"
1740 key="$1"
1617 case "$key" in
1741 case "$key" in
1618
1742
1619 -?*)
1743 -?*)
1620 printf "invalid option: %s\n" "$key" >&2
1744 printf "invalid option: %s\n" "$key" >&2
1621 exit 1
1745 exit 1
1622 ;;
1746 ;;
1623
1747
1624 *)
1748 *)
1625 # :command.parse_requirements_case
1749 # :command.parse_requirements_case
1626 # :command.parse_requirements_case_simple
1750 # :command.parse_requirements_case_simple
1627 printf "invalid argument: %s\n" "$key" >&2
1751 printf "invalid argument: %s\n" "$key" >&2
1628 exit 1
1752 exit 1
1629
1753
1630 ;;
1754 ;;
1631
1755
1632 esac
1756 esac
1633 done
1757 done
1634
1758
1635 }
1759 }
1636
1760
1637 # :command.parse_requirements
1761 # :command.parse_requirements
1638 dev_tools_ce_parse_requirements() {
1762 dev_tools_ce_parse_requirements() {
1639 # :command.fixed_flags_filter
1763 # :command.fixed_flags_filter
1640 while [[ $# -gt 0 ]]; do
1764 while [[ $# -gt 0 ]]; do
1641 case "${1:-}" in
1765 case "${1:-}" in
1642 --help | -h)
1766 --help | -h)
1643 long_usage=yes
1767 long_usage=yes
1644 dev_tools_ce_usage
1768 dev_tools_ce_usage
1645 exit
1769 exit
1646 ;;
1770 ;;
1647
1771
1648 *)
1772 *)
1649 break
1773 break
1650 ;;
1774 ;;
1651
1775
1652 esac
1776 esac
1653 done
1777 done
1654
1778
1655 # :command.command_filter
1779 # :command.command_filter
1656 action="ce"
1780 action="ce"
1657
1781
1658 # :command.parse_requirements_while
1782 # :command.parse_requirements_while
1659 while [[ $# -gt 0 ]]; do
1783 while [[ $# -gt 0 ]]; do
1660 key="$1"
1784 key="$1"
1661 case "$key" in
1785 case "$key" in
1662
1786
1663 -?*)
1787 -?*)
1664 printf "invalid option: %s\n" "$key" >&2
1788 printf "invalid option: %s\n" "$key" >&2
1665 exit 1
1789 exit 1
1666 ;;
1790 ;;
1667
1791
1668 *)
1792 *)
1669 # :command.parse_requirements_case
1793 # :command.parse_requirements_case
1670 # :command.parse_requirements_case_simple
1794 # :command.parse_requirements_case_simple
1671 printf "invalid argument: %s\n" "$key" >&2
1795 printf "invalid argument: %s\n" "$key" >&2
1672 exit 1
1796 exit 1
1673
1797
1674 ;;
1798 ;;
1675
1799
1676 esac
1800 esac
1677 done
1801 done
1678
1802
1679 }
1803 }
1680
1804
1681 # :command.parse_requirements
1805 # :command.parse_requirements
1682 dev_tools_svn_parse_requirements() {
1806 dev_tools_svn_parse_requirements() {
1683 # :command.fixed_flags_filter
1807 # :command.fixed_flags_filter
1684 while [[ $# -gt 0 ]]; do
1808 while [[ $# -gt 0 ]]; do
1685 case "${1:-}" in
1809 case "${1:-}" in
1686 --help | -h)
1810 --help | -h)
1687 long_usage=yes
1811 long_usage=yes
1688 dev_tools_svn_usage
1812 dev_tools_svn_usage
1689 exit
1813 exit
1690 ;;
1814 ;;
1691
1815
1692 *)
1816 *)
1693 break
1817 break
1694 ;;
1818 ;;
1695
1819
1696 esac
1820 esac
1697 done
1821 done
1698
1822
1699 # :command.command_filter
1823 # :command.command_filter
1700 action="svn"
1824 action="svn"
1701
1825
1702 # :command.parse_requirements_while
1826 # :command.parse_requirements_while
1703 while [[ $# -gt 0 ]]; do
1827 while [[ $# -gt 0 ]]; do
1704 key="$1"
1828 key="$1"
1705 case "$key" in
1829 case "$key" in
1706
1830
1707 -?*)
1831 -?*)
1708 printf "invalid option: %s\n" "$key" >&2
1832 printf "invalid option: %s\n" "$key" >&2
1709 exit 1
1833 exit 1
1710 ;;
1834 ;;
1711
1835
1712 *)
1836 *)
1713 # :command.parse_requirements_case
1837 # :command.parse_requirements_case
1714 # :command.parse_requirements_case_simple
1838 # :command.parse_requirements_case_simple
1715 printf "invalid argument: %s\n" "$key" >&2
1839 printf "invalid argument: %s\n" "$key" >&2
1716 exit 1
1840 exit 1
1717
1841
1718 ;;
1842 ;;
1719
1843
1720 esac
1844 esac
1721 done
1845 done
1722
1846
1723 }
1847 }
1724
1848
1725 # :command.parse_requirements
1849 # :command.parse_requirements
1726 dev_tools_celery_parse_requirements() {
1850 dev_tools_celery_parse_requirements() {
1727 # :command.fixed_flags_filter
1851 # :command.fixed_flags_filter
1728 while [[ $# -gt 0 ]]; do
1852 while [[ $# -gt 0 ]]; do
1729 case "${1:-}" in
1853 case "${1:-}" in
1730 --help | -h)
1854 --help | -h)
1731 long_usage=yes
1855 long_usage=yes
1732 dev_tools_celery_usage
1856 dev_tools_celery_usage
1733 exit
1857 exit
1734 ;;
1858 ;;
1735
1859
1736 *)
1860 *)
1737 break
1861 break
1738 ;;
1862 ;;
1739
1863
1740 esac
1864 esac
1741 done
1865 done
1742
1866
1743 # :command.command_filter
1867 # :command.command_filter
1744 action="celery"
1868 action="celery"
1745
1869
1746 # :command.parse_requirements_while
1870 # :command.parse_requirements_while
1747 while [[ $# -gt 0 ]]; do
1871 while [[ $# -gt 0 ]]; do
1748 key="$1"
1872 key="$1"
1749 case "$key" in
1873 case "$key" in
1874 # :flag.case
1875 --workdir)
1876
1877 # :flag.case_arg
1878 if [[ -n ${2+x} ]]; then
1879
1880 args['--workdir']="$2"
1881 shift
1882 shift
1883 else
1884 printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
1885 exit 1
1886 fi
1887 ;;
1888
1889 # :flag.case
1890 --cmd)
1891
1892 # :flag.case_arg
1893 if [[ -n ${2+x} ]]; then
1894
1895 args['--cmd']="$2"
1896 shift
1897 shift
1898 else
1899 printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
1900 exit 1
1901 fi
1902 ;;
1750
1903
1751 -?*)
1904 -?*)
1752 printf "invalid option: %s\n" "$key" >&2
1905 printf "invalid option: %s\n" "$key" >&2
1753 exit 1
1906 exit 1
1754 ;;
1907 ;;
1755
1908
1756 *)
1909 *)
1757 # :command.parse_requirements_case
1910 # :command.parse_requirements_case
1758 # :command.parse_requirements_case_simple
1911 # :command.parse_requirements_case_simple
1759 printf "invalid argument: %s\n" "$key" >&2
1912 printf "invalid argument: %s\n" "$key" >&2
1760 exit 1
1913 exit 1
1761
1914
1762 ;;
1915 ;;
1763
1916
1764 esac
1917 esac
1765 done
1918 done
1766
1919
1920 # :command.default_assignments
1921 [[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce"
1922 [[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev/cmd-celery.sh"
1923
1924 }
1925
1926 # :command.parse_requirements
1927 dev_tools_celeryd_parse_requirements() {
1928 # :command.fixed_flags_filter
1929 while [[ $# -gt 0 ]]; do
1930 case "${1:-}" in
1931 --help | -h)
1932 long_usage=yes
1933 dev_tools_celeryd_usage
1934 exit
1935 ;;
1936
1937 *)
1938 break
1939 ;;
1940
1941 esac
1942 done
1943
1944 # :command.command_filter
1945 action="celeryd"
1946
1947 # :command.parse_requirements_while
1948 while [[ $# -gt 0 ]]; do
1949 key="$1"
1950 case "$key" in
1951 # :flag.case
1952 --workdir)
1953
1954 # :flag.case_arg
1955 if [[ -n ${2+x} ]]; then
1956
1957 args['--workdir']="$2"
1958 shift
1959 shift
1960 else
1961 printf "%s\n" "--workdir requires an argument: --workdir WORKDIR" >&2
1962 exit 1
1963 fi
1964 ;;
1965
1966 # :flag.case
1967 --cmd)
1968
1969 # :flag.case_arg
1970 if [[ -n ${2+x} ]]; then
1971
1972 args['--cmd']="$2"
1973 shift
1974 shift
1975 else
1976 printf "%s\n" "--cmd requires an argument: --cmd CMD" >&2
1977 exit 1
1978 fi
1979 ;;
1980
1981 -?*)
1982 printf "invalid option: %s\n" "$key" >&2
1983 exit 1
1984 ;;
1985
1986 *)
1987 # :command.parse_requirements_case
1988 # :command.parse_requirements_case_simple
1989 printf "invalid argument: %s\n" "$key" >&2
1990 exit 1
1991
1992 ;;
1993
1994 esac
1995 done
1996
1997 # :command.default_assignments
1998 [[ -n ${args['--workdir']:-} ]] || args['--workdir']="/home/rhodecode/rhodecode-enterprise-ce"
1999 [[ -n ${args['--cmd']:-} ]] || args['--cmd']=".dev/cmd-celeryd.sh"
2000
1767 }
2001 }
1768
2002
1769 # :command.parse_requirements
2003 # :command.parse_requirements
1770 dev_tools_sshd_parse_requirements() {
2004 dev_tools_sshd_parse_requirements() {
1771 # :command.fixed_flags_filter
2005 # :command.fixed_flags_filter
1772 while [[ $# -gt 0 ]]; do
2006 while [[ $# -gt 0 ]]; do
1773 case "${1:-}" in
2007 case "${1:-}" in
1774 --help | -h)
2008 --help | -h)
1775 long_usage=yes
2009 long_usage=yes
1776 dev_tools_sshd_usage
2010 dev_tools_sshd_usage
1777 exit
2011 exit
1778 ;;
2012 ;;
1779
2013
1780 *)
2014 *)
1781 break
2015 break
1782 ;;
2016 ;;
1783
2017
1784 esac
2018 esac
1785 done
2019 done
1786
2020
1787 # :command.command_filter
2021 # :command.command_filter
1788 action="sshd"
2022 action="sshd"
1789
2023
1790 # :command.parse_requirements_while
2024 # :command.parse_requirements_while
1791 while [[ $# -gt 0 ]]; do
2025 while [[ $# -gt 0 ]]; do
1792 key="$1"
2026 key="$1"
1793 case "$key" in
2027 case "$key" in
1794
2028
1795 -?*)
2029 -?*)
1796 printf "invalid option: %s\n" "$key" >&2
2030 printf "invalid option: %s\n" "$key" >&2
1797 exit 1
2031 exit 1
1798 ;;
2032 ;;
1799
2033
1800 *)
2034 *)
1801 # :command.parse_requirements_case
2035 # :command.parse_requirements_case
1802 # :command.parse_requirements_case_simple
2036 # :command.parse_requirements_case_simple
1803 printf "invalid argument: %s\n" "$key" >&2
2037 printf "invalid argument: %s\n" "$key" >&2
1804 exit 1
2038 exit 1
1805
2039
1806 ;;
2040 ;;
1807
2041
1808 esac
2042 esac
1809 done
2043 done
1810
2044
1811 }
2045 }
1812
2046
1813 # :command.parse_requirements
2047 # :command.parse_requirements
1814 dev_tools_tools_parse_requirements() {
2048 dev_tools_tools_parse_requirements() {
1815 # :command.fixed_flags_filter
2049 # :command.fixed_flags_filter
1816 while [[ $# -gt 0 ]]; do
2050 while [[ $# -gt 0 ]]; do
1817 case "${1:-}" in
2051 case "${1:-}" in
1818 --help | -h)
2052 --help | -h)
1819 long_usage=yes
2053 long_usage=yes
1820 dev_tools_tools_usage
2054 dev_tools_tools_usage
1821 exit
2055 exit
1822 ;;
2056 ;;
1823
2057
1824 *)
2058 *)
1825 break
2059 break
1826 ;;
2060 ;;
1827
2061
1828 esac
2062 esac
1829 done
2063 done
1830
2064
1831 # :command.command_filter
2065 # :command.command_filter
1832 action="tools"
2066 action="tools"
1833
2067
1834 # :command.parse_requirements_while
2068 # :command.parse_requirements_while
1835 while [[ $# -gt 0 ]]; do
2069 while [[ $# -gt 0 ]]; do
1836 key="$1"
2070 key="$1"
1837 case "$key" in
2071 case "$key" in
1838
2072
1839 -?*)
2073 -?*)
1840 printf "invalid option: %s\n" "$key" >&2
2074 printf "invalid option: %s\n" "$key" >&2
1841 exit 1
2075 exit 1
1842 ;;
2076 ;;
1843
2077
1844 *)
2078 *)
1845 # :command.parse_requirements_case
2079 # :command.parse_requirements_case
1846 # :command.parse_requirements_case_simple
2080 # :command.parse_requirements_case_simple
1847 printf "invalid argument: %s\n" "$key" >&2
2081 printf "invalid argument: %s\n" "$key" >&2
1848 exit 1
2082 exit 1
1849
2083
1850 ;;
2084 ;;
1851
2085
1852 esac
2086 esac
1853 done
2087 done
1854
2088
1855 }
2089 }
1856
2090
1857 # :command.parse_requirements
2091 # :command.parse_requirements
1858 dev_tools_dev_env_parse_requirements() {
2092 dev_tools_dev_env_parse_requirements() {
1859 # :command.fixed_flags_filter
2093 # :command.fixed_flags_filter
1860 while [[ $# -gt 0 ]]; do
2094 while [[ $# -gt 0 ]]; do
1861 case "${1:-}" in
2095 case "${1:-}" in
1862 --help | -h)
2096 --help | -h)
1863 long_usage=yes
2097 long_usage=yes
1864 dev_tools_dev_env_usage
2098 dev_tools_dev_env_usage
1865 exit
2099 exit
1866 ;;
2100 ;;
1867
2101
1868 *)
2102 *)
1869 break
2103 break
1870 ;;
2104 ;;
1871
2105
1872 esac
2106 esac
1873 done
2107 done
1874
2108
1875 # :command.command_filter
2109 # :command.command_filter
1876 action="dev-env"
2110 action="dev-env"
1877
2111
1878 # :command.parse_requirements_while
2112 # :command.parse_requirements_while
1879 while [[ $# -gt 0 ]]; do
2113 while [[ $# -gt 0 ]]; do
1880 key="$1"
2114 key="$1"
1881 case "$key" in
2115 case "$key" in
1882
2116
1883 -?*)
2117 -?*)
1884 printf "invalid option: %s\n" "$key" >&2
2118 printf "invalid option: %s\n" "$key" >&2
1885 exit 1
2119 exit 1
1886 ;;
2120 ;;
1887
2121
1888 *)
2122 *)
1889 # :command.parse_requirements_case
2123 # :command.parse_requirements_case
1890 # :command.parse_requirements_case_simple
2124 # :command.parse_requirements_case_simple
1891 printf "invalid argument: %s\n" "$key" >&2
2125 printf "invalid argument: %s\n" "$key" >&2
1892 exit 1
2126 exit 1
1893
2127
1894 ;;
2128 ;;
1895
2129
1896 esac
2130 esac
1897 done
2131 done
1898
2132
1899 }
2133 }
1900
2134
1901 # :command.parse_requirements
2135 # :command.parse_requirements
1902 dev_tools_prune_parse_requirements() {
2136 dev_tools_prune_parse_requirements() {
1903 # :command.fixed_flags_filter
2137 # :command.fixed_flags_filter
1904 while [[ $# -gt 0 ]]; do
2138 while [[ $# -gt 0 ]]; do
1905 case "${1:-}" in
2139 case "${1:-}" in
1906 --help | -h)
2140 --help | -h)
1907 long_usage=yes
2141 long_usage=yes
1908 dev_tools_prune_usage
2142 dev_tools_prune_usage
1909 exit
2143 exit
1910 ;;
2144 ;;
1911
2145
1912 *)
2146 *)
1913 break
2147 break
1914 ;;
2148 ;;
1915
2149
1916 esac
2150 esac
1917 done
2151 done
1918
2152
1919 # :command.command_filter
2153 # :command.command_filter
1920 action="prune"
2154 action="prune"
1921
2155
1922 # :command.parse_requirements_while
2156 # :command.parse_requirements_while
1923 while [[ $# -gt 0 ]]; do
2157 while [[ $# -gt 0 ]]; do
1924 key="$1"
2158 key="$1"
1925 case "$key" in
2159 case "$key" in
1926
2160
1927 -?*)
2161 -?*)
1928 printf "invalid option: %s\n" "$key" >&2
2162 printf "invalid option: %s\n" "$key" >&2
1929 exit 1
2163 exit 1
1930 ;;
2164 ;;
1931
2165
1932 *)
2166 *)
1933 # :command.parse_requirements_case
2167 # :command.parse_requirements_case
1934 # :command.parse_requirements_case_simple
2168 # :command.parse_requirements_case_simple
1935 printf "invalid argument: %s\n" "$key" >&2
2169 printf "invalid argument: %s\n" "$key" >&2
1936 exit 1
2170 exit 1
1937
2171
1938 ;;
2172 ;;
1939
2173
1940 esac
2174 esac
1941 done
2175 done
1942
2176
1943 }
2177 }
1944
2178
1945 # :command.parse_requirements
2179 # :command.parse_requirements
1946 dev_tools_prune_all_parse_requirements() {
2180 dev_tools_prune_all_parse_requirements() {
1947 # :command.fixed_flags_filter
2181 # :command.fixed_flags_filter
1948 while [[ $# -gt 0 ]]; do
2182 while [[ $# -gt 0 ]]; do
1949 case "${1:-}" in
2183 case "${1:-}" in
1950 --help | -h)
2184 --help | -h)
1951 long_usage=yes
2185 long_usage=yes
1952 dev_tools_prune_all_usage
2186 dev_tools_prune_all_usage
1953 exit
2187 exit
1954 ;;
2188 ;;
1955
2189
1956 *)
2190 *)
1957 break
2191 break
1958 ;;
2192 ;;
1959
2193
1960 esac
2194 esac
1961 done
2195 done
1962
2196
1963 # :command.command_filter
2197 # :command.command_filter
1964 action="prune-all"
2198 action="prune-all"
1965
2199
1966 # :command.parse_requirements_while
2200 # :command.parse_requirements_while
1967 while [[ $# -gt 0 ]]; do
2201 while [[ $# -gt 0 ]]; do
1968 key="$1"
2202 key="$1"
1969 case "$key" in
2203 case "$key" in
1970
2204
1971 -?*)
2205 -?*)
1972 printf "invalid option: %s\n" "$key" >&2
2206 printf "invalid option: %s\n" "$key" >&2
1973 exit 1
2207 exit 1
1974 ;;
2208 ;;
1975
2209
1976 *)
2210 *)
1977 # :command.parse_requirements_case
2211 # :command.parse_requirements_case
1978 # :command.parse_requirements_case_simple
2212 # :command.parse_requirements_case_simple
1979 printf "invalid argument: %s\n" "$key" >&2
2213 printf "invalid argument: %s\n" "$key" >&2
1980 exit 1
2214 exit 1
1981
2215
1982 ;;
2216 ;;
1983
2217
1984 esac
2218 esac
1985 done
2219 done
1986
2220
1987 }
2221 }
1988
2222
1989 # :command.parse_requirements
2223 # :command.parse_requirements
1990 dev_tools_cli_generate_pull_parse_requirements() {
2224 dev_tools_cli_generate_pull_parse_requirements() {
1991 # :command.fixed_flags_filter
2225 # :command.fixed_flags_filter
1992 while [[ $# -gt 0 ]]; do
2226 while [[ $# -gt 0 ]]; do
1993 case "${1:-}" in
2227 case "${1:-}" in
1994 --help | -h)
2228 --help | -h)
1995 long_usage=yes
2229 long_usage=yes
1996 dev_tools_cli_generate_pull_usage
2230 dev_tools_cli_generate_pull_usage
1997 exit
2231 exit
1998 ;;
2232 ;;
1999
2233
2000 *)
2234 *)
2001 break
2235 break
2002 ;;
2236 ;;
2003
2237
2004 esac
2238 esac
2005 done
2239 done
2006
2240
2007 # :command.command_filter
2241 # :command.command_filter
2008 action="cli-generate-pull"
2242 action="cli-generate-pull"
2009
2243
2010 # :command.parse_requirements_while
2244 # :command.parse_requirements_while
2011 while [[ $# -gt 0 ]]; do
2245 while [[ $# -gt 0 ]]; do
2012 key="$1"
2246 key="$1"
2013 case "$key" in
2247 case "$key" in
2014
2248
2015 -?*)
2249 -?*)
2016 printf "invalid option: %s\n" "$key" >&2
2250 printf "invalid option: %s\n" "$key" >&2
2017 exit 1
2251 exit 1
2018 ;;
2252 ;;
2019
2253
2020 *)
2254 *)
2021 # :command.parse_requirements_case
2255 # :command.parse_requirements_case
2022 # :command.parse_requirements_case_simple
2256 # :command.parse_requirements_case_simple
2023 printf "invalid argument: %s\n" "$key" >&2
2257 printf "invalid argument: %s\n" "$key" >&2
2024 exit 1
2258 exit 1
2025
2259
2026 ;;
2260 ;;
2027
2261
2028 esac
2262 esac
2029 done
2263 done
2030
2264
2031 }
2265 }
2032
2266
2033 # :command.parse_requirements
2267 # :command.parse_requirements
2034 dev_tools_cli_generate_help_parse_requirements() {
2268 dev_tools_cli_generate_help_parse_requirements() {
2035 # :command.fixed_flags_filter
2269 # :command.fixed_flags_filter
2036 while [[ $# -gt 0 ]]; do
2270 while [[ $# -gt 0 ]]; do
2037 case "${1:-}" in
2271 case "${1:-}" in
2038 --help | -h)
2272 --help | -h)
2039 long_usage=yes
2273 long_usage=yes
2040 dev_tools_cli_generate_help_usage
2274 dev_tools_cli_generate_help_usage
2041 exit
2275 exit
2042 ;;
2276 ;;
2043
2277
2044 *)
2278 *)
2045 break
2279 break
2046 ;;
2280 ;;
2047
2281
2048 esac
2282 esac
2049 done
2283 done
2050
2284
2051 # :command.command_filter
2285 # :command.command_filter
2052 action="cli-generate-help"
2286 action="cli-generate-help"
2053
2287
2054 # :command.parse_requirements_while
2288 # :command.parse_requirements_while
2055 while [[ $# -gt 0 ]]; do
2289 while [[ $# -gt 0 ]]; do
2056 key="$1"
2290 key="$1"
2057 case "$key" in
2291 case "$key" in
2058
2292
2059 -?*)
2293 -?*)
2060 printf "invalid option: %s\n" "$key" >&2
2294 printf "invalid option: %s\n" "$key" >&2
2061 exit 1
2295 exit 1
2062 ;;
2296 ;;
2063
2297
2064 *)
2298 *)
2065 # :command.parse_requirements_case
2299 # :command.parse_requirements_case
2066 # :command.parse_requirements_case_simple
2300 # :command.parse_requirements_case_simple
2067 printf "invalid argument: %s\n" "$key" >&2
2301 printf "invalid argument: %s\n" "$key" >&2
2068 exit 1
2302 exit 1
2069
2303
2070 ;;
2304 ;;
2071
2305
2072 esac
2306 esac
2073 done
2307 done
2074
2308
2075 }
2309 }
2076
2310
2077 # :command.parse_requirements
2311 # :command.parse_requirements
2078 dev_tools_stack_cli_version_parse_requirements() {
2312 dev_tools_stack_cli_version_parse_requirements() {
2079 # :command.fixed_flags_filter
2313 # :command.fixed_flags_filter
2080 while [[ $# -gt 0 ]]; do
2314 while [[ $# -gt 0 ]]; do
2081 case "${1:-}" in
2315 case "${1:-}" in
2082 --help | -h)
2316 --help | -h)
2083 long_usage=yes
2317 long_usage=yes
2084 dev_tools_stack_cli_version_usage
2318 dev_tools_stack_cli_version_usage
2085 exit
2319 exit
2086 ;;
2320 ;;
2087
2321
2088 *)
2322 *)
2089 break
2323 break
2090 ;;
2324 ;;
2091
2325
2092 esac
2326 esac
2093 done
2327 done
2094
2328
2095 # :command.command_filter
2329 # :command.command_filter
2096 action="stack-cli-version"
2330 action="stack-cli-version"
2097
2331
2098 # :command.parse_requirements_while
2332 # :command.parse_requirements_while
2099 while [[ $# -gt 0 ]]; do
2333 while [[ $# -gt 0 ]]; do
2100 key="$1"
2334 key="$1"
2101 case "$key" in
2335 case "$key" in
2102
2336
2103 -?*)
2337 -?*)
2104 printf "invalid option: %s\n" "$key" >&2
2338 printf "invalid option: %s\n" "$key" >&2
2105 exit 1
2339 exit 1
2106 ;;
2340 ;;
2107
2341
2108 *)
2342 *)
2109 # :command.parse_requirements_case
2343 # :command.parse_requirements_case
2110 # :command.parse_requirements_case_simple
2344 # :command.parse_requirements_case_simple
2111 if [[ -z ${args['version']+x} ]]; then
2345 if [[ -z ${args['version']+x} ]]; then
2112
2346
2113 args['version']=$1
2347 args['version']=$1
2114 shift
2348 shift
2115 else
2349 else
2116 printf "invalid argument: %s\n" "$key" >&2
2350 printf "invalid argument: %s\n" "$key" >&2
2117 exit 1
2351 exit 1
2118 fi
2352 fi
2119
2353
2120 ;;
2354 ;;
2121
2355
2122 esac
2356 esac
2123 done
2357 done
2124
2358
2125 # :command.required_args_filter
2359 # :command.required_args_filter
2126 if [[ -z ${args['version']+x} ]]; then
2360 if [[ -z ${args['version']+x} ]]; then
2127 printf "missing required argument: VERSION\nusage: dev-tools stack-cli-version VERSION\n" >&2
2361 printf "missing required argument: VERSION\nusage: dev-tools stack-cli-version VERSION\n" >&2
2128 exit 1
2362 exit 1
2129 fi
2363 fi
2130
2364
2131 }
2365 }
2132
2366
2133 # :command.parse_requirements
2367 # :command.parse_requirements
2134 dev_tools_cli_generate_rc_parse_requirements() {
2368 dev_tools_cli_generate_rc_parse_requirements() {
2135 # :command.fixed_flags_filter
2369 # :command.fixed_flags_filter
2136 while [[ $# -gt 0 ]]; do
2370 while [[ $# -gt 0 ]]; do
2137 case "${1:-}" in
2371 case "${1:-}" in
2138 --help | -h)
2372 --help | -h)
2139 long_usage=yes
2373 long_usage=yes
2140 dev_tools_cli_generate_rc_usage
2374 dev_tools_cli_generate_rc_usage
2141 exit
2375 exit
2142 ;;
2376 ;;
2143
2377
2144 *)
2378 *)
2145 break
2379 break
2146 ;;
2380 ;;
2147
2381
2148 esac
2382 esac
2149 done
2383 done
2150
2384
2151 # :command.command_filter
2385 # :command.command_filter
2152 action="cli-generate-rc"
2386 action="cli-generate-rc"
2153
2387
2154 # :command.parse_requirements_while
2388 # :command.parse_requirements_while
2155 while [[ $# -gt 0 ]]; do
2389 while [[ $# -gt 0 ]]; do
2156 key="$1"
2390 key="$1"
2157 case "$key" in
2391 case "$key" in
2158 # :flag.case
2392 # :flag.case
2159 --one-time | -o)
2393 --one-time | -o)
2160
2394
2161 # :flag.case_no_arg
2395 # :flag.case_no_arg
2162 args['--one-time']=1
2396 args['--one-time']=1
2163 shift
2397 shift
2164 ;;
2398 ;;
2165
2399
2166 -?*)
2400 -?*)
2167 printf "invalid option: %s\n" "$key" >&2
2401 printf "invalid option: %s\n" "$key" >&2
2168 exit 1
2402 exit 1
2169 ;;
2403 ;;
2170
2404
2171 *)
2405 *)
2172 # :command.parse_requirements_case
2406 # :command.parse_requirements_case
2173 # :command.parse_requirements_case_simple
2407 # :command.parse_requirements_case_simple
2174 printf "invalid argument: %s\n" "$key" >&2
2408 printf "invalid argument: %s\n" "$key" >&2
2175 exit 1
2409 exit 1
2176
2410
2177 ;;
2411 ;;
2178
2412
2179 esac
2413 esac
2180 done
2414 done
2181
2415
2182 }
2416 }
2183
2417
2184 # :command.parse_requirements
2418 # :command.parse_requirements
2185 dev_tools_cli_generate_dev_parse_requirements() {
2419 dev_tools_cli_generate_dev_parse_requirements() {
2186 # :command.fixed_flags_filter
2420 # :command.fixed_flags_filter
2187 while [[ $# -gt 0 ]]; do
2421 while [[ $# -gt 0 ]]; do
2188 case "${1:-}" in
2422 case "${1:-}" in
2189 --help | -h)
2423 --help | -h)
2190 long_usage=yes
2424 long_usage=yes
2191 dev_tools_cli_generate_dev_usage
2425 dev_tools_cli_generate_dev_usage
2192 exit
2426 exit
2193 ;;
2427 ;;
2194
2428
2195 *)
2429 *)
2196 break
2430 break
2197 ;;
2431 ;;
2198
2432
2199 esac
2433 esac
2200 done
2434 done
2201
2435
2202 # :command.command_filter
2436 # :command.command_filter
2203 action="cli-generate-dev"
2437 action="cli-generate-dev"
2204
2438
2205 # :command.parse_requirements_while
2439 # :command.parse_requirements_while
2206 while [[ $# -gt 0 ]]; do
2440 while [[ $# -gt 0 ]]; do
2207 key="$1"
2441 key="$1"
2208 case "$key" in
2442 case "$key" in
2209 # :flag.case
2443 # :flag.case
2210 --one-time | -o)
2444 --one-time | -o)
2211
2445
2212 # :flag.case_no_arg
2446 # :flag.case_no_arg
2213 args['--one-time']=1
2447 args['--one-time']=1
2214 shift
2448 shift
2215 ;;
2449 ;;
2216
2450
2217 -?*)
2451 -?*)
2218 printf "invalid option: %s\n" "$key" >&2
2452 printf "invalid option: %s\n" "$key" >&2
2219 exit 1
2453 exit 1
2220 ;;
2454 ;;
2221
2455
2222 *)
2456 *)
2223 # :command.parse_requirements_case
2457 # :command.parse_requirements_case
2224 # :command.parse_requirements_case_simple
2458 # :command.parse_requirements_case_simple
2225 printf "invalid argument: %s\n" "$key" >&2
2459 printf "invalid argument: %s\n" "$key" >&2
2226 exit 1
2460 exit 1
2227
2461
2228 ;;
2462 ;;
2229
2463
2230 esac
2464 esac
2231 done
2465 done
2232
2466
2233 }
2467 }
2234
2468
2235 # :command.parse_requirements
2469 # :command.parse_requirements
2236 dev_tools_get_build_artifacts_parse_requirements() {
2470 dev_tools_get_build_artifacts_parse_requirements() {
2237 # :command.fixed_flags_filter
2471 # :command.fixed_flags_filter
2238 while [[ $# -gt 0 ]]; do
2472 while [[ $# -gt 0 ]]; do
2239 case "${1:-}" in
2473 case "${1:-}" in
2240 --help | -h)
2474 --help | -h)
2241 long_usage=yes
2475 long_usage=yes
2242 dev_tools_get_build_artifacts_usage
2476 dev_tools_get_build_artifacts_usage
2243 exit
2477 exit
2244 ;;
2478 ;;
2245
2479
2246 *)
2480 *)
2247 break
2481 break
2248 ;;
2482 ;;
2249
2483
2250 esac
2484 esac
2251 done
2485 done
2252
2486
2253 # :command.command_filter
2487 # :command.command_filter
2254 action="get-build-artifacts"
2488 action="get-build-artifacts"
2255
2489
2256 # :command.parse_requirements_while
2490 # :command.parse_requirements_while
2257 while [[ $# -gt 0 ]]; do
2491 while [[ $# -gt 0 ]]; do
2258 key="$1"
2492 key="$1"
2259 case "$key" in
2493 case "$key" in
2260 # :flag.case
2494 # :flag.case
2261 --auth)
2495 --auth)
2262
2496
2263 # :flag.case_arg
2497 # :flag.case_arg
2264 if [[ -n ${2+x} ]]; then
2498 if [[ -n ${2+x} ]]; then
2265
2499
2266 args['--auth']="$2"
2500 args['--auth']="$2"
2267 shift
2501 shift
2268 shift
2502 shift
2269 else
2503 else
2270 printf "%s\n" "--auth requires an argument: --auth AUTH" >&2
2504 printf "%s\n" "--auth requires an argument: --auth AUTH" >&2
2271 exit 1
2505 exit 1
2272 fi
2506 fi
2273 ;;
2507 ;;
2274
2508
2275 # :flag.case
2509 # :flag.case
2276 --installer-url)
2510 --installer-url)
2277
2511
2278 # :flag.case_arg
2512 # :flag.case_arg
2279 if [[ -n ${2+x} ]]; then
2513 if [[ -n ${2+x} ]]; then
2280
2514
2281 args['--installer-url']="$2"
2515 args['--installer-url']="$2"
2282 shift
2516 shift
2283 shift
2517 shift
2284 else
2518 else
2285 printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2
2519 printf "%s\n" "--installer-url requires an argument: --installer-url INSTALLER_URL" >&2
2286 exit 1
2520 exit 1
2287 fi
2521 fi
2288 ;;
2522 ;;
2289
2523
2290 # :flag.case
2524 # :flag.case
2291 --manifest-url)
2525 --manifest-url)
2292
2526
2293 # :flag.case_arg
2527 # :flag.case_arg
2294 if [[ -n ${2+x} ]]; then
2528 if [[ -n ${2+x} ]]; then
2295
2529
2296 args['--manifest-url']="$2"
2530 args['--manifest-url']="$2"
2297 shift
2531 shift
2298 shift
2532 shift
2299 else
2533 else
2300 printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2
2534 printf "%s\n" "--manifest-url requires an argument: --manifest-url MANIFEST_URL" >&2
2301 exit 1
2535 exit 1
2302 fi
2536 fi
2303 ;;
2537 ;;
2304
2538
2305 # :flag.case
2539 # :flag.case
2306 --version-name)
2540 --version-name)
2307
2541
2308 # :flag.case_arg
2542 # :flag.case_arg
2309 if [[ -n ${2+x} ]]; then
2543 if [[ -n ${2+x} ]]; then
2310
2544
2311 args['--version-name']="$2"
2545 args['--version-name']="$2"
2312 shift
2546 shift
2313 shift
2547 shift
2314 else
2548 else
2315 printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
2549 printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
2316 exit 1
2550 exit 1
2317 fi
2551 fi
2318 ;;
2552 ;;
2319
2553
2320 -?*)
2554 -?*)
2321 printf "invalid option: %s\n" "$key" >&2
2555 printf "invalid option: %s\n" "$key" >&2
2322 exit 1
2556 exit 1
2323 ;;
2557 ;;
2324
2558
2325 *)
2559 *)
2326 # :command.parse_requirements_case
2560 # :command.parse_requirements_case
2327 # :command.parse_requirements_case_simple
2561 # :command.parse_requirements_case_simple
2328 printf "invalid argument: %s\n" "$key" >&2
2562 printf "invalid argument: %s\n" "$key" >&2
2329 exit 1
2563 exit 1
2330
2564
2331 ;;
2565 ;;
2332
2566
2333 esac
2567 esac
2334 done
2568 done
2335
2569
2336 # :command.default_assignments
2570 # :command.default_assignments
2337 [[ -n ${args['--auth']:-} ]] || args['--auth']=""
2571 [[ -n ${args['--auth']:-} ]] || args['--auth']=""
2338 [[ -n ${args['--installer-url']:-} ]] || args['--installer-url']="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee"
2572 [[ -n ${args['--installer-url']:-} ]] || args['--installer-url']="https://dls.rhodecode.com/dls/N2E2ZTY1NzA3NjYxNDA2NTc1NjI3MTcyNzA2MjcxNzIyZTcwNjI3YQ==/rhodecode-control/latest-linux-ee"
2339 [[ -n ${args['--manifest-url']:-} ]] || args['--manifest-url']="https://dls.rhodecode.com/linux/MANIFEST"
2573 [[ -n ${args['--manifest-url']:-} ]] || args['--manifest-url']="https://dls.rhodecode.com/linux/MANIFEST"
2340 [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
2574 [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
2341
2575
2342 }
2576 }
2343
2577
2344 # :command.parse_requirements
2578 # :command.parse_requirements
2345 dev_tools_build_installer_parse_requirements() {
2579 dev_tools_build_installer_parse_requirements() {
2346 # :command.fixed_flags_filter
2580 # :command.fixed_flags_filter
2347 while [[ $# -gt 0 ]]; do
2581 while [[ $# -gt 0 ]]; do
2348 case "${1:-}" in
2582 case "${1:-}" in
2349 --help | -h)
2583 --help | -h)
2350 long_usage=yes
2584 long_usage=yes
2351 dev_tools_build_installer_usage
2585 dev_tools_build_installer_usage
2352 exit
2586 exit
2353 ;;
2587 ;;
2354
2588
2355 *)
2589 *)
2356 break
2590 break
2357 ;;
2591 ;;
2358
2592
2359 esac
2593 esac
2360 done
2594 done
2361
2595
2362 # :command.command_filter
2596 # :command.command_filter
2363 action="build-installer"
2597 action="build-installer"
2364
2598
2365 # :command.parse_requirements_while
2599 # :command.parse_requirements_while
2366 while [[ $# -gt 0 ]]; do
2600 while [[ $# -gt 0 ]]; do
2367 key="$1"
2601 key="$1"
2368 case "$key" in
2602 case "$key" in
2369 # :flag.case
2603 # :flag.case
2370 --version-name)
2604 --version-name)
2371
2605
2372 # :flag.case_arg
2606 # :flag.case_arg
2373 if [[ -n ${2+x} ]]; then
2607 if [[ -n ${2+x} ]]; then
2374
2608
2375 args['--version-name']="$2"
2609 args['--version-name']="$2"
2376 shift
2610 shift
2377 shift
2611 shift
2378 else
2612 else
2379 printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
2613 printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
2380 exit 1
2614 exit 1
2381 fi
2615 fi
2382 ;;
2616 ;;
2383
2617
2384 -?*)
2618 -?*)
2385 printf "invalid option: %s\n" "$key" >&2
2619 printf "invalid option: %s\n" "$key" >&2
2386 exit 1
2620 exit 1
2387 ;;
2621 ;;
2388
2622
2389 *)
2623 *)
2390 # :command.parse_requirements_case
2624 # :command.parse_requirements_case
2391 # :command.parse_requirements_case_simple
2625 # :command.parse_requirements_case_simple
2392 printf "invalid argument: %s\n" "$key" >&2
2626 printf "invalid argument: %s\n" "$key" >&2
2393 exit 1
2627 exit 1
2394
2628
2395 ;;
2629 ;;
2396
2630
2397 esac
2631 esac
2398 done
2632 done
2399
2633
2400 # :command.default_assignments
2634 # :command.default_assignments
2401 [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
2635 [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
2402
2636
2403 }
2637 }
2404
2638
2405 # :command.parse_requirements
2639 # :command.parse_requirements
2406 dev_tools_get_build_source_parse_requirements() {
2640 dev_tools_get_build_source_parse_requirements() {
2407 # :command.fixed_flags_filter
2641 # :command.fixed_flags_filter
2408 while [[ $# -gt 0 ]]; do
2642 while [[ $# -gt 0 ]]; do
2409 case "${1:-}" in
2643 case "${1:-}" in
2410 --help | -h)
2644 --help | -h)
2411 long_usage=yes
2645 long_usage=yes
2412 dev_tools_get_build_source_usage
2646 dev_tools_get_build_source_usage
2413 exit
2647 exit
2414 ;;
2648 ;;
2415
2649
2416 *)
2650 *)
2417 break
2651 break
2418 ;;
2652 ;;
2419
2653
2420 esac
2654 esac
2421 done
2655 done
2422
2656
2423 # :command.dependencies_filter
2657 # :command.dependencies_filter
2424 if command -v curl >/dev/null 2>&1; then
2658 if command -v curl >/dev/null 2>&1; then
2425 deps['curl']="$(command -v curl | head -n1)"
2659 deps['curl']="$(command -v curl | head -n1)"
2426 else
2660 else
2427 printf "missing dependency: curl\n" >&2
2661 printf "missing dependency: curl\n" >&2
2428 exit 1
2662 exit 1
2429 fi
2663 fi
2430
2664
2431 if command -v tar >/dev/null 2>&1; then
2665 if command -v tar >/dev/null 2>&1; then
2432 deps['tar']="$(command -v tar | head -n1)"
2666 deps['tar']="$(command -v tar | head -n1)"
2433 else
2667 else
2434 printf "missing dependency: tar\n" >&2
2668 printf "missing dependency: tar\n" >&2
2435 exit 1
2669 exit 1
2436 fi
2670 fi
2437
2671
2438 # :command.command_filter
2672 # :command.command_filter
2439 action="get-build-source"
2673 action="get-build-source"
2440
2674
2441 # :command.parse_requirements_while
2675 # :command.parse_requirements_while
2442 while [[ $# -gt 0 ]]; do
2676 while [[ $# -gt 0 ]]; do
2443 key="$1"
2677 key="$1"
2444 case "$key" in
2678 case "$key" in
2445 # :flag.case
2679 # :flag.case
2446 --revision)
2680 --revision)
2447
2681
2448 # :flag.case_arg
2682 # :flag.case_arg
2449 if [[ -n ${2+x} ]]; then
2683 if [[ -n ${2+x} ]]; then
2450
2684
2451 args['--revision']="$2"
2685 args['--revision']="$2"
2452 shift
2686 shift
2453 shift
2687 shift
2454 else
2688 else
2455 printf "%s\n" "--revision requires an argument: --revision REVISION" >&2
2689 printf "%s\n" "--revision requires an argument: --revision REVISION" >&2
2456 exit 1
2690 exit 1
2457 fi
2691 fi
2458 ;;
2692 ;;
2459
2693
2460 # :flag.case
2694 # :flag.case
2461 --auth-token)
2695 --auth-token)
2462
2696
2463 # :flag.case_arg
2697 # :flag.case_arg
2464 if [[ -n ${2+x} ]]; then
2698 if [[ -n ${2+x} ]]; then
2465
2699
2466 args['--auth-token']="$2"
2700 args['--auth-token']="$2"
2467 shift
2701 shift
2468 shift
2702 shift
2469 else
2703 else
2470 printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2
2704 printf "%s\n" "--auth-token requires an argument: --auth-token AUTH_TOKEN" >&2
2471 exit 1
2705 exit 1
2472 fi
2706 fi
2473 ;;
2707 ;;
2474
2708
2475 # :flag.case
2709 # :flag.case
2476 --server-url)
2710 --server-url)
2477
2711
2478 # :flag.case_arg
2712 # :flag.case_arg
2479 if [[ -n ${2+x} ]]; then
2713 if [[ -n ${2+x} ]]; then
2480
2714
2481 args['--server-url']="$2"
2715 args['--server-url']="$2"
2482 shift
2716 shift
2483 shift
2717 shift
2484 else
2718 else
2485 printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2
2719 printf "%s\n" "--server-url requires an argument: --server-url SERVER_URL" >&2
2486 exit 1
2720 exit 1
2487 fi
2721 fi
2488 ;;
2722 ;;
2489
2723
2490 -?*)
2724 -?*)
2491 printf "invalid option: %s\n" "$key" >&2
2725 printf "invalid option: %s\n" "$key" >&2
2492 exit 1
2726 exit 1
2493 ;;
2727 ;;
2494
2728
2495 *)
2729 *)
2496 # :command.parse_requirements_case
2730 # :command.parse_requirements_case
2497 # :command.parse_requirements_case_simple
2731 # :command.parse_requirements_case_simple
2498 printf "invalid argument: %s\n" "$key" >&2
2732 printf "invalid argument: %s\n" "$key" >&2
2499 exit 1
2733 exit 1
2500
2734
2501 ;;
2735 ;;
2502
2736
2503 esac
2737 esac
2504 done
2738 done
2505
2739
2506 # :command.default_assignments
2740 # :command.default_assignments
2507 [[ -n ${args['--revision']:-} ]] || args['--revision']="default"
2741 [[ -n ${args['--revision']:-} ]] || args['--revision']="default"
2508 [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com"
2742 [[ -n ${args['--server-url']:-} ]] || args['--server-url']="https://code.rhodecode.com"
2509
2743
2510 }
2744 }
2511
2745
2512 # :command.parse_requirements
2746 # :command.parse_requirements
2513 dev_tools_build_source_parse_requirements() {
2747 dev_tools_build_source_parse_requirements() {
2514 # :command.fixed_flags_filter
2748 # :command.fixed_flags_filter
2515 while [[ $# -gt 0 ]]; do
2749 while [[ $# -gt 0 ]]; do
2516 case "${1:-}" in
2750 case "${1:-}" in
2517 --help | -h)
2751 --help | -h)
2518 long_usage=yes
2752 long_usage=yes
2519 dev_tools_build_source_usage
2753 dev_tools_build_source_usage
2520 exit
2754 exit
2521 ;;
2755 ;;
2522
2756
2523 *)
2757 *)
2524 break
2758 break
2525 ;;
2759 ;;
2526
2760
2527 esac
2761 esac
2528 done
2762 done
2529
2763
2530 # :command.command_filter
2764 # :command.command_filter
2531 action="build-source"
2765 action="build-source"
2532
2766
2533 # :command.parse_requirements_while
2767 # :command.parse_requirements_while
2534 while [[ $# -gt 0 ]]; do
2768 while [[ $# -gt 0 ]]; do
2535 key="$1"
2769 key="$1"
2536 case "$key" in
2770 case "$key" in
2537 # :flag.case
2771 # :flag.case
2538 --version-name)
2772 --version-name)
2539
2773
2540 # :flag.case_arg
2774 # :flag.case_arg
2541 if [[ -n ${2+x} ]]; then
2775 if [[ -n ${2+x} ]]; then
2542
2776
2543 args['--version-name']="$2"
2777 args['--version-name']="$2"
2544 shift
2778 shift
2545 shift
2779 shift
2546 else
2780 else
2547 printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
2781 printf "%s\n" "--version-name requires an argument: --version-name VERSION_NAME" >&2
2548 exit 1
2782 exit 1
2549 fi
2783 fi
2550 ;;
2784 ;;
2551
2785
2552 # :flag.case
2786 # :flag.case
2553 --source-build-yaml)
2787 --source-build-yaml)
2554
2788
2555 # :flag.case_arg
2789 # :flag.case_arg
2556 if [[ -n ${2+x} ]]; then
2790 if [[ -n ${2+x} ]]; then
2557
2791
2558 args['--source-build-yaml']="$2"
2792 args['--source-build-yaml']="$2"
2559 shift
2793 shift
2560 shift
2794 shift
2561 else
2795 else
2562 printf "%s\n" "--source-build-yaml requires an argument: --source-build-yaml BUILD_SOURCE_YAML" >&2
2796 printf "%s\n" "--source-build-yaml requires an argument: --source-build-yaml BUILD_SOURCE_YAML" >&2
2563 exit 1
2797 exit 1
2564 fi
2798 fi
2565 ;;
2799 ;;
2566
2800
2567 # :flag.case
2801 # :flag.case
2568 --tag)
2802 --tag)
2569
2803
2570 # :flag.case_arg
2804 # :flag.case_arg
2571 if [[ -n ${2+x} ]]; then
2805 if [[ -n ${2+x} ]]; then
2572
2806
2573 if [[ -z ${args['--tag']+x} ]]; then
2807 if [[ -z ${args['--tag']+x} ]]; then
2574 args['--tag']="\"$2\""
2808 args['--tag']="\"$2\""
2575 else
2809 else
2576 args['--tag']="${args[--tag]} \"$2\""
2810 args['--tag']="${args[--tag]} \"$2\""
2577 fi
2811 fi
2578 shift
2812 shift
2579 shift
2813 shift
2580 else
2814 else
2581 printf "%s\n" "--tag requires an argument: --tag TAG" >&2
2815 printf "%s\n" "--tag requires an argument: --tag TAG" >&2
2582 exit 1
2816 exit 1
2583 fi
2817 fi
2584 ;;
2818 ;;
2585
2819
2586 -?*)
2820 -?*)
2587 printf "invalid option: %s\n" "$key" >&2
2821 printf "invalid option: %s\n" "$key" >&2
2588 exit 1
2822 exit 1
2589 ;;
2823 ;;
2590
2824
2591 *)
2825 *)
2592 # :command.parse_requirements_case
2826 # :command.parse_requirements_case
2593 # :command.parse_requirements_case_simple
2827 # :command.parse_requirements_case_simple
2594 printf "invalid argument: %s\n" "$key" >&2
2828 printf "invalid argument: %s\n" "$key" >&2
2595 exit 1
2829 exit 1
2596
2830
2597 ;;
2831 ;;
2598
2832
2599 esac
2833 esac
2600 done
2834 done
2601
2835
2602 # :command.default_assignments
2836 # :command.default_assignments
2603 [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
2837 [[ -n ${args['--version-name']:-} ]] || args['--version-name']="$RC_CLI_VERSION_NAME"
2604 [[ -n ${args['--source-build-yaml']:-} ]] || args['--source-build-yaml']="build_yaml/docker-compose-apps.5.yaml"
2838 [[ -n ${args['--source-build-yaml']:-} ]] || args['--source-build-yaml']="build_yaml/docker-compose-apps.5.yaml"
2605
2839
2606 }
2840 }
2607
2841
2608 # :command.initialize
2842 # :command.initialize
2609 initialize() {
2843 initialize() {
2610 version="1.0.0"
2844 version="1.0.0"
2611 long_usage=''
2845 long_usage=''
2612 set -e
2846 set -e
2613
2847
2614 # src/initialize.sh
2848 # src/initialize.sh
2615
2849
2616 bashly_image="dannyben/bashly:1.0.8"
2850 bashly_image="dannyben/bashly:1.0.8"
2617 }
2851 }
2618
2852
2619 # :command.run
2853 # :command.run
2620 run() {
2854 run() {
2621 declare -A args=()
2855 declare -A args=()
2622 declare -A deps=()
2856 declare -A deps=()
2623 declare -a other_args=()
2857 declare -a other_args=()
2624 declare -a input=()
2858 declare -a input=()
2625 normalize_input "$@"
2859 normalize_input "$@"
2626 parse_requirements "${input[@]}"
2860 parse_requirements "${input[@]}"
2627
2861
2628 case "$action" in
2862 case "$action" in
2629 "vcs") dev_tools_vcs_command ;;
2863 "vcs") dev_tools_vcs_command ;;
2630 "ee") dev_tools_ee_command ;;
2864 "ee") dev_tools_ee_command ;;
2631 "ce") dev_tools_ce_command ;;
2865 "ce") dev_tools_ce_command ;;
2632 "svn") dev_tools_svn_command ;;
2866 "svn") dev_tools_svn_command ;;
2633 "celery") dev_tools_celery_command ;;
2867 "celery") dev_tools_celery_command ;;
2868 "celeryd") dev_tools_celeryd_command ;;
2634 "sshd") dev_tools_sshd_command ;;
2869 "sshd") dev_tools_sshd_command ;;
2635 "tools") dev_tools_tools_command ;;
2870 "tools") dev_tools_tools_command ;;
2636 "dev-env") dev_tools_dev_env_command ;;
2871 "dev-env") dev_tools_dev_env_command ;;
2637 "prune") dev_tools_prune_command ;;
2872 "prune") dev_tools_prune_command ;;
2638 "prune-all") dev_tools_prune_all_command ;;
2873 "prune-all") dev_tools_prune_all_command ;;
2639 "cli-generate-pull") dev_tools_cli_generate_pull_command ;;
2874 "cli-generate-pull") dev_tools_cli_generate_pull_command ;;
2640 "cli-generate-help") dev_tools_cli_generate_help_command ;;
2875 "cli-generate-help") dev_tools_cli_generate_help_command ;;
2641 "stack-cli-version") dev_tools_stack_cli_version_command ;;
2876 "stack-cli-version") dev_tools_stack_cli_version_command ;;
2642 "cli-generate-rc") dev_tools_cli_generate_rc_command ;;
2877 "cli-generate-rc") dev_tools_cli_generate_rc_command ;;
2643 "cli-generate-dev") dev_tools_cli_generate_dev_command ;;
2878 "cli-generate-dev") dev_tools_cli_generate_dev_command ;;
2644 "get-build-artifacts") dev_tools_get_build_artifacts_command ;;
2879 "get-build-artifacts") dev_tools_get_build_artifacts_command ;;
2645 "build-installer") dev_tools_build_installer_command ;;
2880 "build-installer") dev_tools_build_installer_command ;;
2646 "get-build-source") dev_tools_get_build_source_command ;;
2881 "get-build-source") dev_tools_get_build_source_command ;;
2647 "build-source") dev_tools_build_source_command ;;
2882 "build-source") dev_tools_build_source_command ;;
2648 esac
2883 esac
2649 }
2884 }
2650
2885
2651 initialize
2886 initialize
2652 run "$@"
2887 run "$@"
General Comments 0
You need to be logged in to leave comments. Login now