pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 1 | # |
| 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 |
| 18 | SHELL := /bin/bash -e -o pipefail |
| 19 | |
| 20 | # Variables |
| 21 | VERSION ?= $(shell cat ./VERSION) |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 22 | CURRENT_UID := $(shell id -u) |
| 23 | CURRENT_GID := $(shell id -g) |
| 24 | MKFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) |
| 25 | CURRENT_DIR := $(patsubst %/,%,$(dir $(MKFILE_PATH))) |
| 26 | LOCAL_APPS := local-apps |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 27 | # Do not attach stdin if running in an environment without it (e.g., Jenkins) |
| 28 | IT := $(shell test -t 0 && echo "-it" || echo "-t") |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 29 | |
| 30 | # Docker related |
| 31 | DOCKER_REGISTRY ?= |
| 32 | DOCKER_REPOSITORY ?= |
| 33 | DOCKER_BUILD_ARGS ?= |
| 34 | DOCKER_TAG ?= ${VERSION} |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 35 | DOCKER_MVN_TAG := 3.6.3-openjdk-11-slim |
| 36 | DOCKER_MVN_IMAGE := maven:${DOCKER_MVN_TAG} |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 37 | |
| 38 | # Docker labels. Only set ref and commit date if committed |
| 39 | DOCKER_LABEL_VCS_URL ?= $(shell git remote get-url $(shell git remote)) |
| 40 | DOCKER_LABEL_BUILD_DATE ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ") |
| 41 | DOCKER_LABEL_COMMIT_DATE = $(shell git show -s --format=%cd --date=iso-strict HEAD) |
| 42 | |
| 43 | ifeq ($(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) |
| 45 | else |
| 46 | DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD)+dirty |
| 47 | endif |
| 48 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 49 | # ONOS related |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 50 | ONOS_IMAGENAME := tost-onos |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 51 | ONOS_BRANCH ?= |
| 52 | ONOS_REVIEW ?= |
| 53 | export ONOS_ROOT := $(shell pwd)/onos |
| 54 | ONOS_PROFILE := "tost" |
| 55 | KARAF_VERSION := 4.2.9 |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 56 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 57 | # TOST related |
| 58 | TOST_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}tost:${DOCKER_TAG} |
| 59 | |
| 60 | # Trellis-Control related |
| 61 | TRELLIS_CONTROL_BRANCH ?= |
| 62 | TRELLIS_CONTROL_REVIEW ?= |
| 63 | TRELLIS_CONTROL_MVN ?= |
| 64 | TRELLIS_CONTROL_ROOT := $(shell pwd)/trellis-control |
| 65 | TRELLIS_CONTROL_GROUPID := org.onosproject |
| 66 | TRELLIS_CONTROL_ARTIFACTID := segmentrouting-oar |
| 67 | TRELLIS_CONTROL_ARTIFACT := ${TRELLIS_CONTROL_GROUPID}:${TRELLIS_CONTROL_ARTIFACTID} |
| 68 | TRELLIS_CONTROL_VERSION := 3.0.0-SNAPSHOT |
| 69 | |
| 70 | # Trellis-T3 related |
| 71 | TRELLIS_T3_BRANCH ?= |
| 72 | TRELLIS_T3_REVIEW ?= |
| 73 | TRELLIS_T3_MVN ?= |
| 74 | TRELLIS_T3_ROOT := $(shell pwd)/trellis-t3 |
| 75 | TRELLIS_T3_GROUPID := org.onosproject |
| 76 | TRELLIS_T3_ARTIFACTID := t3-app |
| 77 | TRELLIS_T3_ARTIFACT := ${TRELLIS_T3_GROUPID}:${TRELLIS_T3_ARTIFACTID} |
| 78 | TRELLIS_T3_VERSION := 3.0.0-SNAPSHOT |
| 79 | |
| 80 | # Fabric-Tofino related |
| 81 | FABRIC_TOFINO_BRANCH ?= |
| 82 | FABRIC_TOFINO_REVIEW ?= |
| 83 | FABRIC_TOFINO_MVN ?= |
| 84 | FABRIC_TOFINO_ROOT := $(shell pwd)/fabric-tofino |
| 85 | FABRIC_TOFINO_GROUPID := org.opencord |
| 86 | FABRIC_TOFINO_ARTIFACTID := fabric-tofino |
| 87 | FABRIC_TOFINO_ARTIFACT := ${FABRIC_TOFINO_GROUPID}:${FABRIC_TOFINO_ARTIFACTID} |
| 88 | FABRIC_TOFINO_VERSION := 1.1.1-SNAPSHOT |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 89 | FABRIC_TOFINO_TARGETS := fabric-spgw |
| 90 | FABRIC_TOFINO_SDE_DOCKER_IMG := opennetworking/bf-sde:9.0.0-p4c |
| 91 | FABRIC_TOFINO_P4CFLAGS := "-DS1U_SGW_PREFIX='(8w192++8w0++8w0++8w0)' -DS1U_SGW_PREFIX_LEN=8" |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 92 | |
| 93 | # Up4 related |
| 94 | UP4_BRANCH ?= |
| 95 | OMECPROJECT_API ?= |
| 96 | UP4_ROOT := $(shell pwd)/up4 |
| 97 | UP4_ARTIFACTID := up4-app |
| 98 | UP4_VERSION := 1.0.0-SNAPSHOT |
| 99 | UP4_TARGETS := _prepare_app_build |
| 100 | ifeq ($(OMECPROJECT_API),) |
| 101 | UP4_REPO = https://github.com/omec-project/up4.git |
| 102 | else |
| 103 | UP4_REPO = https://omecproject:${OMECPROJECT_API}@github.com/omec-project/up4.git |
| 104 | endif |
| 105 | |
| 106 | # Kafka-onos related |
| 107 | KAFKA_ONOS_BRANCH ?= |
| 108 | KAKFA_ONOS_REVIEW ?= |
| 109 | KAFKA_ONOS_MVN ?= |
| 110 | KAFKA_ONOS_ROOT := $(shell pwd)/kafka-onos |
| 111 | KAFKA_ONOS_GROUPID := org.opencord |
| 112 | KAFKA_ONOS_ARTIFACTID := kafka |
| 113 | KAFKA_ONOS_ARTIFACT := ${KAFKA_ONOS_GROUPID}:${KAFKA_ONOS_ARTIFACTID} |
| 114 | KAFKA_ONOS_VERSION := 2.4.0-SNAPSHOT |
| 115 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 116 | # Fabric-TNA related |
| 117 | FABRIC_TNA_BRANCH ?= |
| 118 | ONOS_BUILDER_API ?= |
| 119 | FABRIC_TNA_ROOT := $(shell pwd)/fabric-tna |
| 120 | FABRIC_TNA_ARTIFACTID := fabric-tna |
| 121 | FABRIC_TNA_VERSION := 1.0.0-SNAPSHOT |
| 122 | FABRIC_TNA_TARGETS := fabric fabric-spgw |
| 123 | FABRIC_TNA_SDE_DOCKER_IMG := opennetworking/bf-sde:9.2.0-p4c |
| 124 | |
| 125 | ifeq ($(ONOS_BUILDER_API),) |
| 126 | FABRIC_TNA_REPO = https://github.com/stratum/fabric-tna.git |
| 127 | else |
| 128 | FABRIC_TNA_REPO = https://onos-builder:${ONOS_BUILDER_API}@github.com/stratum/fabric-tna.git |
| 129 | endif |
| 130 | |
Jon Hall | 49981fd | 2020-08-13 17:24:22 -0700 | [diff] [blame^] | 131 | .PHONY: onos trellis-control trellis-t3 fabric-tofino up4 kafka-onos fabric-tna |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 132 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 133 | .SILENT: up4 fabric-tna |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 134 | |
| 135 | # This should to be the first and default target in this Makefile |
| 136 | help: ## : 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:" |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 144 | @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" |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 160 | @echo "" |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 161 | @echo "'onos' clones onos if it does not exist in the workspace." |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 162 | @echo "Uses current workspace unless above vars are defined." |
| 163 | @echo "" |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 164 | @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." |
pierventre | acdb5fc | 2020-08-10 22:05:26 +0200 | [diff] [blame] | 177 | @echo "Uses current workspace unless above vars are defined." |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 178 | @echo "" |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 179 | @echo "'fabric-tna' clones fabric-tna if it does not exist in the workspace." |
pierventre | acdb5fc | 2020-08-10 22:05:26 +0200 | [diff] [blame] | 180 | @echo "Uses current workspace unless above vars are defined." |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 181 | @echo "" |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 182 | |
| 183 | ## Make targets |
| 184 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 185 | mvn_settings.xml: mvn_settings.sh ## : Builds mvn_settings file for proxy |
| 186 | @./$< |
| 187 | |
| 188 | local-apps: ## : Creates the folder that will host the oar file |
| 189 | mkdir -p ${LOCAL_APPS}/ |
| 190 | |
| 191 | trellis-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 |
| 197 | ifdef TRELLIS_CONTROL_BRANCH |
| 198 | ifdef TRELLIS_CONTROL_REVIEW |
| 199 | @echo "Too many parameters. You cannot specify branch and review." |
| 200 | exit 1 |
| 201 | else |
| 202 | cd ${TRELLIS_CONTROL_ROOT} && git checkout ${TRELLIS_CONTROL_BRANCH} |
| 203 | endif |
| 204 | else |
| 205 | ifdef TRELLIS_CONTROL_REVIEW |
| 206 | cd ${TRELLIS_CONTROL_ROOT} && git review -d ${TRELLIS_CONTROL_REVIEW} |
| 207 | endif |
| 208 | endif |
| 209 | |
| 210 | trellis-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}/ |
| 213 | ifdef 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 |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 217 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/trellis-control ${DOCKER_MVN_IMAGE} \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 218 | 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" |
| 223 | else |
| 224 | # Having the same mount file allows to reduce build time. |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 225 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/trellis-control ${DOCKER_MVN_IMAGE} \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 226 | bash -c "mvn clean install -s mvn_settings.xml; \ |
| 227 | chown -R ${CURRENT_UID}:${CURRENT_GID} /root" |
| 228 | endif |
| 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 | |
| 232 | trellis-t3: ## : Checkout trellis-t3 code |
| 233 | if [ ! -d "trellis-t3" ]; then \ |
| 234 | git clone https://gerrit.onosproject.org/trellis-t3; \ |
| 235 | fi |
| 236 | ifdef TRELLIS_T3_BRANCH |
| 237 | ifdef TRELLIS_T3_REVIEW |
| 238 | @echo "Too many parameters. You cannot specify branch and review." |
| 239 | exit 1 |
| 240 | else |
| 241 | cd ${TRELLIS_T3_ROOT} && git checkout ${TRELLIS_T3_BRANCH} |
| 242 | endif |
| 243 | else |
| 244 | ifdef TRELLIS_T3_REVIEW |
| 245 | cd ${TRELLIS_T3_ROOT} && git review -d ${TRELLIS_T3_REVIEW} |
| 246 | endif |
| 247 | endif |
| 248 | |
| 249 | trellis-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}/ |
| 251 | ifdef TRELLIS_T3_MVN |
| 252 | cp dependencies.xml ${TRELLIS_T3_ROOT}/ |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 253 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/trellis-t3 ${DOCKER_MVN_IMAGE} \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 254 | 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" |
| 259 | else |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 260 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/trellis-t3 ${DOCKER_MVN_IMAGE} \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 261 | bash -c "mvn clean install -s mvn_settings.xml; \ |
| 262 | chown -R ${CURRENT_UID}:${CURRENT_GID} /root" |
| 263 | endif |
| 264 | cp ${TRELLIS_T3_ROOT}/app/target/${TRELLIS_T3_ARTIFACTID}-${TRELLIS_T3_VERSION}.oar ${LOCAL_APPS}/ |
| 265 | |
| 266 | fabric-tofino: ## : Checkout fabric-tofino code |
| 267 | if [ ! -d "fabric-tofino" ]; then \ |
| 268 | git clone https://gerrit.opencord.org/fabric-tofino; \ |
| 269 | fi |
| 270 | ifdef FABRIC_TOFINO_BRANCH |
| 271 | ifdef FABRIC_TOFINO_REVIEW |
| 272 | @echo "Too many parameters. You cannot specify branch and review." |
| 273 | exit 1 |
| 274 | else |
| 275 | cd ${FABRIC_TOFINO_ROOT} && git checkout ${FABRIC_TOFINO_BRANCH} |
| 276 | endif |
| 277 | else |
| 278 | ifdef FABRIC_TOFINO_REVIEW |
| 279 | cd ${FABRIC_TOFINO_ROOT} && git review -d ${FABRIC_TOFINO_REVIEW} |
| 280 | endif |
| 281 | endif |
| 282 | |
| 283 | fabric-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}/ |
| 285 | ifdef FABRIC_TOFINO_MVN |
| 286 | cp dependencies.xml ${FABRIC_TOFINO_ROOT}/ |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 287 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/fabric-tofino ${DOCKER_MVN_IMAGE} \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 288 | 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" |
| 293 | else |
| 294 | # This workaround is temporary - typically we need to build only the pipeconf |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 295 | cd ${FABRIC_TOFINO_ROOT} && make ${FABRIC_TOFINO_TARGETS} SDE_DOCKER_IMG=${FABRIC_TOFINO_SDE_DOCKER_IMG} \ |
| 296 | P4CFLAGS=${FABRIC_TOFINO_P4CFLAGS} |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 297 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/fabric-tofino ${DOCKER_MVN_IMAGE} \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 298 | bash -c "mvn clean install -s mvn_settings.xml; \ |
| 299 | chown -R ${CURRENT_UID}:${CURRENT_GID} /root" |
| 300 | endif |
| 301 | cp ${FABRIC_TOFINO_ROOT}/target/${FABRIC_TOFINO_ARTIFACTID}-${FABRIC_TOFINO_VERSION}.oar ${LOCAL_APPS}/ |
| 302 | |
| 303 | up4: ## : Checkout up4 code |
| 304 | if [ ! -d "up4" ]; then \ |
| 305 | git clone ${UP4_REPO}; \ |
| 306 | fi |
| 307 | ifdef UP4_BRANCH |
| 308 | cd ${UP4_ROOT} && git checkout ${UP4_BRANCH} |
| 309 | endif |
| 310 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 311 | up4-build: mvn_settings.xml local-apps up4 ## : Builds up4 using local app |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 312 | 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} |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 315 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/up4/app ${DOCKER_MVN_IMAGE} \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 316 | 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 | |
| 320 | kafka-onos: ## : Checkout kafka-onos code |
| 321 | if [ ! -d "kafka-onos" ]; then \ |
| 322 | git clone https://gerrit.opencord.org/kafka-onos; \ |
| 323 | fi |
| 324 | ifdef KAFKA_ONOS_BRANCH |
| 325 | ifdef KAFKA_ONOS_REVIEW |
| 326 | @echo "Too many parameters. You cannot specify branch and review." |
| 327 | exit 1 |
| 328 | else |
| 329 | cd ${KAFKA_ONOS_ROOT} && git checkout ${KAFKA_ONOS_BRANCH} |
| 330 | endif |
| 331 | else |
| 332 | ifdef KAFKA_ONOS_REVIEW |
| 333 | cd ${KAFKA_ONOS_ROOT} && git review -d ${KAFKA_ONOS_REVIEW} |
| 334 | endif |
| 335 | endif |
| 336 | |
| 337 | kafka-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}/ |
| 339 | ifdef KAFKA_ONOS_MVN |
| 340 | cp dependencies.xml ${KAFKA_ONOS_ROOT}/ |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 341 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/kafka-onos ${DOCKER_MVN_IMAGE} \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 342 | 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" |
| 347 | else |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 348 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/kafka-onos ${DOCKER_MVN_IMAGE} \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 349 | bash -c "mvn clean install -s mvn_settings.xml; \ |
| 350 | chown -R ${CURRENT_UID}:${CURRENT_GID} /root" |
| 351 | endif |
| 352 | cp ${KAFKA_ONOS_ROOT}/target/${KAFKA_ONOS_ARTIFACTID}-${KAFKA_ONOS_VERSION}.oar ${LOCAL_APPS}/ |
| 353 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 354 | fabric-tna: ## : Checkout fabric-tna code |
| 355 | if [ ! -d "fabric-tna" ]; then \ |
| 356 | git clone ${FABRIC_TNA_REPO}; \ |
| 357 | fi |
| 358 | ifdef FABRIC_TNA_BRANCH |
| 359 | cd ${FABRIC_TNA_ROOT} && git checkout ${FABRIC_TNA_BRANCH} |
| 360 | endif |
| 361 | |
| 362 | fabric-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} |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 366 | docker run ${IT} --rm -v ${CURRENT_DIR}:/root -w /root/fabric-tna ${DOCKER_MVN_IMAGE} \ |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 367 | 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 | |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 371 | onos: ## : Checkout onos code |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 372 | if [ ! -d "onos" ]; then \ |
| 373 | git clone https://gerrit.onosproject.org/onos; \ |
| 374 | fi |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 375 | ifdef ONOS_BRANCH |
| 376 | ifdef ONOS_REVIEW |
| 377 | @echo "Too many parameters. You cannot specify branch and review." |
| 378 | exit 1 |
| 379 | else |
| 380 | cd ${ONOS_ROOT} && git checkout ${ONOS_BRANCH} |
| 381 | endif |
| 382 | else |
| 383 | ifdef ONOS_REVIEW |
| 384 | cd ${ONOS_ROOT} && git review -d ${ONOS_REVIEW} |
| 385 | endif |
| 386 | endif |
| 387 | |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 388 | apps-build: trellis-control-build trellis-t3-build fabric-tofino-build up4-build kafka-onos-build fabric-tna-build ## : Build the onos apps |
| 389 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 390 | onos-build: onos ## : Builds the tost-onos docker image |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 391 | # 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 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 397 | tost-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 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 409 | onos-push: ## : Pushes the tost-onos docker image to an external repository |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 410 | docker push ${ONOS_IMAGENAME} |
| 411 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 412 | tost-push: ## : Pushes the tost docker image to an external repository |
| 413 | docker push ${TOST_IMAGENAME} |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 414 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 415 | # Used for CI job |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 416 | docker-build: onos-build apps-build tost-build ## : Builds the tost image |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 417 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 418 | # User for CD job |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 419 | docker-push: tost-push ## : Pushes the tost image |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 420 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 421 | clean: ## : 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} |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 428 | rm -rf ${FABRIC_TNA_ROOT} |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 429 | rm -rf ${LOCAL_APPS} |
| 430 | rm -rf .m2 |
| 431 | rm -rf mvn_settings.xml |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 432 | |
| 433 | # end file |