blob: f809c8eec96b5c609f5dc9363bade98ba7402f20 [file] [log] [blame]
pierventre2c7a4db2020-06-26 21:24:00 +02001#
2# Copyright 2020-present Open Networking Foundation
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16
17# set default shell
18SHELL := /bin/bash -e -o pipefail
19
20# Variables
21VERSION ?= $(shell cat ./VERSION)
pierventre16709162020-07-16 20:48:24 +020022CURRENT_UID := $(shell id -u)
23CURRENT_GID := $(shell id -g)
24MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST)))
25CURRENT_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH)))
26LOCAL_APPS := local-apps
pierventred9cb7292020-07-31 00:01:47 +020027# Do not attach stdin if running in an environment without it (e.g., Jenkins)
28IT := $(shell test -t 0 && echo "-it" || echo "-t")
pierventre2c7a4db2020-06-26 21:24:00 +020029
30# Docker related
31DOCKER_REGISTRY ?=
32DOCKER_REPOSITORY ?=
33DOCKER_BUILD_ARGS ?=
34DOCKER_TAG ?= ${VERSION}
pierventre16709162020-07-16 20:48:24 +020035DOCKER_MVN_TAG := 3.6.3-openjdk-11-slim
36DOCKER_MVN_IMAGE := maven:${DOCKER_MVN_TAG}
pierventre2c7a4db2020-06-26 21:24:00 +020037
38# Docker labels. Only set ref and commit date if committed
39DOCKER_LABEL_VCS_URL ?= $(shell git remote get-url $(shell git remote))
40DOCKER_LABEL_BUILD_DATE ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ")
41DOCKER_LABEL_COMMIT_DATE = $(shell git show -s --format=%cd --date=iso-strict HEAD)
42
43ifeq ($(shell git ls-files --others --modified --exclude-standard 2>/dev/null | wc -l | sed -e 's/ //g'),0)
44 DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD)
45else
46 DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD)+dirty
47endif
48
pierventre16709162020-07-16 20:48:24 +020049# ONOS related
pierventred9cb7292020-07-31 00:01:47 +020050ONOS_IMAGENAME := tost-onos
pierventre16709162020-07-16 20:48:24 +020051ONOS_BRANCH ?=
52ONOS_REVIEW ?=
53export ONOS_ROOT := $(shell pwd)/onos
54ONOS_PROFILE := "tost"
55KARAF_VERSION := 4.2.9
pierventre2c7a4db2020-06-26 21:24:00 +020056
pierventre16709162020-07-16 20:48:24 +020057# TOST related
58TOST_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}tost:${DOCKER_TAG}
59
60# Trellis-Control related
61TRELLIS_CONTROL_BRANCH ?=
62TRELLIS_CONTROL_REVIEW ?=
63TRELLIS_CONTROL_MVN ?=
64TRELLIS_CONTROL_ROOT := $(shell pwd)/trellis-control
65TRELLIS_CONTROL_GROUPID := org.onosproject
66TRELLIS_CONTROL_ARTIFACTID := segmentrouting-oar
67TRELLIS_CONTROL_ARTIFACT := ${TRELLIS_CONTROL_GROUPID}:${TRELLIS_CONTROL_ARTIFACTID}
68TRELLIS_CONTROL_VERSION := 3.0.0-SNAPSHOT
69
70# Trellis-T3 related
71TRELLIS_T3_BRANCH ?=
72TRELLIS_T3_REVIEW ?=
73TRELLIS_T3_MVN ?=
74TRELLIS_T3_ROOT := $(shell pwd)/trellis-t3
75TRELLIS_T3_GROUPID := org.onosproject
76TRELLIS_T3_ARTIFACTID := t3-app
77TRELLIS_T3_ARTIFACT := ${TRELLIS_T3_GROUPID}:${TRELLIS_T3_ARTIFACTID}
78TRELLIS_T3_VERSION := 3.0.0-SNAPSHOT
79
80# Fabric-Tofino related
81FABRIC_TOFINO_BRANCH ?=
82FABRIC_TOFINO_REVIEW ?=
83FABRIC_TOFINO_MVN ?=
84FABRIC_TOFINO_ROOT := $(shell pwd)/fabric-tofino
85FABRIC_TOFINO_GROUPID := org.opencord
86FABRIC_TOFINO_ARTIFACTID := fabric-tofino
87FABRIC_TOFINO_ARTIFACT := ${FABRIC_TOFINO_GROUPID}:${FABRIC_TOFINO_ARTIFACTID}
88FABRIC_TOFINO_VERSION := 1.1.1-SNAPSHOT
pierventref33fc112020-07-30 12:55:54 +020089FABRIC_TOFINO_TARGETS := fabric-spgw
90FABRIC_TOFINO_SDE_DOCKER_IMG := opennetworking/bf-sde:9.0.0-p4c
91FABRIC_TOFINO_P4CFLAGS := "-DS1U_SGW_PREFIX='(8w192++8w0++8w0++8w0)' -DS1U_SGW_PREFIX_LEN=8"
pierventre16709162020-07-16 20:48:24 +020092
93# Up4 related
94UP4_BRANCH ?=
95OMECPROJECT_API ?=
96UP4_ROOT := $(shell pwd)/up4
97UP4_ARTIFACTID := up4-app
98UP4_VERSION := 1.0.0-SNAPSHOT
99UP4_TARGETS := _prepare_app_build
100ifeq ($(OMECPROJECT_API),)
101 UP4_REPO = https://github.com/omec-project/up4.git
102else
103 UP4_REPO = https://omecproject:${OMECPROJECT_API}@github.com/omec-project/up4.git
104endif
105
106# Kafka-onos related
107KAFKA_ONOS_BRANCH ?=
108KAKFA_ONOS_REVIEW ?=
109KAFKA_ONOS_MVN ?=
110KAFKA_ONOS_ROOT := $(shell pwd)/kafka-onos
111KAFKA_ONOS_GROUPID := org.opencord
112KAFKA_ONOS_ARTIFACTID := kafka
113KAFKA_ONOS_ARTIFACT := ${KAFKA_ONOS_GROUPID}:${KAFKA_ONOS_ARTIFACTID}
114KAFKA_ONOS_VERSION := 2.4.0-SNAPSHOT
115
pierventref33fc112020-07-30 12:55:54 +0200116# Fabric-TNA related
117FABRIC_TNA_BRANCH ?=
118ONOS_BUILDER_API ?=
119FABRIC_TNA_ROOT := $(shell pwd)/fabric-tna
120FABRIC_TNA_ARTIFACTID := fabric-tna
121FABRIC_TNA_VERSION := 1.0.0-SNAPSHOT
122FABRIC_TNA_TARGETS := fabric fabric-spgw
123FABRIC_TNA_SDE_DOCKER_IMG := opennetworking/bf-sde:9.2.0-p4c
124
125ifeq ($(ONOS_BUILDER_API),)
126 FABRIC_TNA_REPO = https://github.com/stratum/fabric-tna.git
127else
128 FABRIC_TNA_REPO = https://onos-builder:${ONOS_BUILDER_API}@github.com/stratum/fabric-tna.git
129endif
130
pierventre16709162020-07-16 20:48:24 +0200131.PHONY:
132
pierventref33fc112020-07-30 12:55:54 +0200133.SILENT: up4 fabric-tna
pierventre2c7a4db2020-06-26 21:24:00 +0200134
135# This should to be the first and default target in this Makefile
136help: ## : Print this help
137 @echo "Usage: make [<target>]"
138 @echo "where available targets are:"
139 @echo
140 @grep '^[[:alnum:]_-]*:.* ##' $(MAKEFILE_LIST) \
141 | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};'
142 @echo
143 @echo "Environment variables:"
pierventred9cb7292020-07-31 00:01:47 +0200144 @echo "ONOS_BRANCH : Define to use the following branch to build the image"
145 @echo "ONOS_REVIEW : Define to use the following review to build the image"
146 @echo "TRELLIS_CONTROL_BRANCH : Define to use the following branch to build the image"
147 @echo "TRELLIS_CONTROL_REVIEW : Define to use the following review to build the image"
148 @echo "TRELLIS_CONTROL_MVN : Define to download the app using mvn"
149 @echo "TRELLIS_T3_BRANCH : Define to use the following branch to build the image"
150 @echo "TRELLIS_T3_REVIEW : Define to use the following review to build the image"
151 @echo "TRELLIS_T3_MVN : Define to download the app using mvn"
152 @echo "FABRIC_TOFINO_BRANCH : Define to use the following branch to build the image"
153 @echo "FABRIC_TOFINO_REVIEW : Define to use the following review to build the image"
154 @echo "FABRIC_TOFINO_MVN : Define to download the app using mvn"
155 @echo "UP4_BRANCH : Define to use the following branch to build the image"
156 @echo "KAFKA_ONOS_BRANCH : Define to use the following branch to build the image"
157 @echo "KAFKA_ONOS_REVIEW : Define to use the following review to build the image"
158 @echo "KAFKA_ONOS_MVN : Define to download the app using mvn"
159 @echo "FABRIC_TNA_BRANCH : Define to use the following branch to build the image"
pierventre2c7a4db2020-06-26 21:24:00 +0200160 @echo ""
pierventre16709162020-07-16 20:48:24 +0200161 @echo "'onos' clones onos if it does not exist in the workspace."
pierventre2c7a4db2020-06-26 21:24:00 +0200162 @echo "Uses current workspace unless above vars are defined."
163 @echo ""
pierventre16709162020-07-16 20:48:24 +0200164 @echo "'trellis-control' clones trellis-control if it does not exist in the workspace."
165 @echo "Uses current workspace unless above vars are defined."
166 @echo ""
167 @echo "'trellis-t3' clones trellis-t3 if it does not exist in the workspace."
168 @echo "Uses current workspace unless above vars are defined."
169 @echo ""
170 @echo "'fabric-tofino' clones fabric-tofino if it does not exist in the workspace."
171 @echo "Uses current workspace unless above vars are defined."
172 @echo ""
173 @echo "'up4' clones up4 if it does not exist in the workspace."
174 @echo "Uses current workspace unless above vars are defined."
175 @echo ""
176 @echo "'kafka-onos' clones kafka-onos if it does not exist in the workspace."
pierventreacdb5fc2020-08-10 22:05:26 +0200177 @echo "Uses current workspace unless above vars are defined."
pierventre16709162020-07-16 20:48:24 +0200178 @echo ""
pierventref33fc112020-07-30 12:55:54 +0200179 @echo "'fabric-tna' clones fabric-tna if it does not exist in the workspace."
pierventreacdb5fc2020-08-10 22:05:26 +0200180 @echo "Uses current workspace unless above vars are defined."
pierventref33fc112020-07-30 12:55:54 +0200181 @echo ""
pierventre2c7a4db2020-06-26 21:24:00 +0200182
183## Make targets
184
pierventre16709162020-07-16 20:48:24 +0200185mvn_settings.xml: mvn_settings.sh ## : Builds mvn_settings file for proxy
186 @./$<
187
188local-apps: ## : Creates the folder that will host the oar file
189 mkdir -p ${LOCAL_APPS}/
190
191trellis-control: ## : Checkout trellis-control code
192 # Clones trellis-control if it does not exist
193 if [ ! -d "trellis-control" ]; then \
194 git clone https://gerrit.onosproject.org/trellis-control; \
195 fi
196# Both are not supported
197ifdef TRELLIS_CONTROL_BRANCH
198ifdef TRELLIS_CONTROL_REVIEW
199 @echo "Too many parameters. You cannot specify branch and review."
200 exit 1
201else
202 cd ${TRELLIS_CONTROL_ROOT} && git checkout ${TRELLIS_CONTROL_BRANCH}
203endif
204else
205ifdef TRELLIS_CONTROL_REVIEW
206 cd ${TRELLIS_CONTROL_ROOT} && git review -d ${TRELLIS_CONTROL_REVIEW}
207endif
208endif
209
210trellis-control-build: mvn_settings.xml local-apps trellis-control ## : Builds trellis-control using local app or mvn
211 # Settings are needed by both build processes - contains proxy settings and extra
212 cp mvn_settings.xml ${TRELLIS_CONTROL_ROOT}/
213ifdef TRELLIS_CONTROL_MVN
214 # Dependencies are needed only by the mvn copy - contains repo settings
215 cp dependencies.xml ${TRELLIS_CONTROL_ROOT}/
216 # Mounting the current dir allows to cache the .m2 folder that is persisted and leveraged by subsequent builds
pierventred9cb7292020-07-31 00:01:47 +0200217 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/trellis-control ${DOCKER_MVN_IMAGE} \
pierventre16709162020-07-16 20:48:24 +0200218 bash -c "mvn dependency:copy -Dartifact=${TRELLIS_CONTROL_ARTIFACT}:${TRELLIS_CONTROL_VERSION}:oar \
219 -DoutputDirectory=oar/target -Dmdep.useBaseVersion=true \
220 -Dmdep.overWriteReleases=true -Dmdep.overWriteSnapshots=true -f dependencies.xml \
221 -s mvn_settings.xml; \
222 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
223else
224 # Having the same mount file allows to reduce build time.
pierventred9cb7292020-07-31 00:01:47 +0200225 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/trellis-control ${DOCKER_MVN_IMAGE} \
pierventre16709162020-07-16 20:48:24 +0200226 bash -c "mvn clean install -s mvn_settings.xml; \
227 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
228endif
229 # Final step requires to move the oar to the folder used by the tost docker file
230 cp ${TRELLIS_CONTROL_ROOT}/oar/target/${TRELLIS_CONTROL_ARTIFACTID}-${TRELLIS_CONTROL_VERSION}.oar ${LOCAL_APPS}/
231
232trellis-t3: ## : Checkout trellis-t3 code
233 if [ ! -d "trellis-t3" ]; then \
234 git clone https://gerrit.onosproject.org/trellis-t3; \
235 fi
236ifdef TRELLIS_T3_BRANCH
237ifdef TRELLIS_T3_REVIEW
238 @echo "Too many parameters. You cannot specify branch and review."
239 exit 1
240else
241 cd ${TRELLIS_T3_ROOT} && git checkout ${TRELLIS_T3_BRANCH}
242endif
243else
244ifdef TRELLIS_T3_REVIEW
245 cd ${TRELLIS_T3_ROOT} && git review -d ${TRELLIS_T3_REVIEW}
246endif
247endif
248
249trellis-t3-build: mvn_settings.xml local-apps trellis-t3 ## : Builds trellis-t3 using local app or mvn
250 cp mvn_settings.xml ${TRELLIS_T3_ROOT}/
251ifdef TRELLIS_T3_MVN
252 cp dependencies.xml ${TRELLIS_T3_ROOT}/
pierventred9cb7292020-07-31 00:01:47 +0200253 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/trellis-t3 ${DOCKER_MVN_IMAGE} \
pierventre16709162020-07-16 20:48:24 +0200254 bash -c "mvn dependency:copy -Dartifact=${TRELLIS_T3_ARTIFACT}:${TRELLIS_T3_VERSION}:oar \
255 -DoutputDirectory=app/target -Dmdep.useBaseVersion=true \
256 -Dmdep.overWriteReleases=true -Dmdep.overWriteSnapshots=true -f dependencies.xml \
257 -s mvn_settings.xml; \
258 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
259else
pierventred9cb7292020-07-31 00:01:47 +0200260 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/trellis-t3 ${DOCKER_MVN_IMAGE} \
pierventre16709162020-07-16 20:48:24 +0200261 bash -c "mvn clean install -s mvn_settings.xml; \
262 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
263endif
264 cp ${TRELLIS_T3_ROOT}/app/target/${TRELLIS_T3_ARTIFACTID}-${TRELLIS_T3_VERSION}.oar ${LOCAL_APPS}/
265
266fabric-tofino: ## : Checkout fabric-tofino code
267 if [ ! -d "fabric-tofino" ]; then \
268 git clone https://gerrit.opencord.org/fabric-tofino; \
269 fi
270ifdef FABRIC_TOFINO_BRANCH
271ifdef FABRIC_TOFINO_REVIEW
272 @echo "Too many parameters. You cannot specify branch and review."
273 exit 1
274else
275 cd ${FABRIC_TOFINO_ROOT} && git checkout ${FABRIC_TOFINO_BRANCH}
276endif
277else
278ifdef FABRIC_TOFINO_REVIEW
279 cd ${FABRIC_TOFINO_ROOT} && git review -d ${FABRIC_TOFINO_REVIEW}
280endif
281endif
282
283fabric-tofino-build: mvn_settings.xml local-apps fabric-tofino ## : Builds fabric-tofino using local app or mvn
284 cp mvn_settings.xml ${FABRIC_TOFINO_ROOT}/
285ifdef FABRIC_TOFINO_MVN
286 cp dependencies.xml ${FABRIC_TOFINO_ROOT}/
pierventred9cb7292020-07-31 00:01:47 +0200287 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/fabric-tofino ${DOCKER_MVN_IMAGE} \
pierventre16709162020-07-16 20:48:24 +0200288 bash -c "mvn dependency:copy -Dartifact=${FABRIC_TOFINO_ARTIFACT}:${FABRIC_TOFINO_VERSION}:oar \
289 -DoutputDirectory=target -Dmdep.useBaseVersion=true \
290 -Dmdep.overWriteReleases=true -Dmdep.overWriteSnapshots=true -f dependencies.xml \
291 -s mvn_settings.xml; \
292 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
293else
294 # This workaround is temporary - typically we need to build only the pipeconf
pierventref33fc112020-07-30 12:55:54 +0200295 cd ${FABRIC_TOFINO_ROOT} && make ${FABRIC_TOFINO_TARGETS} SDE_DOCKER_IMG=${FABRIC_TOFINO_SDE_DOCKER_IMG} \
296 P4CFLAGS=${FABRIC_TOFINO_P4CFLAGS}
pierventred9cb7292020-07-31 00:01:47 +0200297 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/fabric-tofino ${DOCKER_MVN_IMAGE} \
pierventre16709162020-07-16 20:48:24 +0200298 bash -c "mvn clean install -s mvn_settings.xml; \
299 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
300endif
301 cp ${FABRIC_TOFINO_ROOT}/target/${FABRIC_TOFINO_ARTIFACTID}-${FABRIC_TOFINO_VERSION}.oar ${LOCAL_APPS}/
302
303up4: ## : Checkout up4 code
304 if [ ! -d "up4" ]; then \
305 git clone ${UP4_REPO}; \
306 fi
307ifdef UP4_BRANCH
308 cd ${UP4_ROOT} && git checkout ${UP4_BRANCH}
309endif
310
pierventref33fc112020-07-30 12:55:54 +0200311up4-build: mvn_settings.xml local-apps up4 ## : Builds up4 using local app
pierventre16709162020-07-16 20:48:24 +0200312 cp mvn_settings.xml ${UP4_ROOT}/app
313 # Copy the p4 reources inside the app before the actual build
314 cd ${UP4_ROOT} && make ${UP4_TARGETS}
pierventred9cb7292020-07-31 00:01:47 +0200315 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/up4/app ${DOCKER_MVN_IMAGE} \
pierventre16709162020-07-16 20:48:24 +0200316 bash -c "mvn clean install -s mvn_settings.xml; \
317 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
318 cp ${UP4_ROOT}/app/app/target/${UP4_ARTIFACTID}-${UP4_VERSION}.oar ${LOCAL_APPS}/
319
320kafka-onos: ## : Checkout kafka-onos code
321 if [ ! -d "kafka-onos" ]; then \
322 git clone https://gerrit.opencord.org/kafka-onos; \
323 fi
324ifdef KAFKA_ONOS_BRANCH
325ifdef KAFKA_ONOS_REVIEW
326 @echo "Too many parameters. You cannot specify branch and review."
327 exit 1
328else
329 cd ${KAFKA_ONOS_ROOT} && git checkout ${KAFKA_ONOS_BRANCH}
330endif
331else
332ifdef KAFKA_ONOS_REVIEW
333 cd ${KAFKA_ONOS_ROOT} && git review -d ${KAFKA_ONOS_REVIEW}
334endif
335endif
336
337kafka-onos-build: mvn_settings.xml local-apps kafka-onos ## : Builds kafka-onos using local app or mvn
338 cp mvn_settings.xml ${KAFKA_ONOS_ROOT}/
339ifdef KAFKA_ONOS_MVN
340 cp dependencies.xml ${KAFKA_ONOS_ROOT}/
pierventred9cb7292020-07-31 00:01:47 +0200341 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/kafka-onos ${DOCKER_MVN_IMAGE} \
pierventre16709162020-07-16 20:48:24 +0200342 bash -c "mvn dependency:copy -Dartifact=${KAFKA_ONOS_ARTIFACT}:${KAFKA_ONOS_VERSION}:oar \
343 -DoutputDirectory=target -Dmdep.useBaseVersion=true \
344 -Dmdep.overWriteReleases=true -Dmdep.overWriteSnapshots=true -f dependencies.xml \
345 -s mvn_settings.xml; \
346 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
347else
pierventred9cb7292020-07-31 00:01:47 +0200348 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/kafka-onos ${DOCKER_MVN_IMAGE} \
pierventre16709162020-07-16 20:48:24 +0200349 bash -c "mvn clean install -s mvn_settings.xml; \
350 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
351endif
352 cp ${KAFKA_ONOS_ROOT}/target/${KAFKA_ONOS_ARTIFACTID}-${KAFKA_ONOS_VERSION}.oar ${LOCAL_APPS}/
353
pierventref33fc112020-07-30 12:55:54 +0200354fabric-tna: ## : Checkout fabric-tna code
355 if [ ! -d "fabric-tna" ]; then \
356 git clone ${FABRIC_TNA_REPO}; \
357 fi
358ifdef FABRIC_TNA_BRANCH
359 cd ${FABRIC_TNA_ROOT} && git checkout ${FABRIC_TNA_BRANCH}
360endif
361
362fabric-tna-build: mvn_settings.xml local-apps fabric-tna ## : Builds fabric-tna using local app
363 cp mvn_settings.xml ${FABRIC_TNA_ROOT}/
364 # Rebuilds the artifact and the pipeconf
365 cd ${FABRIC_TNA_ROOT} && make ${FABRIC_TNA_TARGETS} SDE_DOCKER_IMG=${FABRIC_TNA_SDE_DOCKER_IMG}
pierventred9cb7292020-07-31 00:01:47 +0200366 docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/fabric-tna ${DOCKER_MVN_IMAGE} \
pierventref33fc112020-07-30 12:55:54 +0200367 bash -c "mvn clean install -s mvn_settings.xml; \
368 chown -R ${CURRENT_UID}:${CURRENT_GID} /root"
369 cp ${FABRIC_TNA_ROOT}/target/${FABRIC_TNA_ARTIFACTID}-${FABRIC_TNA_VERSION}.oar ${LOCAL_APPS}/
370
pierventre2c7a4db2020-06-26 21:24:00 +0200371onos: ## : Checkout onos code
pierventre2c7a4db2020-06-26 21:24:00 +0200372 if [ ! -d "onos" ]; then \
373 git clone https://gerrit.onosproject.org/onos; \
374 fi
pierventre2c7a4db2020-06-26 21:24:00 +0200375ifdef ONOS_BRANCH
376ifdef ONOS_REVIEW
377 @echo "Too many parameters. You cannot specify branch and review."
378 exit 1
379else
380 cd ${ONOS_ROOT} && git checkout ${ONOS_BRANCH}
381endif
382else
383ifdef ONOS_REVIEW
384 cd ${ONOS_ROOT} && git review -d ${ONOS_REVIEW}
385endif
386endif
387
pierventred9cb7292020-07-31 00:01:47 +0200388apps-build: trellis-control-build trellis-t3-build fabric-tofino-build up4-build kafka-onos-build fabric-tna-build ## : Build the onos apps
389
pierventref03097a2020-07-15 18:49:05 +0200390onos-build: onos ## : Builds the tost-onos docker image
pierventre2c7a4db2020-06-26 21:24:00 +0200391 # Set some env variables
392 cd ${ONOS_ROOT} && \
393 . tools/build/envDefaults && \
394 docker build . -t ${ONOS_IMAGENAME} \
395 --build-arg PROFILE=${ONOS_PROFILE}
396
pierventre16709162020-07-16 20:48:24 +0200397tost-build: ## : Builds the tost docker image
398 docker build $(DOCKER_BUILD_ARGS) \
399 -t ${TOST_IMAGENAME} \
400 --build-arg LOCAL_APPS=${LOCAL_APPS} \
401 --build-arg KARAF_VERSION=${KARAF_VERSION} \
402 --build-arg org_label_schema_version="${VERSION}" \
403 --build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \
404 --build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \
405 --build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \
406 --build-arg org_onosproject_vcs_commit_date="${DOCKER_LABEL_COMMIT_DATE}" \
407 -f Dockerfile.tost .
408
pierventref03097a2020-07-15 18:49:05 +0200409onos-push: ## : Pushes the tost-onos docker image to an external repository
pierventre2c7a4db2020-06-26 21:24:00 +0200410 docker push ${ONOS_IMAGENAME}
411
pierventre16709162020-07-16 20:48:24 +0200412tost-push: ## : Pushes the tost docker image to an external repository
413 docker push ${TOST_IMAGENAME}
pierventre2c7a4db2020-06-26 21:24:00 +0200414
pierventref03097a2020-07-15 18:49:05 +0200415# Used for CI job
pierventred9cb7292020-07-31 00:01:47 +0200416docker-build: onos-build apps-build tost-build ## : Builds the tost image
pierventre2c7a4db2020-06-26 21:24:00 +0200417
pierventref03097a2020-07-15 18:49:05 +0200418# User for CD job
pierventre16709162020-07-16 20:48:24 +0200419docker-push: tost-push ## : Pushes the tost image
pierventref03097a2020-07-15 18:49:05 +0200420
pierventre16709162020-07-16 20:48:24 +0200421clean: ## : Deletes any locally copied files or artifacts
422 rm -rf ${ONOS_ROOT}
423 rm -rf ${TRELLIS_CONTROL_ROOT}
424 rm -rf ${TRELLIS_T3_ROOT}
425 rm -rf ${FABRIC_TOFINO_ROOT}
426 rm -rf ${UP4_ROOT}
427 rm -rf ${KAFKA_ONOS_ROOT}
pierventref33fc112020-07-30 12:55:54 +0200428 rm -rf ${FABRIC_TNA_ROOT}
pierventre16709162020-07-16 20:48:24 +0200429 rm -rf ${LOCAL_APPS}
430 rm -rf .m2
431 rm -rf mvn_settings.xml
pierventre2c7a4db2020-06-26 21:24:00 +0200432
433# end file