[VOL-4166] Adding make target to verify compatibility between VERSION and referenced apps

Change-Id: I2e1e047d6dec5f0d1e5f5235644383b6e31ac685
diff --git a/Makefile b/Makefile
index dc782eb..72c2c92 100644
--- a/Makefile
+++ b/Makefile
@@ -40,30 +40,26 @@
 
 .PHONY: docker-build
 
-# This should to be the first and default target in this Makefile
-help:
+# For each makefile target, add ## <description> on the target line and it will be listed by 'make help'
+help: ## Print help for each Makefile target
 	@echo "Usage: make [<target>]"
 	@echo "where available targets are:"
 	@echo
-	@echo "build             : Build the onos docker image with olt apps built-in"
-	@echo "help              : Print this help"
-	@echo "docker-push       : Push the docker images to an external repository"
-	@echo "clean             : Delete any locally copied oar files in local_imports"
-	@echo
-
+	@grep '^[[:alpha:]_-]*:.* ##' $(MAKEFILE_LIST) \
+		| sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s : %s\n", $$1, $$2};'
 
 ## Docker targets
 
-build: docker-build
+build: docker-build ## alias for "docker-build"
 
-local-onosapps:
+local-onosapps: ## if LOCAL_ONOSAPPS=true runs the get-local-oars.sh
 	mkdir -p local_imports/oar
 ifdef LOCAL_ONOSAPPS
 	rm -rf local_imports/oar
 	./get-local-oars.sh
 endif
 
-docker-build: local-onosapps
+docker-build: local-onosapps ## build docker image: use DOCKER_REGISTRY, DOCKER_REPOSITORY and DOCKER_TAG to customize
 	docker build $(DOCKER_BUILD_ARGS) \
     -t ${ONOS_IMAGENAME} \
     --build-arg LOCAL_ONOSAPPS=$(LOCAL_ONOSAPPS) \
@@ -74,10 +70,13 @@
     --build-arg org_opencord_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \
     -f Dockerfile.voltha-onos .
 
-docker-push:
+test: ## verify that if the version is released we're not pointing to SNAPSHOT apps
+	bash tests/version-check.sh
+
+docker-push: ## push to docker registy: use DOCKER_REGISTRY, DOCKER_REPOSITORY and DOCKER_TAG to customize
 	docker push ${ONOS_IMAGENAME}
 
-clean:
+clean: ## clean the build environment
 	rm -rf local_imports
 
 # end file
diff --git a/VERSION b/VERSION
index 0062ac9..8529915 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5.0.0
+5.0.1-dev
diff --git a/tests/version-check.sh b/tests/version-check.sh
new file mode 100644
index 0000000..65ad4d6
--- /dev/null
+++ b/tests/version-check.sh
@@ -0,0 +1,27 @@
+# Copyright 2021-present Open Networking Foundation
+
+# 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.
+
+CWD=$( dirname ${BASH_SOURCE[0]} )
+NEW_VERSION=$(head -n1 "$CWD/../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 ]]
+  then
+    echo "ERROR: Referring to -SNAPSHOT apps in a released VERSION"
+    exit 1
+  fi
+fi