-
Notifications
You must be signed in to change notification settings - Fork 0
/
bttb.sh
executable file
·815 lines (648 loc) · 29.2 KB
/
bttb.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
#!/bin/bash
## -----------------------------------------------------------------------
## Intent: This script will tag and branch repositories for release.
## o Actions are per-repository: two are branch-tag else tag-branch
## o branch-tag repositories:
## voltha-helm-charts
## voltha-system-tests
## o tag-branch everything else
## -----------------------------------------------------------------------
EDITOR="${EDITOR:-/usr/bin/emacs}"
# repo:onf-scripts
case "$USER" in
joey)
source /sandbox/onf-common/common.sh '--common-args-begin--'
~/etc/cleanup
;;
*) set -euo pipefail ;;
esac
pgm_root="$(realpath "${BASH_SOURCE[0]%/*}")"
cd "$pgm_root"
sandbox_root="$pgm_root/sandbox"
readonly sandbox_root
actions_lib="$pgm_root/bttb/actions"
readonly actions_lib
export actions_lib # for standalone scripts
# echo "** SIGNPOST[LINENO=$LINENO]: Module loading: ENTER"
source "${pgm_root}/bttb/strings.sh"
source "${pgm_root}/bttb/utils.sh"
source "${pgm_root}/bttb/getopt.sh"
source "${pgm_root}/bttb/detect.sh"
source "${pgm_root}/bttb/detect/sandbox.sh"
source "${pgm_root}/bttb/get_tag.sh"
source "${pgm_root}/bttb/branch.sh"
source "${pgm_root}/bttb/commit/gen_message.sh"
source "${pgm_root}/bttb/gitreview.sh"
source "${pgm_root}/bttb/repository/utils.sh"
source "${pgm_root}/bttb/tag.sh"
#echo "** SIGNPOST[LINENO=$LINENO]: Module loading: LEAVE"
source "${pgm_root}/bttb/VERSION.sh"
source "${pgm_root}/bttb/globals.sh"
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
function do_continue()
{
echo
echo -en "$* (Continue ?)"
local ans
read ans
return
}
## -----------------------------------------------------------------------
## Intent: Parse case value and extract argument string
## -----------------------------------------------------------------------
function get_param_val()
{
# local -n ref=$1 ; shift
local tmp="$1" ; shift
[[ $# -eq 0 ]] && { error "${FUNCNAME}::$LINENO: At least one return variable required"; }
tmp="${tmp//[[:blank:]]}" # trim whitespace
# Split action: switch={val1}={val2} into tokens
readarray -d'=' -t gpv_fields < <(printf '%s' "$tmp")
local idx
for idx in $(seq 1 $#); do
local -n ref=$1; shift
ref="${gpv_fields[$idx]}"
done
return
# ref="${gpv_fields[1]}"
}
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
function show_pwd()
{
cat <<EOM
** -----------------------------------------------------------------------
** IAM: ${FUNCNAME[1]}
** PWD: $(/bin/pwd)
** -----------------------------------------------------------------------
EOM
}
## -----------------------------------------------------------------------
## Intent: Display program usage
## -----------------------------------------------------------------------
function usage()
{
cat <<EOH
Usage: $0
--help Show program usage
--action
--clean Remove sandbox/voltha-protos
--gerrit Load gerrit tag and branch pages for repo
(specify early on command line!)
--edit Modify release notes and update howto/release/repo
--repo [r] Repository name to branch
--sandbox [s] Path to parent directory for repository clones
voltha-release/sandbox/
--version [v] VOTLHA version (2.11 2.12) to create
[ACTION]
docs voltha.docs: edit repo release HOWTO.
gitreview Update branch in the .gitreview file.
gerrit-urls-* Edit/view branch and tag screen(s) prior to checkout
gerrit-urls-tag-branch
graph
rebase
review NYI
show-annotation
show-go-mod Display go.mod opencord version dependencies
[BT,TB}] ordered actions based on repo: branch-tag OR tag-branch
BT-create-tag
TB-create-tag create bttb type tag-branch
BT-create-branch
TB-create-branch create bttb type branch-tag
BT-edit-annotation
TB-edit-annotation
[MODE]
--version Enable script verbose mode
[SHOW]
--show-annotation [tag]
% bttb.sh --repo voltha-protos --version 2.12
# Kitchen sink
% bttb.sh --clean --edit --gerrit --sandbox './sandbox' --repo voltha-go --version 2.12
EOH
declare -a args=()
args+=('--repo' 'voltha-protos')
args+=('--version' '2.12')
echo "% $0 ${args[@]}"
return
}
##----------------##
##---] MAIN [---##
##----------------##
# echo "** SIGNPOST[LINENO=$LINENO]: getopt_argv: ENTER"
getopt_argv "$@"
validate_argv
# echo "** SIGNPOST[LINENO=$LINENO]: getopt_argv: LEAVE"
## --------------------------
## Resolve sandbox path early
## --------------------------
declare -g sandbox=
get_sandbox_abspath sandbox argv_sandbox
## ---------------------------------
## Required for per-repository edits
## ---------------------------------
declare -a git_status=()
git_status+=("$argv_sandbox/voltha-docs")
[[ -v argv_clean ]] && { /bin/rm -fr "$argv_sandbox/voltha-docs"; }
ver="${argv_version}" # backward compatibility -- FIXME, remove
release_name="${argv_version}"
branch=''
tag=''
declare -a repos=("${argv_repos[@]}")
# echo "** SIGNPOST[LINENO=$LINENO]: Iterate over repos"
for repo in "${repos[@]}";
do
global_set 'repository' "$repo"
# global_get foo 'repository'
# get_tag "$ver" tagname
# global_set 'tagname' "$tagname"
banner "$LINENO" "Releasing repository: $repo"
## Order is important:
## [0] checkout
## [1] TB-create -or- BT-create
[[ "${#actions[@]}" -eq 0 ]] \
&& detect_actions "$repo" actions
echo "ACTIONS: $(declare -p actions \
| tr '"' '\n' \
| grep -v -e 'declare -p' \
| grep '^[a-zA-Z]'\
| sed -e 's/^/\t/' \
)"
for action in "${actions[@]}";
do
func_echo "(LINENO:$LINENO) action=[$action], repo=[$repo]"
logfile="${argv_logdir}/${action}.log"
declare -p logfile
# pushd "$repo" >/dev/null
pushd "$sandbox_repo" >/dev/null \
|| { error "pushd $sandbox_repo failed"; }
case "$action" in
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
'create-branch='*)
banner "$LINENO" "ACTION: $action"
(
declare CRB_dev
declare CRB_branch
get_param_val "$action" CRB_dev CRB_branch
func_echo "(LINENO:$LINENO) $(declare -p CRB_dev) $(declare -p CRB_branch)"
git checkout -b "${CRB_dev}" "${CRB_branch}"
# git checkout -b "dev-${USER}" "$branch"
echo
git log --graph --decorate --oneline | head -n 2
) 2>&1 | tee "$logfile"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
'checkout-branch='*)
banner "$LINENO" "ACTION: $action"
# (
declare CRB_dev
declare CRB_branch
get_param_val "$action" CRB_dev CRB_branch
func_echo "(LINENO:$LINENO) $(declare -p CRB_dev) $(declare -p CRB_branch)"
# With CRB_branch passed -- can validate remote origin branch
git checkout "${CRB_dev}"
echo
git log --graph --decorate --oneline | head -n 2
# ) 2>&1 | tee "$logfile"
func_echo "Return from [$action] (LINENO:$LINENO)"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
'release-commit='*)
banner "$LINENO" "ACTION: $action"
# (
declare RC_branch
declare RC_message
get_param_val "$action" RC_branch RC_message
func_echo "(LINENO:$LINENO) $(declare -p RC_branch)"
func_echo "(LINENO:$LINENO) $(declare -p RC_message)"
if [[ -f "$RC_message" ]]; then
echo "CM EXISTS: $RC_message"
else
errror "CM MIA: $RC_message"
fi
echo
func_echo "COMMIT: ENTER"
git commit -F "$RC_message"
git status
func_echo "COMMIT: LEAVE"
# ) 2>&1 | tee "$logfile"
func_echo "Return from [$action] (LINENO:$LINENO)"
set +x
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
'git-graph='*)
banner "$LINENO" "ACTION: $action"
declare GG_branch
get_param_val "$action" GG_branch
func_echo "(LINENO:$LINENO) $(declare -p GG_branch)"
(
echo
git branch -a
echo
git log --graph --decorate --oneline | head -n2
) 2>&1 | tee -a "$logfile"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
logit)
banner "$LINENO" "ACTION: $action"
logfile="${argv_logdir}/logit.$(date '+%H%M%s').log"
(
echo
git log --graph --decorate --oneline | head -n 5
echo
git status
echo
git diff
) 2>&1 | tee "$logfile"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
checkout)
banner "$LINENO" "ACTION: $action"
declare -a args=()
args+=('--sandbox' "$sandbox")
args+=('--repo' "$repo")
"$actions_lib/checkout.sh" "${args[@]}"
sandbox_repo="$sandbox_root/$repo"
continue # action='nop'
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
detect-branch-tag-vars)
banner "$LINENO" "ACTION: $action"
detect_branch_tag "$repo" "$ver" branch tag
branch_name="$branch"
tag_name="$tag"
global_set 'branch_name' "$branch_name"
# global_set 'tag_name' "$tag_name"
if true; then
func_echo "Gathered git values"
declare -p branch_name
declare -p tag_name
declare -p tag
declare -p branch
declare -p ver
fi
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
docs)
banner "$LINENO" "ACTION: $action"
func_echo "[SKIP] $action (manually disabled)"
if false; then
declare -a args=()
args+=('--debug')
args+=('--repo' "$repo")
args+=('--sandbox' "$sandbox")
args+=('--branch' "$branch")
"$actions_lib/docs.sh" "${args[@]}"
fi
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
'edit-VERSION='*)
banner "$LINENO" "ACTION: $action"
(
declare EV_type
declare EV_branch
get_param_val "$action" EV_type EV_branch
func_echo "(LINENO:$LINENO) $(declare -p EV_type) $(declare -p EV_branch)"
declare -a args=()
args+=("$EV_branch")
if [[ -v argv_release_version ]]; then
args+=("$argv_release_version")
if [[ -v argv_developer_version ]]; then
args+=("$argv_developer_version")
else
error "--dev-ver is required"
fi
fi
# func_echo "(LINENO:$LINENO) $(declare -p EV_branch)"
func_echo "(LINENO:$LINENO) $(declare -p args)"
edit_VERSION "${args[@]}"
)
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
'edit-jira='*)
banner "$LINENO" "ACTION: $action"
declare tmp='jira_tickets.tmp'
if true; then
declare EJ_type
declare EJ_branch_name
get_param_val "$action" EJ_type EJ_branch_name
func_echo "(LINENO:$LINENO) $(declare -p EJ_type EJ_branch_name)"
else
# <FIXME> -- val unused
declare val=''
get_param_val "$action" val
func_echo "(LINENO:$LINENO) $(declare -p val)"
# </FIXME>
declare EJ_branch_name=''
global_get EJ_branch_name 'branch_name'
declare -p EJ_branch_name
fi
if [[ ! -v argv_jiras ]]; then
echo "** Enter a list of --jira tickets for patch creation"
declare -g -a jiras
"${EDITOR:-/usr/bin/emacs}" "$tmp"
touch "$tmp"
readarray -t jiras <"tmp"
rm -f "$tmp"
declare -g -r argv_jiras=("${jiras[@]}")
fi
if false; then
[[ ${#repo} -eq 0 ]] && { error "repo= is empty"; }
if [[ ${#jiras[@]} -gt 0 ]]; then
declare gcm_args=()
declare msgdir="$argv_commit_message_dir"
declare prefix="${msgdir}/commit.${repo}"
declare commit_master="${prefix}.master"
# declare commit_release="${prefix}.${branch_name:-UNKNOWN}"
declare branch_name="${EJ_branch_name:-UNKNOWN}"
declare commit_release="${prefix}.${branch_name}"
gcm_args+=("$commit_master")
gcm_args+=("$commit_release")
gcm_args+=("$repo")
gcm_args+=("$branch_name")
# gcm_args+=(jiras)
gen_commit_message "${gcm_args[@]}" jiras
fi
fi
# func_echo "Create a template commit message file"
func_echo "Load jira ticket into a browser"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
'gen-commit-message='*)
banner "$LINENO" "ACTION: $action"
# set -x
# (
declare GCM_branch
declare GCM_message
get_param_val "$action" GCM_branch GCM_message
func_echo "$(declare -p GCM_branch) $(declare -p GCM_message)"
## TODO: lookup repo from globals_get or args
[[ ${#repo} -eq 0 ]] && { error "repo= is empty"; }
[[ ! -v argv_jiras ]] && { er6ror "--jira is required for commit messages"; }
declare gcm_args=()
gcm_args+=("$repo")
gcm_args+=("$branch_name")
gen_commit_message "$GCM_message" "${gcm_args[@]}" argv_jiras
# cat "$GCM_message"
: # Assign ($?==0)
# ) 2>&1 | tee "$logfile"
# OFFENDER: ./bttb.sh:479
# ERROR: 'tee "$logfile"' exited with status 1
# Exiting with status 1
func_echo "(LINENO:$LINENO) fixed case for [$action]"
set +x
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
'gerrit-urls'*)
banner "$LINENO" "ACTION: $action"
if [[ ! -v argv_no_gerrit_urls ]]; then
func_echo "When re-creating a release, delete ${argv_version} from gerrit.admin.{branches,tags}"
"$actions_lib/show-gerrit-urls.sh" '--repo' "$repo"
fi
;;
info) echo "INFO" ;;
## -----------------------------------------------------------------------
## Intent: Update .gitreview file on a branch
## -----------------------------------------------------------------------
'gitreview='*)
banner "$LINENO" "ACTION: $action"
declare val
get_param_val "$action" val
update_gitreview "$val" # ${raw[1]}
;;
## -----------------------------------------------------------------------
## Intent: Type tag-branch detected, create release tag to hang branch on
## -----------------------------------------------------------------------
TB-create-tag)
banner "$LINENO" "ACTION: $action"
git fetch --all
tag=''
get_tag "$ver" tag
msg="$release_name release: branch $branch created from tag $tag"
declare repo_name
get_repository_name repo_name
if is_tag "$tag_name"; then
echo "[SKIP] tag $tag_name exists ${repo_name}"
## Not yet able to update message when remote tag exists.
# git tag <tag name> <tag name>^{} -f -m "<new message>"
# git tag "$tag" "$tag^{}" -f -m "$msg"
else
git tag -a "$tag" -m "$msg"
git tag | grep "$ver"
git push origin "$tag"
echo
echo "TAG INFO:"
echo "======================================================================="
git for-each-ref "refs/tags/$tag" --format='%(contents)'
fi
func_echo "git tag=$tag"
git for-each-ref "refs/tags/$tag" --format='%(contents)'
# show_tag "$argv_version" "$tag" "$ver"
;;
## -----------------------------------------------------------------------
# git checkout -b voltha-2.12 tags/2.12.0
## -----------------------------------------------------------------------
TB-create-branch)
banner "$LINENO" "ACTION: $action"
if is_branch "$branch_name"; then
echo "[SKIP] branch $branch_name exists"
## Not yet able to update message when remote tag exists.
# git tag <tag name> <tag name>^{} -f -m "<new message>"
# git tag "$tag" "$tag^{}" -f -m "$msg"
else
git fetch --all
git checkout -b "$branch" "tags/$tag"
git push -u origin "$branch" "tags/$tag"
fi
func_echo "git branch=${branch}"
show_branch "$branch_name"
;;
#** -----------------------------------------------------------------------
#** REPO: pod-configs, ACTION: TB-create-branch
#** -----------------------------------------------------------------------
#Switched to a new branch 'voltha-2.12'
#To ssh://gerrit.opencord.org:29418/pod-configs.git
# ! [rejected] 2.12.0 -> 2.12.0 (already exists)
#Branch 'voltha-2.12' set up to track remote branch 'voltha-2.12' from 'origin'.
#error: failed to push some refs to 'ssh://gerrit.opencord.org:29418/pod-configs.git'
#hint: Updates were rejected because the tag already exists in the remote.
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
BT-create_branch)
banner "$LINENO" "ACTION: $action"
declare -p branch
declare -p branch_name
if is_branch "$branch_name"; then
echo "[SKIP] branch $branch_name exists"#
## Not yet able to update message when remote tag exists.
# git tag <tag name> <tag name>^{} -f -m "<new message>"
# git tag "$tag" "$tag^{}" -f -m "$msg"
else
git fetch --all
git checkout -b "$branch_name"
git push -u origin "$branch_name"
fi
func_echo "git branch=${branch}"
show_branch "$branch_name"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
BT-create_tag)
banner "$LINENO" "ACTION: $action"
git fetch --all
git checkout "$branch"
msg="$release_name release: tag $tag created from branch $branch"
git tag -a "$tag" -m "$msg"
git push origin "$tag"
func_echo "git tag=$tag"
show_tag "$argv_version" "$tag" "$ver"
## Insert on ARGV
## repo:voltha-system-tests uses 'v2.12.0' not '2.12.0'
set -- '--show-annotation' "$tag" "$@"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
graph)
banner "$LINENO" "ACTION: $action"
git log --graph --decorate --oneline \
| grep "$ver" \
> "$logfile"
## -----------------------------------------------------------------------
## Example string
# f850dca (HEAD -> voltha-2.12, tag: v4.4.10, tag: v2.12.0, origin/voltha-2.12, origin/master, origin/HEAD, master) [VOL-5257] - Base build #2, pre-release version updates.
## -----------------------------------------------------------------------
cat <<EOF
** -----------------------------------------------------------------------
** % git log --graph --decorate --oneline | grep "$ver"
** -----------------------------------------------------------------------
** Release branch changeset details
** NOTE: Sanity check these values are visible for HEAD changeset:
** voltha-2.12 - Branch named for VOLTHA release
** v2.12.0 - Release tag, for tag-branch, branch anchored here.
** v4.4.10 - Tag created from repository VERSION file
** -----------------------------------------------------------------------
EOF
## Display tag/branch details
if grep -q --fixed-strings 'HEAD ->' "$logfile"; then
grep --fixed-strings 'HEAD ->' "$logfile"
else
cat "$logfile"
fi
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
rebase)
banner "$LINENO" "ACTION: $action"
git pull --ff-only origin "$branch"
git rebase -i "$branch"
git diff --name-only "$branch" 2>&1 | less
# https://stackoverflow.com/questions/12469855/git-rebasing-to-a-particular-tag
# rebase to a tag
# git rebase --onto v1.5 v1.0 dev-branch
;;
review)
banner "$LINENO" "ACTION: $action"
echo "NYI"
# git review --reviewers
;;
## -----------------------------------------------------------------------
## Interactive action -- edit tag annotation
## -----------------------------------------------------------------------
BT-edit-annotation)
banner "$LINENO" "ACTION: $action"
git tag "$tag" "${tag}^{}" -f -m "$tag release tag created from branch $branch"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
TB-edit-annotation)
banner "$LINENO" "ACTION: $action"
git tag "$tag" "${tag}^{}" -f -m "$branch release branch created from tag $tag"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
show-go-mod)
banner "$LINENO" "ACTION: $action"
if [ -f 'go.mod' ]; then
func_echo "Update go.mod dependencies to the latest version"
"$actions_lib/show-go-mod.sh"
[[ ! -v argv_no_mod_update ]] && { make mod-update LOCAL_FIX_PERMS=1; }
fi
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
show[-_]anno*)
banner "$LINENO" "ACTION: $action"
source "${actions_lib}/show-annotations.sh"
declare tagname
get_tag "$ver" tagname
show_annotations "$tagname"
;;
## -----------------------------------------------------------------------
## -----------------------------------------------------------------------
show_branch)
banner "$LINENO" "ACTION: $action"
show_branch "$branch"
;;
## -----------------------------------------------------------------------
## Intent: Show named or available tags"
## -----------------------------------------------------------------------
show_tag)
banner "$LINENO" "ACTION: $action"
declare tag=
if [[ "$action" == *'='* ]]; then
get_tag "$ver" tag
else
get_param_val "$action" tag
fi
show_tag "$tag"
;;
*)
readarray -d'=' -t fields < <(printf '%s' "$action")
error "Detected invalid action=[${fields[0]}]" ;;
esac
case "$action" in
*) do_continue "ACTION was [$action]" ;;
esac
popd >/dev/null || { error "popd $sandbox_repo failed"; }
done #
done # repos
banner "Finally: PUSH"
func_echo "Verify Sandbox Content and push to gerrit"
echo
## ---------------------------------------------------------------------------
## ---------------------------------------------------------------------------
# show_git_status "${argv_repos[@]}" 'voltha-docs'
banner "$LINENO" "git status"
for path in "${git_status[@]}";
do
[[ ! -d "$path" ]] && { continue; } # only voltha-docs
echo
func_echo "** sandbox: $path"
pushd "$path" >/dev/null || { error "pushd failed: $path"; }
git status
popd >/dev/null || { error "popd failed: $path"; }
done
banner "LOGS"
find "$argv_logdir" -ls
banner "Review pending commits"
/bin/pwd
git branch -vv
# echo "BRANCH: dev-${USER}-master"
# echo "BRANCH: dev-${USER}-{release}"cd
## TODO: Create patches on both branches
## branches: dev-$(USER)-{master,voltha-2.12}
## Git commit with message
## Then echo pending tasks'
# [EOF]