Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 1 | # -*- makefile -*- |
| 2 | # ----------------------------------------------------------------------- |
| 3 | # Copyright 2017-2023 Open Networking Foundation (ONF) and the ONF Contributors |
| 4 | # |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License.d |
| 16 | # ----------------------------------------------------------------------- |
| 17 | |
| 18 | $(if $(DEBUG),$(warning ENTER)) |
| 19 | |
| 20 | # tool containers |
| 21 | VOLTHA_TOOLS_VERSION ?= 2.4.0 |
| 22 | |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 23 | docker-run := docker |
| 24 | ifdef DOCKER_DEBUG |
| 25 | docker-run += --debug |
| 26 | endif |
| 27 | docker-run += run --rm --user $$(id -u):$$(id -g)# # Docker command stem |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 28 | docker-run-app = $(docker-run) -v ${CURDIR}:/app# # w/filesystem mount |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 29 | |
| 30 | ## GhostBusters: Cross the streams |
| 31 | ## Always pass -it to attach streams, jenkins + docker == test -t fail |
Joey Armstrong | 670d40c | 2023-05-11 20:49:26 -0400 | [diff] [blame] | 32 | is-stdin = $(shell test -t 0 && { echo '--interactive' })# # Attach streams if interactive |
| 33 | is-stdin += --tty# # Attach stdout else jenkins::docker is silent |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 34 | |
| 35 | # Docker volume mounts: container:/app/release <=> localhost:{pwd}/release |
| 36 | vee-golang = -v gocache-${VOLTHA_TOOLS_VERSION}:/go/pkg |
| 37 | vee-citools = voltha/voltha-ci-tools:${VOLTHA_TOOLS_VERSION} |
| 38 | |
| 39 | # Tool Containers |
| 40 | PROTOC = $(docker-run) -v ${CURDIR}:/app $(is-stdin) $(vee-citools)-protoc protoc |
| 41 | PROTOC_SH = $(docker-run) -v ${CURDIR}:/go/src/github.com/opencord/voltha-protos/v5 $(is-stdin) --workdir=/go/src/github.com/opencord/voltha-protos/v5 $(vee-citools)-protoc sh -c |
| 42 | GO = $(docker-run) -v ${CURDIR}:/app $(is-stdin) -v gocache:/.cache $(vee-golang) $(vee-citools)-golang go |
| 43 | |
Joey Armstrong | 56b3678 | 2023-05-30 17:30:11 -0400 | [diff] [blame] | 44 | docker-sh = $(PROTOC_SH) |
| 45 | |
Joey Armstrong | 761579c | 2023-05-08 11:59:57 -0400 | [diff] [blame] | 46 | $(if $(DEBUG),$(warning LEAVE)) |
| 47 | |
| 48 | # [EOF] |