VOL-4836: Interactive helm chart linting.

repo:voltha-docs job reported reactive post-commit linting errors.
Begin adding support for make target lint-helm for early detection.

Makefile
--------
  o Adding comments for readability.
  o Disable failing/unused targets.
  o Update help text.
  o Migrating some targets and deps from Makefile proper into makefiles/*.

makefiles/README.md
-------------------
  o Added a basic makefile readme with pointers to other web resources.

makefiles/lint/include.mk
makefiles/lint/helm/include.mk
-------------------------
  o Initial support for library makefile target: 'lint-helm'
  o Added common targets: clean, help, sterile and todo.
  o Target 'pre-commit added:
      - default target to support interactive use of lint-helm.
      - Cleanup needed before common target can use lint-helm as a default.
  o Interim answer: briding the gap between existing and portable logic.
  o legacy logic (USE_LEGACY=1 (default)):
      - Relies on .gitreview and hardcoding defaults (opencord/master).
      - git has builtin support for local/remote branch queries.
      - updates to support queries which simplify logic.
  o Interactive target lint-helm-deps
    - Configure helm charts per linting logic in gerrit/jenkins job.
    - Interactive target will invoke make target with USE_LEGACY=$(null).

Change-Id: I43616d16707a09da6f907f909c65504da9933a6f
diff --git a/Makefile b/Makefile
index 1a86238..a5ca425 100644
--- a/Makefile
+++ b/Makefile
@@ -31,13 +31,13 @@
 
 branch=`cat .gitreview | grep branch | cut -d '=' -f2`
 
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
 help:: # @HELP Print the command options
-	@echo
-	@echo "[TEST]"
 	@echo "  test                          Sanity check chart versions"
 	@echo
 	@echo "[CHECK: release]"
-	@echo "  helm-repo-tools               Repository clone target"
+	@echo "  helm-repo-tools               Helper tools"
 	@echo "  tagcollisionreject.sh         404 - raw.github source MIA"
 	@echo
 	@echo "\033[0;31m    VOLTHA HELM CHARTS \033[0m"
@@ -69,12 +69,21 @@
 test-tags: tagcollisionreject.sh
 	@bash ./tagcollisionreject.sh
 
+## -----------------------------------------------------------------------
+## [NOTE] moving to makefiles/lint/helm/include.mk
+## -----------------------------------------------------------------------
 helm-repo-tools:
 	git clone "https://gerrit.opencord.org/helm-repo-tools"
 
-test: test-tags helm-repo-tools # @HELP Makes sure the versions used in the charts are valid
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+# test-all += test-tags # tagcollisionreject + curl is broken
+test-all += helm-repo-tools
+test: $(test-all) # @HELP Makes sure the versions used in the charts are valid
 	@COMPARISON_BRANCH=origin/$(branch) ./helm-repo-tools/chart_version_check.sh
 
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
 clean :: # @HELP Removes all files downloaded to run the tests
 	$(RM) -r helm-repo-tools
 	$(RM) tagcollisionreject.*
diff --git a/makefiles/README.md b/makefiles/README.md
new file mode 100644
index 0000000..a31e846
--- /dev/null
+++ b/makefiles/README.md
@@ -0,0 +1,18 @@
+# Makefiles
+
+```shell
+% make help
+% make help VERBOSE=1
+
+% make lint
+% make lint-yaml
+
+% make test
+```
+
+## See Also
+
+- https://www.gnu.org/software/make/manual/html_node/index.html
+- https://wiki.opennetworking.org/display/JOEY/Makefiles
+- https://github.com/joey-onf/snippets/blob/origin/master/makefiles/hierarchy/voltha-system-tests
+- https://docs.voltha.org/master/howto/code/linting.html
diff --git a/makefiles/helm/include.mk b/makefiles/helm/include.mk
new file mode 100644
index 0000000..7704871
--- /dev/null
+++ b/makefiles/helm/include.mk
@@ -0,0 +1,9 @@
+# -*- makefile -*-
+
+helm-repo-tools:
+	git clone "https://gerrit.opencord.org/helm-repo-tools"
+
+clean ::
+	$(RM) helm-repo-tools
+
+# [EOF]
diff --git a/makefiles/include.mk b/makefiles/include.mk
index e734aeb..aa8c402 100644
--- a/makefiles/include.mk
+++ b/makefiles/include.mk
@@ -24,9 +24,9 @@
 ## -----------------------------------------------------------------------
 help::
 	@echo "USAGE: $(MAKE) [options] [target] ..."
+        # @echo "  test                          Sanity check chart versions"
 
 include $(MAKEDIR)/consts.mk
 include $(MAKEDIR)/lint/include.mk
-include $(MAKEDIR)/variables.mk
 
 # [EOF]
diff --git a/makefiles/lint/helm/include.mk b/makefiles/lint/helm/include.mk
new file mode 100644
index 0000000..a76987e
--- /dev/null
+++ b/makefiles/lint/helm/include.mk
@@ -0,0 +1,153 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022 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
+#
+# 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: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+GIT ?= /usr/bin/git
+
+chart-version-check-sh := helm-repo-tools/chart_version_check.sh
+
+## -------------------------------------------------------------------
+## NOTE: This uglyness can go away with proper command line switch use
+## -------------------------------------------------------------------
+##   o USE_LEGACY= (default)
+##       - bridge logic: support existing behavior.
+##       - helmlint.sh contains hardcoded branch='origin/opencord'
+##   o TODO:
+##       - infer values from repository checkout on disk.
+##       - parameterize helmlint.sh
+##       - use simple flags to toggle behavior:
+##           MASTER_BRANCH=1  || --branch master (default)
+##           LOCAL_BRANCH=1   || --branch local)
+##           MY_BRANCH=1      || --branch local
+##       - Better yet: when branch name is known simply pass it:
+##           % make lint-helm BRANCH=alt-branch-name
+## -----------------------------------------------------------------------
+USE_LEGACY = 1
+ifdef USE_LEGACY
+  $(if $(DEBUG),$(info ifdef USE_LEGACY))
+
+  lint-helm-branch ?= $(shell cat .gitreview | grep branch | cut -d '=' -f2)
+
+else
+  $(if $(DEBUG),$(info not USE_LEGACY))
+
+  ifdef LOCAL_BRANCH
+     get-git-branch ?= $(shell $(GIT) branch --show-current)# empty if detached
+     get-git-branch ?= $(shell awk -F '/branch/ {print $$2}' .gitreview)
+     get-git-branch ?= $(error Detected detached head)
+
+  else # master
+     # refs/remotes/origin/HEAD => origin/master
+     get-git-branch ?= $(shell $(GIT) symbolic-ref --short refs/remotes/origin/HEAD)
+  endif
+
+  lint-helm-branch ?= $(COMPARISON_BRANCH)
+  lint-helm-branch ?= $(get-git-branch)
+
+  $(if $(DEBUG),$(info get-git-branch = $(get-git-branch)))
+  $(if $(DEBUG),$(info lint-branch=$(lint-branch)))
+endif
+
+##-------------------##
+##---]  TARGETS  [---##
+##-------------------##
+.PHONY : lint-helm
+lint   : lint-helm
+
+## -----------------------------------------------------------------------
+## Intent: Lint helm charts
+##   o This logic mirrors gerrit/jenkins commit hook behavior.
+##   o Adding to stem incidents of late pull request jenkins failures.
+##   o see: make help VERBOSE=1
+## -----------------------------------------------------------------------
+.PHONY: lint-helm
+lint-helm: $(chart-version-check-sh)# helm-repo-tools
+lint-helm:
+	COMPARISON_BRANCH="$(get-git-branch)" $(chart-version-check-sh)
+#	COMPARISON_BRANCH="$(lint-helm-branch)" $(chart-version-check-sh)
+
+## -----------------------------------------------------------------------
+## Intent: repo:helm-repo-tools
+##   o Use script as a dependency for on-demand cloning.
+##   o Use of repo name (r-h-t) as a dependency is problematic.
+## -----------------------------------------------------------------------
+$(chart-version-check-sh):
+	$(GIT) clone "https://gerrit.opencord.org/helm-repo-tools"
+
+## -----------------------------------------------------------------------
+## Intent: 
+## -----------------------------------------------------------------------
+# branch=`cat .gitreview | grep branch | cut -d '=' -f2`
+pre-commit :: lint-helm
+#	$(chart-version-check-sh) clean
+#	@COMPARISON_BRANCH=origin/$(branch) $(chart-version-check-sh)
+#	$(chart-version-check-sh)
+
+## -----------------------------------------------------------------------
+## [TODO] Extract hardcoded values from lint.sh:
+##    o pass as args
+##    o pass through configs:
+##    o consumer/makefile should prep then invoke htmllint:
+##        + arbitrary repository commit hooks can match build behavior.
+## -----------------------------------------------------------------------
+lint-helm-deps:
+	helm repo add stable https://charts.helm.sh/stable
+	helm repo add rook-release https://charts.rook.io/release
+	helm repo add cord https://charts.opencord.org
+
+## -----------------------------------------------------------------------
+## Intent: Remove generated targets
+## -----------------------------------------------------------------------
+clean ::
+	$(chart-version-check-sh) clean
+
+## -----------------------------------------------------------------------
+## Intent: Remove all non-source targets
+## -----------------------------------------------------------------------
+sterile ::
+	$(RM) helm-repo-tools
+
+## -----------------------------------------------------------------------
+## Intent: Display target help with context
+##   % make help
+##   % make help VERBOSE=1
+## -----------------------------------------------------------------------
+help ::
+	@echo "  lint-helm            Syntax check helm charts"
+ifdef VERBOSE
+	@echo "  lint-helm COMPARISON_BRANCH=1    Local/dev lint (branch != master)"
+endif
+ifdef VERBOSE
+	@echo "  lint-helm-deps       Configure dependent helm charts"
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Future enhancement list
+## -----------------------------------------------------------------------
+todo ::
+	@ehco "[TODO: makefiles/helm/include.mk]"
+	@echo " o Generalize script logic, remove hardcoded values,"
+	@echo " o Update gerrit/jenkins/makefiles/interactive:"
+	@echo "     Lint behavior should be consistent everywhere."
+	@echo " o Fix COMPARSION_BRANCH logic:"
+	@echo "     helm-repo-tools/chart_version_check contains 'opencord/master'"
+	@echo " o Refactor 2 jenkins jobs and lint-helm-deps"
+	@echo "     use everywhere: % make lint-helm"
+
+# [EOF]
diff --git a/makefiles/lint/helm/include.mk~ b/makefiles/lint/helm/include.mk~
new file mode 100644
index 0000000..a76987e
--- /dev/null
+++ b/makefiles/lint/helm/include.mk~
@@ -0,0 +1,153 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2022 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
+#
+# 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: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+GIT ?= /usr/bin/git
+
+chart-version-check-sh := helm-repo-tools/chart_version_check.sh
+
+## -------------------------------------------------------------------
+## NOTE: This uglyness can go away with proper command line switch use
+## -------------------------------------------------------------------
+##   o USE_LEGACY= (default)
+##       - bridge logic: support existing behavior.
+##       - helmlint.sh contains hardcoded branch='origin/opencord'
+##   o TODO:
+##       - infer values from repository checkout on disk.
+##       - parameterize helmlint.sh
+##       - use simple flags to toggle behavior:
+##           MASTER_BRANCH=1  || --branch master (default)
+##           LOCAL_BRANCH=1   || --branch local)
+##           MY_BRANCH=1      || --branch local
+##       - Better yet: when branch name is known simply pass it:
+##           % make lint-helm BRANCH=alt-branch-name
+## -----------------------------------------------------------------------
+USE_LEGACY = 1
+ifdef USE_LEGACY
+  $(if $(DEBUG),$(info ifdef USE_LEGACY))
+
+  lint-helm-branch ?= $(shell cat .gitreview | grep branch | cut -d '=' -f2)
+
+else
+  $(if $(DEBUG),$(info not USE_LEGACY))
+
+  ifdef LOCAL_BRANCH
+     get-git-branch ?= $(shell $(GIT) branch --show-current)# empty if detached
+     get-git-branch ?= $(shell awk -F '/branch/ {print $$2}' .gitreview)
+     get-git-branch ?= $(error Detected detached head)
+
+  else # master
+     # refs/remotes/origin/HEAD => origin/master
+     get-git-branch ?= $(shell $(GIT) symbolic-ref --short refs/remotes/origin/HEAD)
+  endif
+
+  lint-helm-branch ?= $(COMPARISON_BRANCH)
+  lint-helm-branch ?= $(get-git-branch)
+
+  $(if $(DEBUG),$(info get-git-branch = $(get-git-branch)))
+  $(if $(DEBUG),$(info lint-branch=$(lint-branch)))
+endif
+
+##-------------------##
+##---]  TARGETS  [---##
+##-------------------##
+.PHONY : lint-helm
+lint   : lint-helm
+
+## -----------------------------------------------------------------------
+## Intent: Lint helm charts
+##   o This logic mirrors gerrit/jenkins commit hook behavior.
+##   o Adding to stem incidents of late pull request jenkins failures.
+##   o see: make help VERBOSE=1
+## -----------------------------------------------------------------------
+.PHONY: lint-helm
+lint-helm: $(chart-version-check-sh)# helm-repo-tools
+lint-helm:
+	COMPARISON_BRANCH="$(get-git-branch)" $(chart-version-check-sh)
+#	COMPARISON_BRANCH="$(lint-helm-branch)" $(chart-version-check-sh)
+
+## -----------------------------------------------------------------------
+## Intent: repo:helm-repo-tools
+##   o Use script as a dependency for on-demand cloning.
+##   o Use of repo name (r-h-t) as a dependency is problematic.
+## -----------------------------------------------------------------------
+$(chart-version-check-sh):
+	$(GIT) clone "https://gerrit.opencord.org/helm-repo-tools"
+
+## -----------------------------------------------------------------------
+## Intent: 
+## -----------------------------------------------------------------------
+# branch=`cat .gitreview | grep branch | cut -d '=' -f2`
+pre-commit :: lint-helm
+#	$(chart-version-check-sh) clean
+#	@COMPARISON_BRANCH=origin/$(branch) $(chart-version-check-sh)
+#	$(chart-version-check-sh)
+
+## -----------------------------------------------------------------------
+## [TODO] Extract hardcoded values from lint.sh:
+##    o pass as args
+##    o pass through configs:
+##    o consumer/makefile should prep then invoke htmllint:
+##        + arbitrary repository commit hooks can match build behavior.
+## -----------------------------------------------------------------------
+lint-helm-deps:
+	helm repo add stable https://charts.helm.sh/stable
+	helm repo add rook-release https://charts.rook.io/release
+	helm repo add cord https://charts.opencord.org
+
+## -----------------------------------------------------------------------
+## Intent: Remove generated targets
+## -----------------------------------------------------------------------
+clean ::
+	$(chart-version-check-sh) clean
+
+## -----------------------------------------------------------------------
+## Intent: Remove all non-source targets
+## -----------------------------------------------------------------------
+sterile ::
+	$(RM) helm-repo-tools
+
+## -----------------------------------------------------------------------
+## Intent: Display target help with context
+##   % make help
+##   % make help VERBOSE=1
+## -----------------------------------------------------------------------
+help ::
+	@echo "  lint-helm            Syntax check helm charts"
+ifdef VERBOSE
+	@echo "  lint-helm COMPARISON_BRANCH=1    Local/dev lint (branch != master)"
+endif
+ifdef VERBOSE
+	@echo "  lint-helm-deps       Configure dependent helm charts"
+endif
+
+## -----------------------------------------------------------------------
+## Intent: Future enhancement list
+## -----------------------------------------------------------------------
+todo ::
+	@ehco "[TODO: makefiles/helm/include.mk]"
+	@echo " o Generalize script logic, remove hardcoded values,"
+	@echo " o Update gerrit/jenkins/makefiles/interactive:"
+	@echo "     Lint behavior should be consistent everywhere."
+	@echo " o Fix COMPARSION_BRANCH logic:"
+	@echo "     helm-repo-tools/chart_version_check contains 'opencord/master'"
+	@echo " o Refactor 2 jenkins jobs and lint-helm-deps"
+	@echo "     use everywhere: % make lint-helm"
+
+# [EOF]
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index f904217..d3975de 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -13,14 +13,25 @@
 # 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: 2022 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
 # -----------------------------------------------------------------------
 
-help::
-	@echo
-	@echo "[LINT]"
+# ------------------------------------------------
+# On-demand loading:
+#   - lint helm charts
+#   - on demand for now, errors and cleanup needed
+#   - Usage: make lint-helm USE_LEGACY=<blank>
+# ------------------------------------------------
+$(if $(findstring lint-helm,$(MAKECMDGOALS)),\
+  $(eval include $(MAKEDIR)/lint/helm/include.mk))
 
-include $(MAKEDIR)/lint/helm.mk
-
+# ------------------------------------------------------------
+## yaml checking
+##   o yamllint - check everything, all the time.
+##   o python   - dependency based checking
+# ------------------------------------------------------------
 ifdef YAML_FILES
   include $(MAKEDIR)/lint/yaml/python.mk
 else