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 |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 18 | SHELL := /bin/bash -e -o pipefail |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 19 | |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 20 | # General variables |
| 21 | VERSION ?= $(shell cat ./VERSION) |
| 22 | THIS_MAKE := $(lastword $(MAKEFILE_LIST)) |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 23 | |
| 24 | # Docker related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 25 | DOCKER_REGISTRY ?= |
| 26 | DOCKER_REPOSITORY ?= |
| 27 | DOCKER_BUILD_ARGS ?= |
| 28 | DOCKER_TAG ?= ${VERSION} |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 29 | |
| 30 | # Docker labels. Only set ref and commit date if committed |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 31 | DOCKER_LABEL_VCS_URL ?= $(shell git remote get-url $(shell git remote)) |
| 32 | DOCKER_LABEL_BUILD_DATE ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ") |
| 33 | DOCKER_LABEL_COMMIT_DATE = $(shell git show -s --format=%cd --date=iso-strict HEAD) |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 34 | |
| 35 | ifeq ($(shell git ls-files --others --modified --exclude-standard 2>/dev/null | wc -l | sed -e 's/ //g'),0) |
| 36 | DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD) |
| 37 | else |
| 38 | DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD)+dirty |
| 39 | endif |
| 40 | |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 41 | # Includes the default ("working") versions of each component |
| 42 | include ./Makefile.vars |
| 43 | |
| 44 | # Shellcheck related |
| 45 | SHELLCHECK_TAG=v0.7.1 |
| 46 | SHELLCHECK_IMAGE=koalaman/shellcheck:${SHELLCHECK_TAG} |
| 47 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 48 | # ONOS related |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 49 | ONOS_IMAGENAME := tost-onos |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 50 | export ONOS_ROOT := $(shell pwd)/onos |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 51 | ONOS_REPO := https://gerrit.onosproject.org/onos |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 52 | ONOS_PROFILE := "tost" |
| 53 | KARAF_VERSION := 4.2.9 |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 54 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 55 | # TOST related |
| 56 | TOST_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}tost:${DOCKER_TAG} |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 57 | export LOCAL_APPS := local-apps |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 58 | |
| 59 | # Trellis-Control related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 60 | export TRELLIS_CONTROL_ROOT := $(shell pwd)/trellis-control |
| 61 | export TRELLIS_CONTROL_REPO := https://gerrit.onosproject.org/trellis-control |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 62 | |
| 63 | # Trellis-T3 related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 64 | export TRELLIS_T3_ROOT := $(shell pwd)/trellis-t3 |
| 65 | export TRELLIS_T3_REPO := https://gerrit.onosproject.org/trellis-t3 |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 66 | |
| 67 | # Fabric-Tofino related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 68 | export FABRIC_TOFINO_ROOT := $(shell pwd)/fabric-tofino |
| 69 | export FABRIC_TOFINO_REPO := https://gerrit.opencord.org/fabric-tofino |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 70 | |
| 71 | # Up4 related |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 72 | OMECPROJECT_API ?= |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 73 | export UP4_ROOT := $(shell pwd)/up4 |
| 74 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 75 | ifeq ($(OMECPROJECT_API),) |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 76 | export UP4_REPO = https://github.com/omec-project/up4.git |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 77 | else |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 78 | export UP4_REPO = https://omecproject:${OMECPROJECT_API}@github.com/omec-project/up4.git |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 79 | endif |
| 80 | |
| 81 | # Kafka-onos related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 82 | export KAFKA_ONOS_ROOT := $(shell pwd)/kafka-onos |
| 83 | export KAFKA_ONOS_REPO := https://gerrit.opencord.org/kafka-onos |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 84 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 85 | # Fabric-TNA related |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 86 | ONOS_BUILDER_API ?= |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 87 | export FABRIC_TNA_ROOT := $(shell pwd)/fabric-tna |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 88 | |
| 89 | ifeq ($(ONOS_BUILDER_API),) |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 90 | export FABRIC_TNA_REPO = https://github.com/stratum/fabric-tna.git |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 91 | else |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 92 | export FABRIC_TNA_REPO = https://onos-builder:${ONOS_BUILDER_API}@github.com/stratum/fabric-tna.git |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 93 | endif |
| 94 | |
Jon Hall | 49981fd | 2020-08-13 17:24:22 -0700 | [diff] [blame] | 95 | .PHONY: onos trellis-control trellis-t3 fabric-tofino up4 kafka-onos fabric-tna |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 96 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 97 | .SILENT: up4 fabric-tna |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 98 | |
| 99 | # This should to be the first and default target in this Makefile |
| 100 | help: ## : Print this help |
| 101 | @echo "Usage: make [<target>]" |
| 102 | @echo "where available targets are:" |
| 103 | @echo |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 104 | @grep '^[[:alnum:]_-]*:.* ##' $(THIS_MAKE) \ |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 105 | | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};' |
| 106 | @echo |
| 107 | @echo "Environment variables:" |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 108 | @echo "ONOS_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
| 109 | @echo "TRELLIS_CONTROL_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
| 110 | @echo "TRELLIS_T3_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
| 111 | @echo "FABRIC_TOFINO_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
| 112 | @echo "UP4_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
| 113 | @echo "KAFKA_ONOS_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
| 114 | @echo "FABRIC_TNA_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 115 | @echo "" |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 116 | @echo "'Makefile.vars' defines default values for '*_VERSION' variables". |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 117 | @echo "" |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 118 | |
| 119 | ## Make targets |
| 120 | |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 121 | check-scripts: ## : Provides warnings and suggestions for bash/sh shell scripts |
| 122 | # Fail if any of these files have warnings, exclude sed replacement warnings |
| 123 | docker run --rm -v "${PWD}:/mnt" ${SHELLCHECK_IMAGE} *.sh -e SC2001 |
| 124 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 125 | mvn_settings.xml: mvn_settings.sh ## : Builds mvn_settings file for proxy |
| 126 | @./$< |
| 127 | |
| 128 | local-apps: ## : Creates the folder that will host the oar file |
| 129 | mkdir -p ${LOCAL_APPS}/ |
| 130 | |
| 131 | trellis-control: ## : Checkout trellis-control code |
| 132 | # Clones trellis-control if it does not exist |
| 133 | if [ ! -d "trellis-control" ]; then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 134 | git clone ${TRELLIS_CONTROL_REPO}; \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 135 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 136 | |
| 137 | # Pending changes - do not proceed |
| 138 | @modified=$$(cd ${TRELLIS_CONTROL_ROOT} && git status --porcelain); \ |
| 139 | if [ ! -z "$${modified}" ]; then \ |
| 140 | echo "Unable to checkout, you have pending changes in trellis-control repository"; \ |
| 141 | exit 1; \ |
| 142 | fi |
| 143 | |
| 144 | # Try the git checkout first otherwise git review |
| 145 | if ! (cd ${TRELLIS_CONTROL_ROOT} && git checkout ${TRELLIS_CONTROL_VERSION}); then \ |
| 146 | if ! (cd ${TRELLIS_CONTROL_ROOT} && git fetch ${TRELLIS_CONTROL_REPO} ${TRELLIS_CONTROL_VERSION} && git checkout FETCH_HEAD); then \ |
| 147 | echo "Unable to fetch the changes from the trellis-control repository"; \ |
| 148 | fi \ |
| 149 | fi |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 150 | |
| 151 | trellis-control-build: mvn_settings.xml local-apps trellis-control ## : Builds trellis-control using local app or mvn |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 152 | @./app-build.sh $@ |
| 153 | |
| 154 | trellis-control-fetch: ## : downloads commits, files, and refs from remote trellis-control |
| 155 | cd ${TRELLIS_CONTROL_ROOT} && git fetch |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 156 | |
| 157 | trellis-t3: ## : Checkout trellis-t3 code |
| 158 | if [ ! -d "trellis-t3" ]; then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 159 | git clone ${TRELLIS_T3_REPO}; \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 160 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 161 | |
| 162 | @modified=$$(cd ${TRELLIS_T3_ROOT} && git status --porcelain); \ |
| 163 | if [ ! -z "$${modified}" ]; then \ |
| 164 | echo "Unable to checkout, you have pending changes in trellis-t3 repository"; \ |
| 165 | exit 1; \ |
| 166 | fi |
| 167 | |
| 168 | if ! (cd ${TRELLIS_T3_ROOT} && git checkout ${TRELLIS_T3_VERSION}); then \ |
| 169 | if ! (cd ${TRELLIS_T3_ROOT} && git fetch ${TRELLIS_T3_REPO} ${TRELLIS_T3_VERSION} && git checkout FETCH_HEAD); then \ |
| 170 | echo "Unable to fetch the changes from the trellis-t3 repository"; \ |
| 171 | fi \ |
| 172 | fi |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 173 | |
| 174 | trellis-t3-build: mvn_settings.xml local-apps trellis-t3 ## : Builds trellis-t3 using local app or mvn |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 175 | @./app-build.sh $@ |
| 176 | |
| 177 | trellis-t3-fetch: ## : downloads commits, files, and refs from remote trellis-t3 |
| 178 | cd ${TRELLIS_T3_ROOT} && git fetch |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 179 | |
| 180 | fabric-tofino: ## : Checkout fabric-tofino code |
| 181 | if [ ! -d "fabric-tofino" ]; then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 182 | git clone ${FABRIC_TOFINO_REPO}; \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 183 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 184 | |
| 185 | @modified=$$(cd ${FABRIC_TOFINO_ROOT} && git status --porcelain); \ |
| 186 | if [ ! -z "$${modified}" ]; then \ |
| 187 | echo "Unable to checkout, you have pending changes in fabric-tofino repository"; \ |
| 188 | exit 1; \ |
| 189 | fi |
| 190 | |
| 191 | if ! (cd ${FABRIC_TOFINO_ROOT} && git checkout ${FABRIC_TOFINO_VERSION}); then \ |
| 192 | if ! (cd ${FABRIC_TOFINO_ROOT} && git fetch ${FABRIC_TOFINO_REPO} ${FABRIC_TOFINO_VERSION} && git checkout FETCH_HEAD); then \ |
| 193 | echo "Unable to fetch the changes from the fabric-tofino repository"; \ |
| 194 | exit 1; \ |
| 195 | fi \ |
| 196 | fi |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 197 | |
| 198 | fabric-tofino-build: mvn_settings.xml local-apps fabric-tofino ## : Builds fabric-tofino using local app or mvn |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 199 | @./app-build.sh $@ |
| 200 | |
| 201 | fabric-tofino-fetch: ## : downloads commits, files, and refs from remote fabric-tofino |
| 202 | cd ${FABRIC_TOFINO_ROOT} && git fetch |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 203 | |
| 204 | up4: ## : Checkout up4 code |
| 205 | if [ ! -d "up4" ]; then \ |
| 206 | git clone ${UP4_REPO}; \ |
| 207 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 208 | |
| 209 | @modified=$$(cd ${UP4_ROOT} && git status --porcelain); \ |
| 210 | if [ ! -z "$${modified}" ]; then \ |
| 211 | echo "Unable to checkout, you have pending changes in up4 repository"; \ |
| 212 | exit 1; \ |
| 213 | fi |
| 214 | |
| 215 | if ! (cd ${UP4_ROOT} && git checkout ${UP4_VERSION}); then \ |
| 216 | if ! (cd ${UP4_ROOT} && git fetch ${UP4_REPO} ${UP4_VERSION} && git checkout FETCH_HEAD); then \ |
| 217 | echo "Unable to fetch the changes from the up4 repository"; \ |
| 218 | exit 1; \ |
| 219 | fi \ |
| 220 | fi |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 221 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 222 | up4-build: mvn_settings.xml local-apps up4 ## : Builds up4 using local app |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 223 | @./app-build.sh $@ |
| 224 | |
| 225 | up4-fetch: ## : downloads commits, files, and refs from remote up4 |
| 226 | cd ${UP4_ROOT} && git fetch |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 227 | |
| 228 | kafka-onos: ## : Checkout kafka-onos code |
| 229 | if [ ! -d "kafka-onos" ]; then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 230 | git clone ${KAFKA_ONOS_REPO}; \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 231 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 232 | |
| 233 | @modified=$$(cd ${KAFKA_ONOS_ROOT} && git status --porcelain); \ |
| 234 | if [ ! -z "$${modified}" ]; then \ |
| 235 | echo "Unable to checkout, you have pending changes in kafka-onos repository"; \ |
| 236 | exit 1; \ |
| 237 | fi |
| 238 | |
| 239 | if ! (cd ${KAFKA_ONOS_ROOT} && git checkout ${KAFKA_ONOS_VERSION}); then \ |
| 240 | if ! (cd ${KAFKA_ONOS_ROOT} && git fetch ${KAFKA_ONOS_REPO} ${KAFKA_ONOS_VERSION} && git checkout FETCH_HEAD); then \ |
| 241 | echo "Unable to fetch the changes from the kafka-onos repository"; \ |
| 242 | fi \ |
| 243 | fi |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 244 | |
| 245 | kafka-onos-build: mvn_settings.xml local-apps kafka-onos ## : Builds kafka-onos using local app or mvn |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 246 | @./app-build.sh $@ |
| 247 | |
| 248 | kafka-onos-fetch: ## : downloads commits, files, and refs from remote kafka-onos |
| 249 | cd ${KAFKA_ONOS_ROOT} && git fetch |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 250 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 251 | fabric-tna: ## : Checkout fabric-tna code |
| 252 | if [ ! -d "fabric-tna" ]; then \ |
| 253 | git clone ${FABRIC_TNA_REPO}; \ |
| 254 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 255 | |
| 256 | @modified=$$(cd ${FABRIC_TNA_ROOT} && git status --porcelain); \ |
| 257 | if [ ! -z "$${modified}" ]; then \ |
| 258 | echo "Unable to checkout, you have pending changes in fabric-tna repository"; \ |
| 259 | exit 1; \ |
| 260 | fi |
| 261 | |
| 262 | if ! (cd ${FABRIC_TNA_ROOT} && git checkout ${FABRIC_TNA_VERSION}); then \ |
| 263 | if ! (cd ${FABRIC_TNA_ROOT} && git fetch ${FABRIC_TNA_REPO} ${FABRIC_TNA_VERSION} && git checkout FETCH_HEAD); then \ |
| 264 | echo "Unable to fetch the changes from the fabric-tna repository"; \ |
| 265 | exit 1; \ |
| 266 | fi \ |
| 267 | fi |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 268 | |
| 269 | fabric-tna-build: mvn_settings.xml local-apps fabric-tna ## : Builds fabric-tna using local app |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 270 | @./app-build.sh $@ |
| 271 | |
| 272 | fabric-tna-fetch: ## : downloads commits, files, and refs from remote fabric-tna |
| 273 | cd ${FABRIC_TNA_ROOT} && git fetch |
| 274 | |
| 275 | apps-fetch: trellis-control-fetch trellis-t3-fetch fabric-tofino-fetch up4-fetch kafka-onos-fetch fabric-tna-fetch ## : downloads commits, files, and refs from remotes |
| 276 | |
| 277 | apps-build: trellis-control-build trellis-t3-build fabric-tofino-build up4-build kafka-onos-build fabric-tna-build ## : Build the onos apps |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 278 | |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 279 | onos: ## : Checkout onos code |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 280 | if [ ! -d "onos" ]; then \ |
| 281 | git clone https://gerrit.onosproject.org/onos; \ |
| 282 | fi |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 283 | |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 284 | @modified=$$(cd ${ONOS_ROOT} && git status --porcelain); \ |
| 285 | if [ ! -z "$${modified}" ]; then \ |
| 286 | echo "Unable to checkout, you have pending changes in onos repository"; \ |
| 287 | exit 1; \ |
| 288 | fi |
| 289 | |
| 290 | # In case of failure, we do not proceed because we cannot build with mvn |
| 291 | if ! (cd ${ONOS_ROOT} && git checkout ${ONOS_VERSION}); then \ |
| 292 | if ! (cd ${ONOS_ROOT} && git fetch ${ONOS_REPO} ${ONOS_VERSION} && git checkout FETCH_HEAD); then \ |
| 293 | echo "Unable to fetch the changes from the onos repository"; \ |
| 294 | exit 1; \ |
| 295 | fi \ |
| 296 | fi |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 297 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 298 | onos-build: onos ## : Builds the tost-onos docker image |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 299 | # Set some env variables |
| 300 | cd ${ONOS_ROOT} && \ |
| 301 | . tools/build/envDefaults && \ |
| 302 | docker build . -t ${ONOS_IMAGENAME} \ |
| 303 | --build-arg PROFILE=${ONOS_PROFILE} |
| 304 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 305 | tost-build: ## : Builds the tost docker image |
| 306 | docker build $(DOCKER_BUILD_ARGS) \ |
| 307 | -t ${TOST_IMAGENAME} \ |
| 308 | --build-arg LOCAL_APPS=${LOCAL_APPS} \ |
| 309 | --build-arg KARAF_VERSION=${KARAF_VERSION} \ |
| 310 | --build-arg org_label_schema_version="${VERSION}" \ |
| 311 | --build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \ |
| 312 | --build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \ |
| 313 | --build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 314 | --build-arg org_onosproject_onos_version="${ONOS_VERSION}"\ |
| 315 | --build-arg org_onosproject_trellis_control_version="${TRELLIS_CONTROL_VERSION}"\ |
| 316 | --build-arg org_onosproject_trellis_t3_version="${TRELLIS_T3_VERSION}"\ |
| 317 | --build-arg org_opencord_fabric_tofino_version="${FABRIC_TOFINO_VERSION}"\ |
| 318 | --build-arg org_omecproject_up4_version="${UP4_VERSION}"\ |
| 319 | --build-arg org_opencord_kafka_onos_version="${KAFKA_ONOS_VERSION}"\ |
| 320 | --build-arg org_stratumproject_fabric_tna_version="${FABRIC_TNA_VERSION}"\ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 321 | -f Dockerfile.tost . |
| 322 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 323 | onos-push: ## : Pushes the tost-onos docker image to an external repository |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 324 | docker push ${ONOS_IMAGENAME} |
| 325 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 326 | tost-push: ## : Pushes the tost docker image to an external repository |
| 327 | docker push ${TOST_IMAGENAME} |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 328 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 329 | # Used for CI job |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame^] | 330 | docker-build: check-scripts onos-build apps-build tost-build ## : Builds the tost image |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 331 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 332 | # User for CD job |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 333 | docker-push: tost-push ## : Pushes the tost image |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 334 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 335 | clean: ## : Deletes any locally copied files or artifacts |
| 336 | rm -rf ${ONOS_ROOT} |
| 337 | rm -rf ${TRELLIS_CONTROL_ROOT} |
| 338 | rm -rf ${TRELLIS_T3_ROOT} |
| 339 | rm -rf ${FABRIC_TOFINO_ROOT} |
| 340 | rm -rf ${UP4_ROOT} |
| 341 | rm -rf ${KAFKA_ONOS_ROOT} |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 342 | rm -rf ${FABRIC_TNA_ROOT} |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 343 | rm -rf ${LOCAL_APPS} |
| 344 | rm -rf .m2 |
| 345 | rm -rf mvn_settings.xml |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 346 | |
| 347 | # end file |