Bulk merge from repo:ci-managment
Change-Id: I7b733b43699b47deaaec2fe433987619b6928158
diff --git a/makefiles/docker/include.mk b/makefiles/docker/include.mk
index 6562631..cd02827 100644
--- a/makefiles/docker/include.mk
+++ b/makefiles/docker/include.mk
@@ -17,8 +17,20 @@
$(if $(DEBUG),$(warning ENTER))
+# Per-repository
+include $(ONF_MAKEDIR)/docker/config/$(--repo-name--).mk
+
+# ------------------- ##
+# ---] GLOBALS [--- ##
+# ------------------- ##
VOLTHA_TOOLS_VERSION ?= 2.4.0
+# ---------------------------------
+# Induce error for misconfiguration
+# ---------------------------------
+go-cobertura-docker-mount ?= $(error go-cobertura-docker-mount= is required)
+protoc-sh-docker-mount ?= $(error protoc-sh-docker-mount= is required)
+
# ---------------------------
# Macros: command refactoring
# ---------------------------
@@ -34,8 +46,6 @@
is-stdin = $(shell test -t 0 && { echo '--interactive'; })
is-stdin += --tty
-voltha-protos-v5 ?= /go/src/github.com/opencord/voltha-protos/v5
-
# Docker volume mounts: container:/app/release <=> localhost:{pwd}/release
vee-golang = -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg
vee-citools = voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION}
@@ -45,43 +55,105 @@
# ---------------
docker-go-stem = $(docker-run-app) -v gocache:/.cache $(vee-golang) $(vee-citools)-golang
-# Usage: GO := $(call get-docker-go,./my.env.temp)
-get-docker-go = $(docker-go-stem) go
-GO ?= $(call get-docker-go)
+# -----------------------------------------------------------------------
+# Usage: GO := $(call get-cmd-docker-go)
+# -----------------------------------------------------------------------
+get-cmd-docker-go = $(docker-go-stem) go
+GO ?= $(call get-cmd-docker-go)
+# -----------------------------------------------------------------------
# Usage: GO_SH := $(call get-docker-go-sh,./my.env.temp)
-get-docker-go-sh = $(docker-go-stem) $(if $(1),--env-file $(1)) sh -c
-GO_SH ?= $(call get-docker-go-sh,./my.env.temp)
+# - populate my.env.temp with shell content to pass in
+# -----------------------------------------------------------------------
+get-cmd-docker-go-sh = $(docker-go-stem) $(if $(1),--env-file $(1)) sh -c
+GO_SH ?= $(call get-cmd-docker-go-sh,./my.env.temp)
-# Usage: PROTOC := $(call get-docker-protoc)
-get-docker-protoc = $(docker-run-app) $(vee-citools)-protoc protoc
-PROTOC ?= $(call get-docker-protoc)
+# -----------------------------------------------------------------------
+# Usage: PROTOC := $(call get-cmd-docker-protoc)
+# -----------------------------------------------------------------------
+get-cmd-docker-protoc = $(docker-run-app) $(vee-citools)-protoc protoc
+PROTOC ?= $(call get-cmd-docker-protoc)
+
+# -----------------------------------------------------------------------
+# Usage: PROTOC_SH := $(call get-cmd-docker-protoc-sh)
+# -----------------------------------------------------------------------
+get-cmd-docker-protoc-sh =\
+ $(strip \
+ $(docker-run-is) \
+ $(if $(protc-sh-docker-mount), \
+ -v ${CURDIR}:$(protoc-sh-docker-mount) \
+ --workdir=$(protoc-sh-docker-mount) \
+ ) \
+ $(vee-citools)-protoc \
+ sh -c \
+ )
+PROTOC_SH ?= $(call get-cmd-docker-protoc-sh)
# get-docker-protoc-sh = $(strip )
-PROTOC_SH = $(docker-run-is)
-ifdef voltha-protos-v5
- PROTOC_SH += -v ${CURDIR}:$(voltha-protos-v5)
- PROTOC_SH += --workdir=$(voltha-protos-v5)
-endif
-PROTOC_SH += $(vee-citools)-protoc sh -c
+#PROTOC_SH = $(docker-run-is)
+#ifdef protc-sh-docker-mount
+# PROTOC_SH += -v ${CURDIR}:$(protoc-sh-docker-mount)
+# PROTOC_SH += --workdir=$(protoc-sh-docker-mount)
+#endif # protoc-sh-docker-mount
+#PROTOC_SH += $(vee-citools)-protoc sh -c
# Usage: GO_JUNIT_REPORT := $(call get-docker-go-junit-repo)
# get-docker-go-junit-repo = $(docker-run-app) $(vee-citools)-go-junit-report go-junit-report
# GO_JUNIT_REPORT ?= $(call get-docker-go-junit-repo)
-# Usage: GOCOVER_COBERTURA := $(call get-docker-gocover-cobertura)
+# -----------------------------------------------------------------------
# get-docker-gocover-cobertura = $(docker-run-app)/src/github.com/opencord/voltha-openolt-adapter $(vee-citools)-gocover-cobertura gocover-cobertura
# GOCOVER_COBERTURA ?= $(call get-docker-gocover-cobertura)
-GO_JUNIT_REPORT = $(docker-run) -v ${CURDIR}:/app -i $(vee-citools)-go-junit-report go-junit-report
-GOCOVER_COBERTURA = $(docker-run) -v ${CURDIR}:/app/src/github.com/opencord/voltha-openolt-adapter -i $(vee-citools)-gocover-cobertura gocover-cobertura
+## -----------------------------------------------------------------------
+## Coverage report: junit
+## -----------------------------------------------------------------------
+## Usage: GO_JUNIT_REPORT ?= $(call get-go-junit-report-cmd)
+## -----------------------------------------------------------------------
+get-go-junit-report-cmd =\
+ $(strip \
+ $(docker-run) \
+ -v ${CURDIR}:/app \
+ -i $(vee-citools)-go-junit-report go-junit-report \
+ )
+GO_JUNIT_REPORT ?= $(call get-go-junit-report-cmd)
+## -----------------------------------------------------------------------
+## Coverage report: cobertura
+## -----------------------------------------------------------------------
+## Usage: GOCOVER_COBERTURA ?= $(call get-docker-gocover-cobertura-cmd)
+## -----------------------------------------------------------------------
+get-docker-go-cobertura-cmd =\
+ $(strip \
+ $(docker-run)\
+ -v ${CURDIR}:$(go-cobertura-docker-mount)\
+ -i $(vee-citools)-gocover-cobertura gocover-cobertura\
+ )
+GOCOVER_COBERTURA ?= $(call get-docker-go-cobertura-cmd)
-get-golangci-lint = $(docker-run-app) -v gocache:/.cache $(vee-golang) $(vee-citools)-golangci-lint golangci-lint
-GOLANGCI_LINT ?= $(call get-golangci-lint)
+## -----------------------------------------------------------------------
+##
+## -----------------------------------------------------------------------
+get-cmd-docker-golangci-lint =\
+ $(strip \
+ $(docker-run-app) \
+ -v gocache:/.cache \
+ $(vee-golang)\
+ $(vee-citools)-golangci-lint\
+ golangci-lint\
+ )
+GOLANGCI_LINT ?= $(call get-cmd-docker-golangci-lint)
-get-docker-hadolint = $(docker-run-app) $(vee-citools)-hadolint hadolint
-HADOLINT ?= $(call get-docker-hadolint)
+## -----------------------------------------------------------------------
+##
+## -----------------------------------------------------------------------
+get-docker-hadolint =\
+ $(strip \
+ $(docker-run-app) \
+ $(vee-citools)-hadolint \
+ hadolint \
+ )
+HADOLINT ?= $(call get-docker-hadolint)
$(if $(DEBUG),$(warning LEAVE))