[VOL-5319] voltctl release problems
jjb/github-release/voltha.yaml
------------------------------
o Update copyright notice, add SPDX tokens.
o Edits allow 'make lint-reuse' to run cleanly.
jjb/shell/github-release/help.sh
jjb/shell/github-release/parse-args.sh
--------------------------------------
o Cosmetic edits.
o Script is growing so bulk move some functions into named libraries.
jjb/shell/github-release.sh
---------------------------
o Script edits are mostly added to improve logging and debugging.
o Replace hardcoded /bbsim/ reference in log output with /{repo}/.
Can be confusing displaying 'bbism' when voltctl is being released.
o Added debug function bannerEL() to announce function ENTER/LEAVE.
o Display function name and line number when error() is called.
o Added arg --self-verify for debugging. Perform simple credential
validation using login() & logout() VS allowing script to run.
o Added an extra case in getGitVersion(). GERRIT_PROJECT= may not
be defined while debugging interactively. Report error and
suggest fixes.
Signed-off-by: Joey Armstrong <jarmstrong@linuxfoundation.org>
Change-Id: I481b3dfa1cc323d02babb0a5df86145f49ab176f
diff --git a/jjb/shell/github-release/parse-args.sh b/jjb/shell/github-release/parse-args.sh
new file mode 100644
index 0000000..fb79412
--- /dev/null
+++ b/jjb/shell/github-release/parse-args.sh
@@ -0,0 +1,97 @@
+#!/usr/bin/env bash
+# -----------------------------------------------------------------------
+# Copyright 2018-2024 Open Networking Foundation Contributors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# -----------------------------------------------------------------------
+# SPDX-FileCopyrightText: 2018-2024 Open Networking Foundation Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+# Intent:
+# builds (with make) and uploads release artifacts (binaries, etc.) to github
+# given a tag also create checksums files and release notes from the commit
+# message
+# -----------------------------------------------------------------------
+
+## ---------------------------------------------------------------------------
+## Intent: Parse script command line arguments
+## ---------------------------------------------------------------------------
+function parse_args()
+{
+ while [ $# -gt 0 ]; do
+ local arg="$1"; shift
+ func_echo "ARGV: $arg"
+
+ # shellcheck disable=SC2034
+ case "$arg" in
+
+ -*debug) declare -i -g debug=1 ;;
+ --draft) declare -i -g draft_release=1 ;;
+ --dry-run) declare -i -g dry_run=1 ;;
+
+ --version-file)
+ # [TODO] pass arg and infer path from that
+ declare -i -g argv_version_file=1
+
+ if [[ $# -gt 0 ]] && [[ "$1" == *"/VERSION" ]]; then
+ arg="$1"; shift
+ [[ ! -e "$arg" ]] && { error "--version-file $arg does not exist"; }
+ local path="${arg%/*}"
+ cd "$path" || { error "cd $path: directory does not exist"; }
+ fi
+ ;;
+
+ -*gen-version)
+ declare -g -i argv_gen_version=1
+ ;;
+
+ -*git-hostname)
+ __githost="$1"; shift
+ ;;
+
+ -*release-notes)
+ [[ ! -f "$1" ]] && error "--release-notes: file path required (arg=\"$arg\")"
+ declare -g release_notes="$1"; shift
+ ;;
+
+ -*repo-name)
+ __repo_name="$1"; shift
+ ;;
+
+ -*repo-org)
+ __repo_org="$1"; shift
+ ;;
+
+ -*pac)
+ declare -g pac="$1"; shift
+ readonly pac
+ [[ ! -f "$pac" ]] && error "--token= does not exist ($pac)"
+ : # nop/true
+ ;;
+
+ -*todo) todo ;;
+
+ --self-check) declare -g -i argv_self_check=1 ;;
+
+ -*help) usage; exit 0 ;;
+
+ *) error "Detected unknown argument $arg" ;;
+ esac
+ done
+
+ return
+}
+
+: # assign $?=0 for source $script
+
+# [EOF]