github release (golang mia) debugging.
jjb/shell/github-release.sh
---------------------------
o Temporarily disable exit-on-failure within displayCommand().
o Allow progression toward manifestation of the original failure.
o Shellcheck cleanups.
jjb/verify/bbsim.yaml
---------------------
o Remove v2.9 & v2.10 job placeholders, must have misheard the request
earlier because the need now is only for v2.11 views.
packer/provision/basebuild.sh
-----------------------------
o shellcheck: quote $(go env GOPATH) to prevent word/path splitting.
makefiles/
----------
o Added library makefiles/ subdirectory to support more lint targets.
o Makefile proper will need to be updated.
Change-Id: Icc766b90ffe798fe12c0376787f2298a68babbd4
diff --git a/jjb/shell/github-release.sh b/jjb/shell/github-release.sh
index 47e6ce8..0b289ec 100644
--- a/jjb/shell/github-release.sh
+++ b/jjb/shell/github-release.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-
-# Copyright 2018-2022 Open Networking Foundation (ONF) and the ONF Contributors
+# -----------------------------------------------------------------------
+# Copyright 2018-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.
@@ -13,11 +13,12 @@
# 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.
-
+#
# github-release.sh
# builds (with make) and uploads release artifacts (binaries, etc.) to github
# given a tag also create checksums files and release notes from the commit
# message
+# -----------------------------------------------------------------------
## -----------------------------------------------------------------------
## Intent:
@@ -32,6 +33,8 @@
## -----------------------------------------------------------------------
function displayCommands()
{
+ set +euo pipefail
+
echo
echo "Installed /usr/lib/go"
echo "-----------------------------------------------------------------------"
@@ -48,6 +51,7 @@
git --version
go version
+ set -euo pipefail
return
}
@@ -105,7 +109,7 @@
# - start release process within that directory
DEST_GOPATH=${DEST_GOPATH:-}
-if [ ! -z "$DEST_GOPATH" ]; then
+if [ -n "$DEST_GOPATH" ]; then
mkdir -p "$GOPATH/src/$DEST_GOPATH"
release_path="$GOPATH/src/$DEST_GOPATH/$GERRIT_PROJECT"
mv "$WORKSPACE/$GERRIT_PROJECT" "$release_path"
@@ -167,3 +171,10 @@
popd
fi
+
+# [SEE ALSO]
+# -----------------------------------------------------------------------
+# https://www.shellcheck.net/wiki/SC2236
+# -----------------------------------------------------------------------
+
+# [EOF]
diff --git a/jjb/verify/bbsim.yaml b/jjb/verify/bbsim.yaml
index 2c6cfd1..f156b67 100644
--- a/jjb/verify/bbsim.yaml
+++ b/jjb/verify/bbsim.yaml
@@ -12,10 +12,6 @@
name-extension: '-voltha-2.8'
override-branch: 'voltha-2.8'
branch-regexp: '^voltha-2.8$'
- - 'verify-bbsim-jobs-voltha-2.9':
- name-extension: '-voltha-2.9'
- override-branch: 'voltha-2.9'
- branch-regexp: '^voltha-2.9$'
- 'verify-bbsim-jobs-voltha-2.10':
name-extension: '-voltha-2.10'
override-branch: 'voltha-2.10'
diff --git a/makefiles/consts.mk b/makefiles/consts.mk
new file mode 100644
index 0000000..fed358b
--- /dev/null
+++ b/makefiles/consts.mk
@@ -0,0 +1,26 @@
+# -*- 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.
+# -----------------------------------------------------------------------
+
+null :=#
+space :=$(null) $(null)
+dot :=.
+HIDE ?=@
+
+# use bash for pusdh/popd and quick failures.
+export SHELL := bash -euo pipefail
+
+# [EOF]
diff --git a/makefiles/help/include.mk b/makefiles/help/include.mk
new file mode 100644
index 0000000..3cca2cd
--- /dev/null
+++ b/makefiles/help/include.mk
@@ -0,0 +1,43 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# 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.
+# 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.
+# -----------------------------------------------------------------------
+
+# Parent makefile should include this early so help
+# message will be prefixed by a usage statement.
+help ::
+ @echo "Usage: $(MAKE) [options] [target] ..."
+ @echo
+ @echo '[Virtual Env]'
+ @echo ' venv Create a python virtual environment'
+ @echo " $(VENV_NAME)"
+ @echo
+ @echo '[CLEAN]'
+ @echo ' clean Remove generated targets'
+ @echo ' sterile clean + remove virtual env interpreter install'
+ @echo
+ @echo '[VIEW]'
+ @echo ' reload Setup to auto-reload sphinx doc changes in browser'
+ @echo ' view-html View generated documentation'
+ @echo
+ @echo '[TEST]'
+ @echo ' test make lint linkcheck'
+ @echo ' test-all make all-generation-targets'
+ @echo
+ @echo '[HELP]'
+ @echo ' help Display program help'
+ @echo ' help-verbose Display additional targets and help'
+
+# [EOF]
diff --git a/makefiles/help/trailer.mk b/makefiles/help/trailer.mk
new file mode 100644
index 0000000..bf548db
--- /dev/null
+++ b/makefiles/help/trailer.mk
@@ -0,0 +1,27 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2022 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.
+# -----------------------------------------------------------------------
+
+# include this makefile late so text will be displayed at the end6
+
+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/help/variables.mk b/makefiles/help/variables.mk
new file mode 100644
index 0000000..a50b233
--- /dev/null
+++ b/makefiles/help/variables.mk
@@ -0,0 +1,36 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2022 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.
+# -----------------------------------------------------------------------
+
+# Include variables.mk after library makefiles have been included
+
+ifdef VERBOSE
+ help :: help-variables
+else
+ help ::
+ @echo
+ @echo '[VARIABLES] - Conditional makefile behavior'
+ @echo ' see also: help-variables'
+endif
+
+help-variables:
+ @echo
+ @echo '[VARIABLES] - Conditional makefile behavior'
+ @echo ' NO_PATCHES= Do not apply patches to the python virtualenv'
+ @echo ' NO_OTHER_REPO_DOCS= No foreign repos, only apply target to local sources.'
+ @echo ' VERBOSE= Display extended help'
+
+# [EOF]
diff --git a/makefiles/lint/include.mk b/makefiles/lint/include.mk
new file mode 100644
index 0000000..bed7149
--- /dev/null
+++ b/makefiles/lint/include.mk
@@ -0,0 +1,28 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# 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.
+# 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.
+# -----------------------------------------------------------------------
+
+help::
+ @echo
+ @echo "[LINT]"
+
+include $(MAKEDIR)/lint/json.mk
+# include $(MAKEDIR)/lint/python.mk
+# include $(MAKEDIR)/lint/robot.mk
+include $(MAKEDIR)/lint/shell.mk
+include $(MAKEDIR)/lint/yaml.mk
+
+# [EOF]
diff --git a/makefiles/lint/json.mk b/makefiles/lint/json.mk
new file mode 100644
index 0000000..81a87da
--- /dev/null
+++ b/makefiles/lint/json.mk
@@ -0,0 +1,38 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# 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.
+# 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.
+# -----------------------------------------------------------------------
+
+JSON_FILES ?= $(error JSON_FILES= is rqeuired)
+
+.PHONY: lint-json
+
+lint : lint-json
+
+## -----------------------------------------------------------------------
+## TODO: Simplify -- replace with jq -e to avoid venv dependency
+## -----------------------------------------------------------------------
+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
+
+help::
+ @echo " lint-json Syntax check json sources"
+
+# [EOF]
diff --git a/makefiles/lint/python.mk b/makefiles/lint/python.mk
new file mode 100644
index 0000000..5aecd58
--- /dev/null
+++ b/makefiles/lint/python.mk
@@ -0,0 +1,34 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2022 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.
+# -----------------------------------------------------------------------
+
+PYTHON_FILES ?= $(error PYTHON_FILES= is required)
+
+.PHONY: lint-python
+
+lint : lint-python
+
+# check deps for format and python3 cleanliness
+lint-python: vst_venv
+ source ./$</bin/activate \
+ ; set -u \
+ ; pylint --py3k $(PYTHON_FILES) \
+ ; flake8 --max-line-length=99 --count $(PYTHON_FILES)
+
+help::
+ @echo " lint-python Syntax check using pylint and flake8"
+
+# [EOF]
diff --git a/makefiles/lint/robot.mk b/makefiles/lint/robot.mk
new file mode 100644
index 0000000..ec5579e
--- /dev/null
+++ b/makefiles/lint/robot.mk
@@ -0,0 +1,41 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2022 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.
+# -----------------------------------------------------------------------
+
+ROBOT_FILES ?= $(error ROBOT_FILES= is required)
+
+LINT_ARGS ?= --verbose --configure LineTooLong:130 -e LineTooLong \
+ --configure TooManyTestSteps:65 -e TooManyTestSteps \
+ --configure TooManyTestCases:50 -e TooManyTestCases \
+ --configure TooFewTestSteps:1 \
+ --configure TooFewKeywordSteps:1 \
+ --configure FileTooLong:2000 -e FileTooLong \
+ -e TrailingWhitespace
+
+
+.PHONY: lint-robot
+
+lint : lint-robot
+
+lint-robot: vst_venv
+ source ./$</bin/activate \
+ ; set -u \
+ ; rflint $(LINT_ARGS) $(ROBOT_FILES)
+
+help::
+ @echo " lint-robot Syntax check robot sources using rflint"
+
+# [EOF]
diff --git a/makefiles/lint/shell.mk b/makefiles/lint/shell.mk
new file mode 100644
index 0000000..c05476e
--- /dev/null
+++ b/makefiles/lint/shell.mk
@@ -0,0 +1,33 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# 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.
+# 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.
+# -----------------------------------------------------------------------
+
+JSON_FILES ?= $(error JSON_FILES= is required)
+
+.PHONY: lint-shell
+
+lint : lint-shell
+
+lint-shell:
+ shellcheck --version
+ find . \( -name 'staging' -o -name 'vst_venv' \) -prune \
+ -o -name '*.sh' ! -name 'activate.sh' -print0 \
+ | xargs -0 -n1 shellcheck
+
+help::
+ @echo " lint-shell Syntax check bash,bourne,etc sources"
+
+# [EOF]
diff --git a/makefiles/lint/yaml.mk b/makefiles/lint/yaml.mk
new file mode 100644
index 0000000..00241b3
--- /dev/null
+++ b/makefiles/lint/yaml.mk
@@ -0,0 +1,32 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# 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.
+# 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.
+# -----------------------------------------------------------------------
+
+YAML_FILES ?= $(error YAML_FILES= is required)
+
+.PHONY: lint-yaml
+
+lint : lint-yaml
+
+lint-yaml: vst_venv
+ source ./$</bin/activate \
+ ; set -u \
+ ; yamllint -s $(YAML_FILES)
+
+help::
+ @echo " lint-yaml Syntax check yaml source using yamllint"
+
+# [EOF]
diff --git a/makefiles/virtualenv.mk b/makefiles/virtualenv.mk
new file mode 100644
index 0000000..008a372
--- /dev/null
+++ b/makefiles/virtualenv.mk
@@ -0,0 +1,33 @@
+# -*- makefile -*-
+## -----------------------------------------------------------------------
+# Copyright 2017-2022 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.
+## -----------------------------------------------------------------------
+
+## usage: {target} : venv-req
+# venv : .venv/bin/activate requirements.txt
+venv-dep : .venv/bin/activate
+venv-req : .venv/bin/activate requirements.txt
+
+.venv/bin/activate:
+ virtualenv -p python3 $@
+ source ./$@/bin/activate \
+ pip install --upgrade pip \
+ source ./$@/bin/activate \
+ pip install --upgrade setuptools \
+ [[ -r requirements.txt ]] \
+ && source ./$@/bin/activate \
+ && python -m pip install -r requirements.txt
+
+# [EOF]
diff --git a/packer/provision/basebuild.sh b/packer/provision/basebuild.sh
index 22b8953..8e9b3e5 100644
--- a/packer/provision/basebuild.sh
+++ b/packer/provision/basebuild.sh
@@ -323,7 +323,7 @@
# dep for go package dependencies w/versioning, version 0.5.2, adapted from:
# https://golang.github.io/dep/docs/installation.html#install-from-source
go get -d -u github.com/golang/dep
- pushd $(go env GOPATH)/src/github.com/golang/dep
+ pushd "$(go env GOPATH)/src/github.com/golang/dep"
git checkout "0.5.2"
go install -ldflags="-X main.version=0.5.2" ./cmd/dep
popd
@@ -335,7 +335,7 @@
# protoc-gen-go - Golang protbuf compiler extension for protoc (installed
# below)
go get -d -u github.com/golang/protobuf/protoc-gen-go
- pushd $(go env GOPATH)/src/github.com/golang/protobuf
+ pushd "$(go env GOPATH)/src/github.com/golang/protobuf"
git checkout "v1.3.1"
go install ./protoc-gen-go
popd
@@ -458,3 +458,5 @@
# execute steps for all systems
all_systems
+
+# [EOF]