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