Add jenkins.sh script

Change-Id: I39774f17a646e146a5d8b9807b221473ca7a1ea7
diff --git a/bin/jenkins.sh b/bin/jenkins.sh
new file mode 120000
index 0000000..919931a
--- /dev/null
+++ b/bin/jenkins.sh
@@ -0,0 +1 @@
+../jenkins/bin/jenkins.sh
\ No newline at end of file
diff --git a/jenkins/bin/jenkins.sh b/jenkins/bin/jenkins.sh
new file mode 100755
index 0000000..29c8f51
--- /dev/null
+++ b/jenkins/bin/jenkins.sh
@@ -0,0 +1,113 @@
+#!/bin/bash
+## -----------------------------------------------------------------------
+## Intent: Construct gerrit server queries and URLs based on arguments
+## -----------------------------------------------------------------------
+
+{ # loader
+    declare pgm=''
+    pgm="$(realpath --canonicalize-existing "$0")"
+    readonly pgm
+
+    declare libdir="${pgm%/*}"
+    libdir="${libdir%/*}/jenkins"
+    readonly libdir
+
+    declare root=''
+    root="${pgm%%/jenkins/bin/jenkins.sh}"
+    source "$root/lf/onf-common/common.sh" '--common-args-begin--'
+}
+
+##-------------------##
+##---]  GLOBALS  [---##
+##-------------------##
+declare -x -g BROWSER="${BROWSER:-/usr/local/bin/firefox}"
+
+declare -a comps=()
+declare -a search=()
+declare -a servs=()
+
+##--------------------##
+##---]  INCLUDES  [---##
+##--------------------##
+
+function usage()
+{
+    cat <<EOH
+Usage: $0
+  --computer        View jenkins node UI
+  --serv(er) {cord}
+
+EOH
+}
+
+##----------------##
+##---]  MAIN  [---##
+##----------------##
+[[ $# -eq 0 ]] && { set -- '--help'; }
+
+declare -a urls=()
+while [ $# -ne 0 ]; do
+    arg="$1"; shift
+    case "$arg" in
+        --help) usage; exit 0 ;;
+
+        ## Modes
+        --debug)
+            # shellcheck disable=SC2034
+            declare -g -i argv_debug=1
+            declare -g -i debug=1
+            ;;
+
+        --comp*)
+            arg="$1"; shift
+            comps+=("$arg")
+
+            declare -g -i argv_comp=1
+            ;;
+
+        --set*) set -x ;;
+        --serv*)
+            arg="$1"; shift
+            case "$arg" in
+                *cord*) servs+=('jenkins.opencord.org') ;;
+                *) error "Detected invalid server name [$arg]" ;;
+            esac
+            ;;
+
+        *)
+            arg="$1"; shift
+            search+=("$arg")
+            declare -g -i argv_search=1
+            ;;
+    esac
+done
+
+[[ ${#urls[@]} -eq 0 ]] && { servs+=('jenkins.opencord.org'); }
+
+if [[ -v argv_comp ]]; then
+    urls+=("https://${serv}/computer") 
+    for serv in "${servs[@]}";
+    do
+        for comp in "${comps[@]}";
+        do
+            urls+=("https://${serv}/computer/$comp")
+        done
+    done
+fi
+
+if [[ -v argv_search ]]; then
+    base='https://jenkins.opencord.org/view/bbsim/search'
+    for search in "${search[@]}";
+    do
+        urls+=("${base}?q=${search}")
+    done
+    # https://jenkins.opencord.org/view/bbsim/search/?q=bbs&Jenkins-Crumb=2368d5a9f8f7999b720d0bf0dc605ef2230dce1a77baad6ab1dd1d8b2f4799ea
+fi
+
+if [[ ! -v argv_comp ]] && [[ ! -v argv_search ]]; then
+    urls+=("https://jenkins.opencord.org")
+fi
+
+[[ ${#urls[@]} -gt 0 ]] && { "$BROWSER" "${urls[@]}" & }
+
+# [EOF]
diff --git a/jenkins/notes b/jenkins/notes
new file mode 100644
index 0000000..edbdaa8
--- /dev/null
+++ b/jenkins/notes
@@ -0,0 +1,4 @@
+All nodes of label ‘ubuntu18.04-basebuild-8c-15g’ are offline
+
+INFO: The instance EC2 (CORDEC2) - ubuntu18.04-basebuild-8c-15g (i-08fc2f43cf75d329d) didn't print the host key.
+  Expected a line starting with: "ssh-ed25519"
diff --git a/jira/README.md b/jira/README.md
index ff616d8..f71dc4c 100644
--- a/jira/README.md
+++ b/jira/README.md
@@ -13,12 +13,16 @@
 Conditional Searches
 ====================
 
+```bash
+% jira-search.sh --server opencord --unresolved ({search-by-flags})
+```
+
 | Jira | Command | Description |
 | ---- | ------- | ----------- |
-| [x](https://jira.opencord.org/browse/VOL-5287?jql=component%20IN%20(bbsim)%20AND%20(resolved%20IS%20EMPTY)) | ./jira-search.sh -–opencord –-unresolved –-component bbsim | Search for unresolved tickets with a component of bbsim |
-| [x](https://jira.opencord.org/browse/VOL-5220?jql=(labels%20IN%20(bbsim))%20AND%20(resolved%20IS%20EMPTY)) | ./jira-search.sh -–opencord -–unresolved -–label bbsim | Search for unresolved tickets with 'bbsim' mentioned in the label field. |
-| [x](https://jira.opencord.org/browse/VOL-5118?jql=(text%20~%20"bbsim")%20AND%20(resolved%20IS%20EMPTY)) | ./jira-search.sh -–opencord -–unresolved -–text bbsim | Search for unresolved tickets with 'bbsim' mentioned in the description |
-| [x](https://jira.opencord.org/browse/VOL-5293?jql=component%20IN%20(onos%2Cbbsim)%20AND%20(resolved%20IS%20EMPTY)) | ./jira-search.sh -–opencord -–component onos -–component bbsim | Switches can be combined but construction logic still needs work.  Query will be loaded into a browser and can be manually cleaned up. |
+| [x](https://jira.opencord.org/browse/VOL-5287?jql=component%20IN%20(bbsim)%20AND%20(resolved%20IS%20EMPTY)) | –-component bbsim | Search for unresolved tickets with a component of bbsim |
+| [x](https://jira.opencord.org/browse/VOL-5220?jql=(labels%20IN%20(bbsim))%20AND%20(resolved%20IS%20EMPTY)) | -–label bbsim | Search for unresolved tickets with 'bbsim' mentioned in the label field. |
+| [x](https://jira.opencord.org/browse/VOL-5118?jql=(text%20~%20"bbsim")%20AND%20(resolved%20IS%20EMPTY)) | -–text bbsim | Search for unresolved tickets with 'bbsim' mentioned in the description |
+| [x](https://jira.opencord.org/browse/VOL-5293?jql=component%20IN%20(onos%2Cbbsim)%20AND%20(resolved%20IS%20EMPTY)) | -–component onos -–component bbsim | Switches can be combined but construction logic still needs work.  Query will be loaded into a browser and can be manually cleaned up. |
 
 Help
 ====