[CORD-3256] Generate TT/TP community test job.
jjb/voltha-test/voltha.yaml
jjb/voltha-test/voltha-nightly-jobs.yaml
----------------------------------------
- First attempt at cloning a voltha pipeline job from DT to TT.
- Add a few placeholders for future work to split yaml configs
into a more modular setup.
Makefile
config.mk
makefiles/lint/groovy.mk
makefiles/lint/yaml.mk
makefiles/virtualenv.mk
------------------------
- Copy in makefile libraries from repo::voltha-docs.
- lint/yaml and lint/groovy.
Misc / Fixes
------------
- Fixed colorization in tree output.
- Comment out jjb import in requirements.txt, Makefile still configured to use an older version.
- Move README.md outside jjb/ lf-env scripts blindly grep for error patterns beneath jjb/
Change-Id: I36e304f6ca9d54dc26fa5d36b17373cbb00f5afd
diff --git a/makefiles/git-submodules.mk b/makefiles/git-submodules.mk
index 656d8b4..373dc23 100644
--- a/makefiles/git-submodules.mk
+++ b/makefiles/git-submodules.mk
@@ -59,8 +59,10 @@
## -----------------------------------------------------------------------
help ::
@echo
- @echo '[GIT-SUBMODULES]'
+ @echo '[GIT-SUBMODULES: docs]'
@echo ' reload Setup to auto-reload sphinx doc changes in browser'
+ @echo
+ @echo '[GIT-SUBMODULES: deps]'
@echo ' submodules Checkout dependent git submodules'
ifdef VERBOSE
@echo ' global-jjb Checkout ci-management submodule global-jjb'
diff --git a/makefiles/help/trailer.mk b/makefiles/help/trailer.mk
index c24934f..8fcdfa6 100644
--- a/makefiles/help/trailer.mk
+++ b/makefiles/help/trailer.mk
@@ -29,11 +29,14 @@
@echo ' help Display program help'
@echo ' help-verbose Display additional targets and help'
-help ::
- @echo
- @echo '[NOTE: python 3.10+]'
- @echo ' The interpreter is not yet fully supported across foreign repositories.'
- @echo ' While working locally, if make fails to build a target try:'
- @echo ' $(MAKE) $${target} NO_OTHER_REPO_DOCS=1'
+## -----------------------------------------------------------------------
+# repo::voltha-docs -- patch logic not deployed everywhere.
+## -----------------------------------------------------------------------
+# help ::
+# @echo
+# @echo '[NOTE: python 3.10+]'
+# @echo ' The interpreter is not yet fully supported across foreign repositories.'
+# @echo ' While working locally, if make fails to build a target try:'
+# @echo ' $(MAKE) $${target} NO_OTHER_REPO_DOCS=1'
# [EOF]
diff --git a/makefiles/lint/yaml/python.mk b/makefiles/lint/groovy.mk
similarity index 67%
rename from makefiles/lint/yaml/python.mk
rename to makefiles/lint/groovy.mk
index 316afd3..6baf70c 100644
--- a/makefiles/lint/yaml/python.mk
+++ b/makefiles/lint/groovy.mk
@@ -13,35 +13,39 @@
# 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-2023 Open Networking Foundation (ONF) and the ONF Contributors
-# SPDX-License-Identifier: Apache-2.0
# -----------------------------------------------------------------------
-YAML_FILES ?= $(error YAML_FILES= is required)
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
-lint-yaml-dep = $(addsuffix ^lint-yaml,$(YAML_FILES))
-lint-yaml-src = $(firstword $(subst ^,$(space),$(1)))
+groovy-check := npm-groovy-lint
+
+groovy-check-args := $(null)
+# groovy-check-args += --loglevel info
+# groovy-check-args += --ignorepattern
+# groovy-check-args += --verbose
##-------------------##
##---] TARGETS [---##
##-------------------##
-.PHONY : lint-yaml
-lint : lint-yaml
-
-lint-yaml: $(venv-activate)
-lint-yaml: $(lint-yaml-dep)
+ifndef NO-LINT-GROOVY
+ lint : lint-groovy
+endif
## -----------------------------------------------------------------------
-## Intent: Perform a lint check on yaml sources
+## Intent: Perform a lint check on command line script sources
## -----------------------------------------------------------------------
-$(lint-yaml-dep):
- $(vst-env) && yamllint -s $(call lint-yaml-src,$@)
+lint-groovy:
+ $(groovy-check) --version
+ @echo
+ $(HIDE)$(env-clean) find . -iname '*.groovy' -print0 \
+ | $(xargs-n1) $(groovy-check) $(groovy-check-args)
## -----------------------------------------------------------------------
## Intent: Display command help
## -----------------------------------------------------------------------
help-summary ::
- @echo ' lint-yaml Syntax check yaml sources (python -M yaml)'
+ @echo ' lint-groovy Syntax check groovy sources'
# [EOF]
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
index 66834a6..357b6f5 100644
--- a/makefiles/lint/include.mk
+++ b/makefiles/lint/include.mk
@@ -9,17 +9,15 @@
@echo
@echo "[LINT]"
+include $(ONF_MAKE)/lint/groovy.mk
include $(ONF_MAKE)/lint/jjb.mk
+include $(ONF_MAKE)/lint/json.mk
include $(ONF_MAKE)/lint/makefile.mk
include $(ONF_MAKE)/lint/python.mk
include $(ONF_MAKE)/lint/shell.mk
-include $(ONF_MAKE)/lint/help.mk
+include $(ONF_MAKE)/lint/yaml.mk
-ifdef YAML_FILES
- include $(ONF_MAKE)/lint/yaml/python.mk
-else
- include $(ONF_MAKE)/lint/yaml/yamllint.mk
-endif
+include $(ONF_MAKE)/lint/help.mk
$(if $(DEBUG),$(warning LEAVE))
diff --git a/makefiles/lint/json.mk b/makefiles/lint/json.mk
index 81a87da..1deeaba 100644
--- a/makefiles/lint/json.mk
+++ b/makefiles/lint/json.mk
@@ -2,7 +2,7 @@
# -----------------------------------------------------------------------
# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
-# Licensed under the Apache License, Version 2.0 (the "License");
+# 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
#
@@ -15,24 +15,78 @@
# limitations under the License.
# -----------------------------------------------------------------------
-JSON_FILES ?= $(error JSON_FILES= is rqeuired)
+$(if $(DEBUG),$(warning ENTER))
-.PHONY: lint-json
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-json lint-json-all lint-json-modified
-lint : lint-json
+have-json-files := $(if $(strip $(JSON_FILES)),true)
+JSON_FILES ?= $(error JSON_FILES= required)
## -----------------------------------------------------------------------
-## TODO: Simplify -- replace with jq -e to avoid venv dependency
+## Intent: Use the json command to perform syntax checking.
+## o If UNSTABLE=1 syntax check all sources
+## o else only check sources modified by the developer.
+## Usage:
+## % make lint UNSTABLE=1
+## % make lint-json-all
## -----------------------------------------------------------------------
-lint-json: vst_venv
- source ./$</bin/activate \
- ; set -u \
- ; for jsonfile in $(JSON_FILES); do \
- echo "Validating json file: $$jsonfile" ;\
- python -m json.tool $$jsonfile > /dev/null ;\
- done
+ifndef NO-LINT-JSON
+ lint-json-mode := $(if $(have-json-files),modified,all)
+ lint : lint-json-$(lint-json-mode)
+endif# NO-LINT-JSON
+## -----------------------------------------------------------------------
+## Intent: exhaustive json syntax checking
+## -----------------------------------------------------------------------
+json-find-args := $(null)
+json-find-args += -name '$(venv-name)'
+lint-json-all:
+ $(HIDE)$(MAKE) --no-print-directory lint-json-install
+
+ $(activate)\
+ && find . \( $(json-find-args) \) -prune -o -name '*.json' -print0 \
+ | $(xargs-n1) python -m json.tool > /dev/null ;\
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## json --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-json-modified: $(venv-activate-script)
+ $(HIDE)$(MAKE) --no-print-directory lint-json-install
+
+ $(activate)\
+ && for jsonfile in $(JSON_FILES); do \
+ echo "Validating json file: $$jsonfile" ;\
+ python -m json.tool $$jsonfile > /dev/null ;\
+ done
+
+## -----------------------------------------------------------------------
+## Intent:
+## -----------------------------------------------------------------------
+.PHONY: lint-json-install
+lint-json-install: $(venv-activate-script)
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** json syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+# $(activate) && pip install --upgrade json.tool
+# $(activate) && python -m json.tool --version (?-howto-?)
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
help::
- @echo " lint-json Syntax check json sources"
+ @echo ' lint-json Syntax check python using the json command'
+ ifdef VERBOSE
+ @echo ' lint-json-all json checking: exhaustive'
+ @echo ' lint-json-modified json checking: only modified'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
# [EOF]
diff --git a/makefiles/lint/makefile.mk b/makefiles/lint/makefile.mk
index 6e1d80a..27206e0 100644
--- a/makefiles/lint/makefile.mk
+++ b/makefiles/lint/makefile.mk
@@ -46,9 +46,15 @@
## -----------------------------------------------------------------------
## Intent: Perform a lint check on makefile sources
## -----------------------------------------------------------------------
+lint-make-ignore += JSON_FILES=
+lint-make-ignore += YAML_FILES=
lint-make:
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** Makefile syntax checking"
+ @echo "** -----------------------------------------------------------------------"
$(HIDE)$(env-clean) $(make-check-find) \
- | $(xargs-n1-local) $(make-check) $(make-check-args)
+ | $(xargs-n1-local) $(make-check) $(make-check-args) $(lint-make-ignore)
## -----------------------------------------------------------------------
## Intent: Display command help
diff --git a/makefiles/lint/yaml.mk b/makefiles/lint/yaml.mk
index b60e616..566ac18 100644
--- a/makefiles/lint/yaml.mk
+++ b/makefiles/lint/yaml.mk
@@ -2,7 +2,7 @@
# -----------------------------------------------------------------------
# Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors
#
-# Licensed under the Apache License, Version 2.0 (the "License");
+# 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
#
@@ -15,18 +15,68 @@
# limitations under the License.
# -----------------------------------------------------------------------
-YAML_FILES ?= $(error YAML_FILES= is required)
+$(if $(DEBUG),$(warning ENTER))
-.PHONY: lint-yaml
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+.PHONY: lint-yaml lint-yaml-all lint-yaml-modified
-lint : lint-yaml
+have-yaml-files := $(if $(strip $(YAML_FILES)),true)
+YAML_FILES ?= $(error YAML_FILES= is required)
-lint-yaml: vst_venv
- source ./$</bin/activate \
- ; set -u \
- ; yamllint -s $(YAML_FILES)
+## -----------------------------------------------------------------------
+## Intent: Use the yaml command to perform syntax checking.
+## o If UNSTABLE=1 syntax check all sources
+## o else only check sources modified by the developer.
+## Usage:
+## % make lint UNSTABLE=1
+## % make lint-yaml-all
+## -----------------------------------------------------------------------
+ifndef NO-LINT-YAML
+ lint-yaml-mode := $(if $(have-yaml-files),modified,all)
+ lint : lint-yaml-$(lint-yaml-mode)
+endif# NO-LINT-YAML
+## -----------------------------------------------------------------------
+## Intent: exhaustive yaml syntax checking
+## -----------------------------------------------------------------------
+lint-yaml-all:
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+
+ find . \( -iname '*.yaml' -o -iname '*.yml' \) -print0 \
+ | $(xargs-n1-clean) yamllint --strict
+
+## -----------------------------------------------------------------------
+## Intent: check deps for format and python3 cleanliness
+## Note:
+## yaml --py3k option no longer supported
+## -----------------------------------------------------------------------
+lint-yaml-modified:
+ $(HIDE)$(MAKE) --no-print-directory lint-yaml-install
+ yamllint -s $(YAML_FILES)
+
+## -----------------------------------------------------------------------
+## Intent:
+## -----------------------------------------------------------------------
+lint-yaml-install:
+ @echo
+ @echo "** -----------------------------------------------------------------------"
+ @echo "** yaml syntax checking"
+ @echo "** -----------------------------------------------------------------------"
+ yamllint --version
+ @echo
+
+## -----------------------------------------------------------------------
+## Intent: Display command usage
+## -----------------------------------------------------------------------
help::
- @echo " lint-yaml Syntax check yaml source using yamllint"
+ @echo ' lint-yaml Syntax check python using the yaml command'
+ ifdef VERBOSE
+ @echo ' lint-yaml-all yaml checking: exhaustive'
+ @echo ' lint-yaml-modified yaml checking: only modified'
+ endif
+
+$(if $(DEBUG),$(warning LEAVE))
# [EOF]
diff --git a/makefiles/lint/yaml/.yamllint b/makefiles/lint/yaml/.yamllint
deleted file mode 100644
index 6a4fc1e..0000000
--- a/makefiles/lint/yaml/.yamllint
+++ /dev/null
@@ -1,45 +0,0 @@
-# -*- 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
-# -----------------------------------------------------------------------
----
-
-yaml-files:
- - '*.yaml'
- - '*.yml'
- - '.yamllint'
-
-rules:
- document-start: disable
- line-length:
- max: 160
-
-# -----------------------------------------------------------------------
-# .. seealso: https://gerrit.opencord.org/plugins/gitiles/helm-repo-tools/+/refs/heads/master/yamllint.conf
-# -----------------------------------------------------------------------
-#
-# extends: default
-#
-#rules:
-# empty-lines:
-# max-end: 1
-# line-length:
-# max: 120
-# braces:
-# min-spaces-inside: 0
-# max-spaces-inside: 1
diff --git a/makefiles/lint/yaml/todo b/makefiles/lint/yaml/todo
deleted file mode 100644
index 8a9367b..0000000
--- a/makefiles/lint/yaml/todo
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2022 Open Networking Foundation (ONF) and the ONF Contributors
-# -----------------------------------------------------------------------
-
-##-------------------##
-##---] GLOBALS [---##
-##-------------------##
-env-clean = /usr/bin/env --ignore-environment
-xargs-n1 := xargs -0 -t -n1 --no-run-if-empty
-
-yamllint := $(env-clean) $(YAMLLINT)
-yamllint-args := -c .yamllint
-
-##-------------------##
-##---] TARGETS [---##
-##-------------------##
-lint : lint-yaml
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-lint-yaml:
- $(HIDE)$(env-clean) find . -name '*.yaml' -type f -print0 \
- | $(xargs-n1) $(yamllint) $(yamllint-args)
-
-## -----------------------------------------------------------------------
-## -----------------------------------------------------------------------
-help:
- @echo
- @echo "USAGE: $(MAKE)"
- @echo " lint perform syntax checks on source"
- @echo " test perform syntax checks on source"
- @echo " pre-check Verify tools and deps are available for testing"
- @echo
- @echo "[LINT]"
- @echo " lint-json Syntax check .json sources"
- @echo " lint-yaml Syntax check .yaml sources"
- @echo
-# [EOF]
diff --git a/makefiles/lint/yaml/urls b/makefiles/lint/yaml/urls
deleted file mode 100644
index 8747658..0000000
--- a/makefiles/lint/yaml/urls
+++ /dev/null
@@ -1,5 +0,0 @@
-# -*- makefile -*-
-
-https://yamllint.readthedocs.io/en/stable/configuration.html
-
-# [EOF]
\ No newline at end of file
diff --git a/makefiles/lint/yaml/yamllint.helm b/makefiles/lint/yaml/yamllint.helm
deleted file mode 100644
index 6c7787b..0000000
--- a/makefiles/lint/yaml/yamllint.helm
+++ /dev/null
@@ -1,32 +0,0 @@
-# -*- 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
-# -----------------------------------------------------------------------
----
-# yamllint.conf
-
-extends: default
-
-rules:
- empty-lines:
- max-end: 1
- line-length:
- max: 120
- braces:
- min-spaces-inside: 0
- max-spaces-inside: 1
diff --git a/makefiles/lint/yaml/yamllint.mk b/makefiles/lint/yaml/yamllint.mk
deleted file mode 100644
index dc4e015..0000000
--- a/makefiles/lint/yaml/yamllint.mk
+++ /dev/null
@@ -1,59 +0,0 @@
-# -*- makefile -*-
-# -----------------------------------------------------------------------
-# Copyright 2022-2023 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-2023 Open Networking Foundation (ONF) and the ONF Contributors
-# SPDX-License-Identifier: Apache-2.0
-# -----------------------------------------------------------------------
-
-$(if $(DEBUG),$(warning ENTER))
-
-yamllint := $(env-clean) yamllint
-
-## -------------------------------
-## Add requirement(s) for checking
-## -------------------------------
-# yamllint-cfg := .yamllint
-yamllint-cfg := yamllint.helm
-yamllint-conf = $(wildcard $(yamllint-cfg) $(MAKEDIR)/lint/yaml/$(yamllint-cfg))
-yamllint-args += $(addprefix --config-file$(space),$(yamllint-conf))
-
-# yamllint-args := --no-warnings
-# yamllint-args := --strict
-
-yamllint-find := find .
-yamllint-find += -name 'vendor' -prune
-yamllint-find += -o -name '*.yaml'
-yamllint-find += ! -name '\.\#*.yaml'
-yamllint-find += -type f
-yamllint-find += -print0
-
-## -----------------------------------------------------------------------
-## Intent: Perform a lint check on yaml sources
-## -----------------------------------------------------------------------
-lint lint-yaml:
- $(HIDE)$(env-clean) $(yamllint-find) \
- | $(xargs-n1-clean) -t $(yamllint) $(yamllint-args)
-# | xargs -0 --no-run-if-empty -t -n1 $(yamllint) $(yamllint-args)
-
-## -----------------------------------------------------------------------
-## Intent: Display command help
-## -----------------------------------------------------------------------
-help::
- @echo " lint-yaml Syntax check yaml sources (yamllint)"
-
-$(if $(DEBUG),$(warning ENTER))
-
-# [EOF]
diff --git a/makefiles/virtualenv.mk b/makefiles/virtualenv.mk
index 628f166..2e12f24 100644
--- a/makefiles/virtualenv.mk
+++ b/makefiles/virtualenv.mk
@@ -1,6 +1,6 @@
# -*- makefile -*-
## -----------------------------------------------------------------------
-# Copyright 2017-2023 Open Networking Foundation
+# Copyright 2017-2023 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.
@@ -25,11 +25,14 @@
##------------------##
##---] LOCALS [---##
##------------------##
-venv-name ?= .venv
+venv-name ?= .venv# # default install directory
venv-abs-path := $(PWD)/$(venv-name)
venv-activate-script := $(venv-name)/bin/activate# # dependency
-activate ?= source $(venv-activate-script)# # cmd invocation
+
+# Intent: activate= is a macro for accessing the virtualenv activation script#
+# Usage: $(activate) && python
+activate ?= set +u && source $(venv-activate-script) && set -u
## -----------------------------------------------------------------------
## Intent: Activate script path dependency
@@ -38,12 +41,15 @@
## o When the script does not exist install the virtual env and display.
## -----------------------------------------------------------------------
$(venv-activate-script):
- virtualenv -p python3 $(venv-name)\
- && source $(venv-name)/bin/activate\
- && python -m pip install --upgrade pip\
- && pip install --upgrade setuptools\
- && { [[ -r requirements.txt ]] && python -m pip install -r requirements.txt; }\
- && python --version
+ @echo
+ @echo "============================="
+ @echo "Installing python virtual env"
+ @echo "============================="
+ virtualenv -p python3 $(venv-name)
+ $(activate) && python -m pip install --upgrade pip
+ $(activate) && pip install --upgrade setuptools
+ $(activate) && { [[ -r requirements.txt ]] && python -m pip install -r requirements.txt; }
+ $(activate) && python --version
## -----------------------------------------------------------------------
## Intent: Explicit named installer target w/o dependencies.