VOL-4883 - Publish a new bbsim release
https://github.com/opencord/bbsim/releases/tag/untagged-6d947de2a6078a1fe175
----------------------------------------------------------------------------
o Draft bbsim release v2.96.8572 created by this patch set.
o All 6cross-compile binaries are now included.
o Change ID + commit message document the release.
o Binaries downloaded/tested using {bbr,bbsim,bbsimctl} --help
Makefile
--------
o Makefile release target is now able to cross compile all binaries:
- bbsimctl cross compiled to arm, darwin, linux and windows.
- release-{bbr, bbsim} only built *-linux-amd64
o Refactor targets into a more modular and hierarchial setup.
o Be sure to create RELEASE_DIR early on localhost so docker
container can create a volume (NFS mount) for building into.
o Display banners when building targets to improve log readability.
o Clean targets updated to remove everything generated.
o Help targets added to document indvidual target logic.
o Makefile logic heavily commented.
makefiles/release/bbr.mk
makefiles/release/bbsim.mk
makefiles/release/bbsimctl.mk
-----------------------------
o Relocate build-* and release-* target logic into named makefiles.
o Update SHELL to set -euo pipefail to detect uninit shell vars.
o Replaced shell/looping logic with true makefile target dependencies:
- shell/loop replaced with a target rule that builds one platform binary.
- Derive a list of targets release/{bbr,bbsim,bbsimctl}-{os}-{arch}
- release: depends on all buildable targets
- release rule can extract arch= and os= from target path being built.
- To simplify logic construct env vars separately into a response file.
- passed as "docker --env-file [x]" VS appending to an ever growing command line.
o Marked more targets as .PHONY so they will always build.
o Added helper target 'onf-publish' for exercising changes in the github-release script.
makefiles/include.mk
--------------------
o Single include for importing all library makefiles.
makefiles/consts.mk
-------------------
o Include fixed values, esp $(quote-single) which is now used to document
o Refactor duplication in GO_* macros into named/reused values to shorten lines.
makefiles/lint
--------------
o Moved lint::docker (hadolint target) into makefiles/lint/docker/*.mk.
o Added makefiles/lint library targets for ability to lint more sources.
makefiles/tools.mk
------------------
o Refactor DOCKER_* and GO_* macros into a named includable makefile.q
Change-Id: I8791317ba0c3f01d047f363e69f8885a03f1a1a1
diff --git a/makefiles/lint/docker/get.sh b/makefiles/lint/docker/get.sh
new file mode 100644
index 0000000..4e4a7f6
--- /dev/null
+++ b/makefiles/lint/docker/get.sh
@@ -0,0 +1,64 @@
+#!/bin/bash
+# -----------------------------------------------------------------------
+# Copyright 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: 2023 Open Networking Foundation (ONF) and the ONF Contributors
+# SPDX-License-Identifier: Apache-2.0
+# -----------------------------------------------------------------------
+
+## -----------------------------------------------------------------------
+## Intent: Install a bbsim binary for local development use.
+## -----------------------------------------------------------------------
+## Note: A python or golang script may be a simpler answer.
+## Interpreter modules provide answers for uname -{a,m,o}
+## with dictionary translation into needed values.
+## -----------------------------------------------------------------------
+
+# import platform
+# platform.processor()
+# platform.system # Windows
+
+# lshw: width: 64 bits
+
+# >>> import platform
+# >>> platform.machine()
+# 'x86'
+
+
+# $ uname -m
+# armv7l
+
+## which arch
+# https://github.com/hadolint/hadolint/releases/tag/v2.12.0
+case "$(uname -a)" in
+ *x86_64*)
+esac
+
+os=''
+case "$(uname -o)" in
+ *Linux*) os='Linux'
+esac
+
+
+# hadolint-Darwin-x86_64
+# hadolint-Darwin-x86_64.sha256
+# hadolint-Linux-arm64
+# hadolint-Linux-arm64.sha256
+# hadolint-Linux-x86_64
+# hadolint-Linux-x86_64.sha256
+# hadolint-Windows-x86_64.exe
+# hadolint-Windows-x86_64.exe.sha256
+# Source code (zip)
+# Source code (tar.gz)
diff --git a/makefiles/lint/docker/hadolint.mk b/makefiles/lint/docker/hadolint.mk
new file mode 100644
index 0000000..eb182f7
--- /dev/null
+++ b/makefiles/lint/docker/hadolint.mk
@@ -0,0 +1,80 @@
+# -*- 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.
+# -----------------------------------------------------------------------
+
+##-------------------##
+##---] GLOBALS [---##
+##-------------------##
+
+HADOLINT = $(docker-run-app) $(is-stdin) $(vee-citools)-hadolint hadolint
+
+ifdef LOCAL_LINT
+ lint-hadolint-dep = lint-hadolint-local
+else
+ lint-hadolint-dep = lint-hadolint
+endif
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+.PHONY: $(lint-hadolint-dep)
+
+lint : $(lint-hadolint-dep)
+
+lint-dockerfile : $(lint-hadolint-dep)
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+lint-hadolint:
+
+ @echo
+ @echo '** -------------------------------------------------------------'
+ @echo "** $(MAKE): processing target [$@]"
+ @echo '** -------------------------------------------------------------'
+ $(HIDE)${HADOLINT} $$(find ./build -name "Dockerfile*")
+ @echo "Dockerfile lint check OK"
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+hadolint-cmd := ./hadolint-Linux-x86_64
+
+lint-hadolint-local: hadolint-get
+ $(hadolint-cmd) $$(find ./build -name "Dockerfile*")
+
+## -----------------------------------------------------------------------
+## Intent: Retrieve the hadolint tool
+## https://github.com/hadolint/hadolint/releases/tag/v2.12.0
+## -----------------------------------------------------------------------
+hadolint-get:
+ true
+# $(MAKECMDGOALS)/lint/docker/get.sh
+# $(GIT) clone https://github.com/hadolint/hadolint.git
+# wget https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+help ::
+ @echo ' lint-dockerfile Perform all dockerfile lint checks'
+ @echo ' lint-hadolint Dockerfile lint check'
+
+## -----------------------------------------------------------------------
+## -----------------------------------------------------------------------
+todo ::
+ @echo ' o Update lint-dockerfile to run all dockerfile lint checks'
+
+# [SEE ALSO]
+# https://github.com/hadolint/hadolint
+
+# [EOF]
diff --git a/makefiles/lint/docker/include.mk b/makefiles/lint/docker/include.mk
new file mode 100644
index 0000000..4a9a9f6
--- /dev/null
+++ b/makefiles/lint/docker/include.mk
@@ -0,0 +1,26 @@
+# -*- makefile -*-
+# -----------------------------------------------------------------------
+# Copyright 2017-2023 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.
+# -----------------------------------------------------------------------
+
+help::
+ @echo
+ @echo "[LINT]"
+ @echo " lint Static code analysis/syntax checking"
+ @echo " LOCAL_LINT=1 Enable local linting w/o docker & jenkins overhead"
+
+include $(MAKEDIR)/lint/docker/hadolint.mk
+
+# [EOF]