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