[VOL-5031] - Pre-release voltha-onos build
[VOL-5099] - verify_foltha-onos-sanity-test FAIL
app-install.sh
tests/version-check.sh
----------------------
o shellcheck cleanups
o Improve error detection and reporting.
o cd '..' early VS resolving relative paths everywhere.
o Replace $(basename) with shell string builtins.
o use local vars to shorten paths and avoid extra string concatenation.
o Added error detection in "<app name=" gathering, shell commands can
fail allowing manipulation in APP_INSTALL_ROOT VS A_I_R/$name.
Makefile
makefiles/virtualenv.mk
-----------------------
o Update requirements.txt read check to not require existence
of an empty *.txt file on disk.
dependencies.xml
----------------
o Update component dependencies to match the latest deployed versions.
o https://wiki.opennetworking.org/display/VOLTHA/v2.12+Deployments
o Still pending: segmentrouting.version and kafka.
Change-Id: I05d2d71521fa56ea788cc959e1ce88b1d38e1b2b
diff --git a/Makefile b/Makefile
index de7093a..75c0cc2 100644
--- a/Makefile
+++ b/Makefile
@@ -95,4 +95,6 @@
clean :: ## clean the build environment
$(RM) -r local_imports
+sterile :: clean
+
# end file
diff --git a/VERSION b/VERSION
index d4bda08..fc3aa77 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5.1.8
+5.1.9
diff --git a/app-install.sh b/app-install.sh
index b810097..b783565 100755
--- a/app-install.sh
+++ b/app-install.sh
@@ -13,22 +13,66 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-HERE=$(pwd)
-OARS=$(find $DOWNLOAD_ROOT -name "*.oar")
-for oar in $OARS; do
- cd $HERE
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+# set -euo pipefail
+umask 022
+declare -g HERE; HERE="$(pwd)"
+
+## -----------------------------------------------------------------------
+## Intent: Display an error mesage then exit with shell exit status
+## -----------------------------------------------------------------------
+function error()
+{
+ echo "${BASH_SOURCE[0]} ERROR: $*"
+ exit 1
+}
+
+## -----------------------------------------------------------------------
+## Intent: Verify required environment variables are set
+## -----------------------------------------------------------------------
+function init()
+{
+ [[ ! -v APP_INSTALL_ROOT ]] && error "Var APP_INSTALL_ROOT= is required"
+ [[ ! -v DOWNLOAD_ROOT ]] && error "Var DOWNLOAD_ROOT= is required"
+ return
+}
+
+##----------------##
+##---] MAIN [---##
+##----------------##
+
+init
+
+readarray -t OARS < <(find "$DOWNLOAD_ROOT" -name '*.oar')
+for oar in "${OARS[@]}"; do
+
+ app_xml="$APP_INSTALL_ROOT/app.xml"
+ oar_basename="${oar##*/}" # bash builtin
+
+ cd "$HERE" || error "cd $HERE failed"
echo "Installing application '$oar'"
- rm -rf $APP_INSTALL_ROOT
- mkdir -p $APP_INSTALL_ROOT
- cd $APP_INSTALL_ROOT
- cp $oar $APP_INSTALL_ROOT
- unzip -oq -d . $APP_INSTALL_ROOT/$(basename $oar)
- name=$(grep "name=" $APP_INSTALL_ROOT/app.xml | sed 's/<app name="//g;s/".*//g')
- mkdir -p $APPS_ROOT/$name
- cp $APP_INSTALL_ROOT/app.xml $APPS_ROOT/$name/app.xml
- touch $APPS_ROOT/$name/active
- [ -f $APP_INSTALL_ROOT/app.png ] && cp $APP_INSTALL_ROOT/app.png $APPS_ROOT/$name/app.png
- cp $APP_INSTALL_ROOT/$(basename $oar) $APPS_ROOT/$name/$name.oar
- cp -rf $APP_INSTALL_ROOT/m2/* $KARAF_M2
- rm -rf $APP_INSTALL_ROOT
+ rm -rf "$APP_INSTALL_ROOT"
+ mkdir -p "$APP_INSTALL_ROOT"
+ cd "$APP_INSTALL_ROOT" || error "cd $APP_INSTALL_ROOT failed"
+ cp -v "$oar" "$APP_INSTALL_ROOT"
+ unzip -oq -d . "$APP_INSTALL_ROOT/${oar_basename}"
+
+ readarray -t names < <(grep "name=" "$app_xml" \
+ | sed 's/<app name="//g;s/".*//g')
+ [[ ${#names[@]} -gt 0 ]] || error "Detected invalid name gathering"
+ name="${names[1]}"
+ apps_name="$APPS_ROOT/$name"
+
+ mkdir -p "$apps_name"
+ cp "$app_xml" "${apps_name}/app.xml"
+ touch "${apps_name}/active"
+ [ -f "$APP_INSTALL_ROOT/app.png" ] \
+ && cp "$APP_INSTALL_ROOT/app.png" "${apps_name}/app.png"
+ cp "${APP_INSTALL_ROOT}/${oar_basename}" "${apps_name}/${name}.oar"
+ cp -rf "$APP_INSTALL_ROOT/m2/"* "$KARAF_M2"
+ rm -rf "$APP_INSTALL_ROOT"
done
+
+# [EOF]
diff --git a/makefiles/virtualenv/include.mk b/makefiles/virtualenv/include.mk
index 9ae62a4..4dd2aa1 100644
--- a/makefiles/virtualenv/include.mk
+++ b/makefiles/virtualenv/include.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
## -----------------------------------------------------------------------
-# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/makefiles/virtualenv/python_310_migration.sh b/makefiles/virtualenv/python_310_migration.sh
index c666f59..5155768 100644
--- a/makefiles/virtualenv/python_310_migration.sh
+++ b/makefiles/virtualenv/python_310_migration.sh
@@ -1,6 +1,6 @@
#!/bin/bash
# -----------------------------------------------------------------------
-# Copyright 2022-2023 Open Networking Foundation (ONF) and the ONF Contributors
+# Copyright 2022-2024 Open Networking Foundation (ONF) and the ONF Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
diff --git a/tests/version-check.sh b/tests/version-check.sh
index 0d76faf..e1fb354 100644
--- a/tests/version-check.sh
+++ b/tests/version-check.sh
@@ -1,5 +1,5 @@
+#!/bin/bash
# Copyright 2021-2024 Open Networking Foundation (ONF) and the ONF 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
@@ -12,16 +12,27 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-CWD=$( dirname ${BASH_SOURCE[0]} )
-NEW_VERSION=$(head -n1 "$CWD/../VERSION")
+set -euo pipefail
+
+pgm_dir="${BASH_SOURCE[0]%/*}"
+cd "$pgm_dir/.."
+
+NEW_VERSION="$(head -n1 'VERSION')"
if [[ "$NEW_VERSION" =~ ^([0-9]+)\.([0-9]+)\.([0-9]+)$ ]]
then
echo "Version string '$NEW_VERSION' is a SemVer released version!"
- SNAPSHOTS=$(cat "$CWD/../dependencies.xml" | grep "SNAPSHOT" | wc -l)
- if [[ "$SNAPSHOTS" -gt 0 ]]
+ declare -i SNAPSHOTS
+ SNAPSHOTS=$(grep --count "SNAPSHOT" 'dependencies.xml')
+ if [[ $SNAPSHOTS -gt 0 ]]
then
echo "ERROR: Referring to -SNAPSHOT apps in a released VERSION"
exit 1
fi
+
+elif [[ "$NEW_VERSION" =~ '-dev' ]]; then
+ echo "** Developement version detected: $(declare -p NEW_VERSION)"
+
+else
+ echo "** Detected odd version string: $(declare -p NEW_VERSION)"
fi