diff options
author | Dave Wallace <dwallacelf@gmail.com> | 2021-03-10 13:42:33 -0500 |
---|---|---|
committer | Dave Wallace <dwallacelf@gmail.com> | 2021-03-10 13:42:33 -0500 |
commit | 536165b3b33731e65768ad93dc8adb06cb3b06cd (patch) | |
tree | 9bc55fe2f4247afa5b829e2326fe7095812060c0 /extras | |
parent | e93e0ef6f5ebbdf344f4e9c8c4b1f84cbf77632e (diff) |
Update sandbox bash functions
- Add '-n' option to jjsb-test() and
jjsb-update() to limit output to
the most useful information of each
function -- job names and number of
jobs respectively.
Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Change-Id: I47722c2238ad5bbdc9e289885303fe68239503f9
Diffstat (limited to 'extras')
-rw-r--r-- | extras/bash/sandbox_test_functions.sh | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/extras/bash/sandbox_test_functions.sh b/extras/bash/sandbox_test_functions.sh index afccf9a2..de8a9657 100644 --- a/extras/bash/sandbox_test_functions.sh +++ b/extras/bash/sandbox_test_functions.sh @@ -24,6 +24,9 @@ # $WS_ROOT/jenkins.ini # 2. Clone ci-management workspace from gerrit.fd.io # 3. export WS_ROOT=<local ci-management workspace> +# 4. cd $WS_ROOT +# 5. git submodule update --init --recursive + jjb-sandbox-env() { local jjb_version=${JJB_VERSION:-"3.5.0"} @@ -78,25 +81,42 @@ jjb-sandbox-env() echo "jenkins-jobs not found! Run jjb-sandbox-env to activate." return fi + local grep_job_names="" + if [ "$1" = "-n" ] ; then + grep_job_names="true" + shift + fi if [ -z "$1" ] ; then echo "Usage: $FUNCNAME <jenkins-job-name>" return fi - which jenkins-jobs \ - && jenkins-jobs --conf $JENKINS_INI test $WS_ROOT/jjb $@ + if [ -z "$grep_job_names" ]; then + jenkins-jobs --conf $JENKINS_INI test $WS_ROOT/jjb $@ + else + jenkins-jobs --conf $JENKINS_INI test $WS_ROOT/jjb $@ 2>&1 | grep -e'Number of jobs' -e'Job name' | sed -e 's/INFO:jenkins_jobs.builder://g' + fi } function jjsb-update() { if [ -z "$(which jenkins-jobs 2>&1)" ] ; then echo "jenkins-jobs not found! Run jjb-sandbox-env to activate." return fi + local grep_num_jobs="" + if [ "$1" = "-n" ] ; then + grep_num_jobs="true" + shift + fi if [ -z "$1" ] ; then echo "Usage: $FUNCNAME <jenkins-job-name>" return fi - which jenkins-jobs \ - && jenkins-jobs --conf $JENKINS_INI update $WS_ROOT/jjb $@ + if [ -z "grep_num_jobs" ] ; then + jenkins-jobs --conf $JENKINS_INI update $WS_ROOT/jjb $@ + else + jenkins-jobs --conf $JENKINS_INI update $WS_ROOT/jjb $@ 2>&1 | grep -e'Number of jobs' + fi } + jenkins-jobs --version } |