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 |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 21 | THIS_MAKE := $(lastword $(MAKEFILE_LIST)) |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 22 | |
Yi Tseng | e3aba92 | 2022-03-17 16:22:40 -0700 | [diff] [blame] | 23 | # Allow N build jobs at once |
| 24 | JOBS ?= 2 |
| 25 | |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 26 | # Docker related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 27 | DOCKER_REGISTRY ?= |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 28 | DOCKER_REPOSITORY ?= opennetworking/sdfabric-onos |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 29 | DOCKER_BUILD_ARGS ?= |
pierventre | dd90010 | 2020-11-06 19:23:41 +0100 | [diff] [blame] | 30 | DOCKER_TAG ?= stable |
| 31 | DOCKER_TAG_BUILD_DATE ?= |
pierventre | 7fdd360 | 2021-05-05 10:54:38 +0200 | [diff] [blame] | 32 | DOCKER_TAG_PROFILER ?= |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 33 | |
| 34 | # Docker labels. Only set ref and commit date if committed |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 35 | DOCKER_LABEL_VCS_URL ?= $(shell git remote get-url $(shell git remote)) |
| 36 | DOCKER_LABEL_BUILD_DATE ?= $(shell date -u "+%Y-%m-%dT%H:%M:%SZ") |
| 37 | 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] | 38 | |
| 39 | ifeq ($(shell git ls-files --others --modified --exclude-standard 2>/dev/null | wc -l | sed -e 's/ //g'),0) |
| 40 | DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD) |
| 41 | else |
| 42 | DOCKER_LABEL_VCS_REF = $(shell git rev-parse HEAD)+dirty |
| 43 | endif |
| 44 | |
pierventre | dd90010 | 2020-11-06 19:23:41 +0100 | [diff] [blame] | 45 | ifeq ($(DOCKER_TAG),stable) |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 46 | # Includes the default ("working") versions of each component |
pierventre | dd90010 | 2020-11-06 19:23:41 +0100 | [diff] [blame] | 47 | include ./Makefile.vars.stable |
| 48 | else ifeq ($(DOCKER_TAG),master) |
| 49 | # Includes the master versions of each component |
| 50 | include ./Makefile.vars.master |
| 51 | else |
| 52 | $(error You must define properly the DOCKER_TAG variable) |
| 53 | endif |
| 54 | |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 55 | FINAL_IMAGENAME := ${DOCKER_REGISTRY}${DOCKER_REPOSITORY}:${DOCKER_TAG}${DOCKER_TAG_PROFILER}${DOCKER_TAG_BUILD_DATE} |
| 56 | export LOCAL_APPS := local-apps |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 57 | |
| 58 | # Shellcheck related |
| 59 | SHELLCHECK_TAG=v0.7.1 |
| 60 | SHELLCHECK_IMAGE=koalaman/shellcheck:${SHELLCHECK_TAG} |
| 61 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 62 | # ONOS related |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 63 | ONOS_BASE_IMAGENAME := onos-base:${DOCKER_TAG}${DOCKER_TAG_PROFILER}${DOCKER_TAG_BUILD_DATE} |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 64 | export ONOS_ROOT := $(shell pwd)/onos |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 65 | ONOS_REPO := https://gerrit.onosproject.org/onos |
Charles Chan | ca28c84 | 2022-02-04 21:49:00 -0800 | [diff] [blame] | 66 | # This profile contains the minimal set of ONOS built-in apps required to control SD-Fabric. |
| 67 | ONOS_PROFILE := "sdfabric" |
pierventre | 7fdd360 | 2021-05-05 10:54:38 +0200 | [diff] [blame] | 68 | PROFILER ?= |
| 69 | ONOS_YOURKIT := 2021.3-b230 |
Daniele Moro | d49dd09 | 2021-06-04 17:56:32 +0200 | [diff] [blame] | 70 | USE_ONOS_BAZEL_OUTPUT ?= |
Daniele Moro | f969c74 | 2022-01-03 22:01:00 +0100 | [diff] [blame] | 71 | USE_LOCAL_SNAPSHOT_ARTIFACTS ?= |
Carmelo Cascone | e281c3b | 2022-03-09 13:25:01 -0800 | [diff] [blame] | 72 | KARAF_VERSION := 4.2.14 |
Daniele Moro | b57f5af | 2022-03-30 20:00:56 +0200 | [diff] [blame] | 73 | # We use proprietary tools such as Intel P4 Studio for which we are not allowed |
| 74 | # to make the output public in CI jobs. |
| 75 | export SHOW_SENSITIVE_OUTPUT ?= false |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 76 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 77 | # Trellis-Control related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 78 | export TRELLIS_CONTROL_ROOT := $(shell pwd)/trellis-control |
| 79 | export TRELLIS_CONTROL_REPO := https://gerrit.onosproject.org/trellis-control |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 80 | |
| 81 | # Trellis-T3 related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 82 | export TRELLIS_T3_ROOT := $(shell pwd)/trellis-t3 |
| 83 | export TRELLIS_T3_REPO := https://gerrit.onosproject.org/trellis-t3 |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 84 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 85 | # Up4 related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 86 | export UP4_ROOT := $(shell pwd)/up4 |
Daniele Moro | 0bf38bf | 2022-04-15 17:20:00 +0200 | [diff] [blame] | 87 | export UP4_REPO := https://github.com/omec-project/up4.git |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 88 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 89 | # Fabric-TNA related |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 90 | export FABRIC_TNA_ROOT := $(shell pwd)/fabric-tna |
Daniele Moro | 0bf38bf | 2022-04-15 17:20:00 +0200 | [diff] [blame] | 91 | export FABRIC_TNA_REPO := https://github.com/stratum/fabric-tna.git |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 92 | |
Charles Chan | c11ecd6 | 2022-02-07 15:46:48 -0800 | [diff] [blame] | 93 | .PHONY: onos trellis-control up4 fabric-tna |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 94 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 95 | .SILENT: up4 fabric-tna |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 96 | |
| 97 | # This should to be the first and default target in this Makefile |
| 98 | help: ## : Print this help |
| 99 | @echo "Usage: make [<target>]" |
| 100 | @echo "where available targets are:" |
| 101 | @echo |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 102 | @grep '^[[:alnum:]_-]*:.* ##' $(THIS_MAKE) \ |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 103 | | sort | awk 'BEGIN {FS=":.* ## "}; {printf "%-25s %s\n", $$1, $$2};' |
| 104 | @echo |
| 105 | @echo "Environment variables:" |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 106 | @echo "ONOS_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
| 107 | @echo "TRELLIS_CONTROL_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
| 108 | @echo "TRELLIS_T3_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 109 | @echo "UP4_VERSION : Override to use a specific branch/commit/tag/release to build the image" |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 110 | @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] | 111 | @echo "" |
pierventre | dd90010 | 2020-11-06 19:23:41 +0100 | [diff] [blame] | 112 | @echo "'Makefile.vars.stable' defines the stable values for '*_VERSION' variables". |
| 113 | @echo "'Makefile.vars.master' defines the tip values for '*_VERSION' variables". |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 114 | @echo "" |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 115 | |
| 116 | ## Make targets |
| 117 | |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 118 | check-scripts: ## : Provides warnings and suggestions for bash/sh shell scripts |
| 119 | # Fail if any of these files have warnings, exclude sed replacement warnings |
| 120 | docker run --rm -v "${PWD}:/mnt" ${SHELLCHECK_IMAGE} *.sh -e SC2001 |
| 121 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 122 | mvn_settings.xml: mvn_settings.sh ## : Builds mvn_settings file for proxy |
| 123 | @./$< |
| 124 | |
| 125 | local-apps: ## : Creates the folder that will host the oar file |
| 126 | mkdir -p ${LOCAL_APPS}/ |
| 127 | |
| 128 | trellis-control: ## : Checkout trellis-control code |
| 129 | # Clones trellis-control if it does not exist |
| 130 | if [ ! -d "trellis-control" ]; then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 131 | git clone ${TRELLIS_CONTROL_REPO}; \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 132 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 133 | |
| 134 | # Pending changes - do not proceed |
| 135 | @modified=$$(cd ${TRELLIS_CONTROL_ROOT} && git status --porcelain); \ |
| 136 | if [ ! -z "$${modified}" ]; then \ |
| 137 | echo "Unable to checkout, you have pending changes in trellis-control repository"; \ |
| 138 | exit 1; \ |
| 139 | fi |
| 140 | |
pierventre | 3b5f9f1 | 2020-10-22 16:24:34 +0200 | [diff] [blame] | 141 | # Updates the repo and avoids any stale branches |
| 142 | cd ${TRELLIS_CONTROL_ROOT} && git remote update |
| 143 | |
pierventre | 0b6a9c3 | 2020-10-02 11:32:54 +0200 | [diff] [blame] | 144 | # Try the git checkout first otherwise we download the review |
pierventre | 3b5f9f1 | 2020-10-22 16:24:34 +0200 | [diff] [blame] | 145 | if ! (cd ${TRELLIS_CONTROL_ROOT} && (git checkout origin/${TRELLIS_CONTROL_VERSION} || git checkout ${TRELLIS_CONTROL_VERSION})); then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 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 | |
Daniele Moro | f969c74 | 2022-01-03 22:01:00 +0100 | [diff] [blame] | 151 | trellis-control-build: mvn_settings.xml .onos-publish-local 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 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 154 | trellis-t3: ## : Checkout trellis-t3 code |
| 155 | if [ ! -d "trellis-t3" ]; then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 156 | git clone ${TRELLIS_T3_REPO}; \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 157 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 158 | |
| 159 | @modified=$$(cd ${TRELLIS_T3_ROOT} && git status --porcelain); \ |
| 160 | if [ ! -z "$${modified}" ]; then \ |
| 161 | echo "Unable to checkout, you have pending changes in trellis-t3 repository"; \ |
| 162 | exit 1; \ |
| 163 | fi |
| 164 | |
pierventre | 3b5f9f1 | 2020-10-22 16:24:34 +0200 | [diff] [blame] | 165 | cd ${TRELLIS_T3_ROOT} && git remote update |
| 166 | |
| 167 | if ! (cd ${TRELLIS_T3_ROOT} && (git checkout origin/${TRELLIS_T3_VERSION} || git checkout ${TRELLIS_T3_VERSION})); then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 168 | if ! (cd ${TRELLIS_T3_ROOT} && git fetch ${TRELLIS_T3_REPO} ${TRELLIS_T3_VERSION} && git checkout FETCH_HEAD); then \ |
| 169 | echo "Unable to fetch the changes from the trellis-t3 repository"; \ |
| 170 | fi \ |
| 171 | fi |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 172 | |
Daniele Moro | f969c74 | 2022-01-03 22:01:00 +0100 | [diff] [blame] | 173 | trellis-t3-build: mvn_settings.xml .onos-publish-local local-apps trellis-t3 ## : Builds trellis-t3 using local app or mvn |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 174 | @./app-build.sh $@ |
| 175 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 176 | up4: ## : Checkout up4 code |
| 177 | if [ ! -d "up4" ]; then \ |
| 178 | git clone ${UP4_REPO}; \ |
| 179 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 180 | |
| 181 | @modified=$$(cd ${UP4_ROOT} && git status --porcelain); \ |
| 182 | if [ ! -z "$${modified}" ]; then \ |
| 183 | echo "Unable to checkout, you have pending changes in up4 repository"; \ |
| 184 | exit 1; \ |
| 185 | fi |
| 186 | |
pierventre | 3b5f9f1 | 2020-10-22 16:24:34 +0200 | [diff] [blame] | 187 | cd ${UP4_ROOT} && git remote update |
| 188 | |
| 189 | if ! (cd ${UP4_ROOT} && (git checkout origin/${UP4_VERSION} || git checkout ${UP4_VERSION})); then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 190 | if ! (cd ${UP4_ROOT} && git fetch ${UP4_REPO} ${UP4_VERSION} && git checkout FETCH_HEAD); then \ |
| 191 | echo "Unable to fetch the changes from the up4 repository"; \ |
| 192 | exit 1; \ |
| 193 | fi \ |
| 194 | fi |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 195 | |
Daniele Moro | f969c74 | 2022-01-03 22:01:00 +0100 | [diff] [blame] | 196 | up4-build: mvn_settings.xml .onos-publish-local local-apps up4 ## : Builds up4 using local app |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 197 | @./app-build.sh $@ |
| 198 | |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 199 | fabric-tna: ## : Checkout fabric-tna code |
| 200 | if [ ! -d "fabric-tna" ]; then \ |
| 201 | git clone ${FABRIC_TNA_REPO}; \ |
| 202 | fi |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 203 | |
| 204 | @modified=$$(cd ${FABRIC_TNA_ROOT} && git status --porcelain); \ |
| 205 | if [ ! -z "$${modified}" ]; then \ |
| 206 | echo "Unable to checkout, you have pending changes in fabric-tna repository"; \ |
| 207 | exit 1; \ |
| 208 | fi |
| 209 | |
pierventre | 3b5f9f1 | 2020-10-22 16:24:34 +0200 | [diff] [blame] | 210 | cd ${FABRIC_TNA_ROOT} && git remote update |
| 211 | |
| 212 | if ! (cd ${FABRIC_TNA_ROOT} && (git checkout origin/${FABRIC_TNA_VERSION} || git checkout ${FABRIC_TNA_VERSION})); then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 213 | if ! (cd ${FABRIC_TNA_ROOT} && git fetch ${FABRIC_TNA_REPO} ${FABRIC_TNA_VERSION} && git checkout FETCH_HEAD); then \ |
| 214 | echo "Unable to fetch the changes from the fabric-tna repository"; \ |
| 215 | exit 1; \ |
| 216 | fi \ |
| 217 | fi |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 218 | |
Daniele Moro | f969c74 | 2022-01-03 22:01:00 +0100 | [diff] [blame] | 219 | fabric-tna-build: mvn_settings.xml .onos-publish-local local-apps fabric-tna ## : Builds fabric-tna using local app |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 220 | @./app-build.sh $@ |
| 221 | |
Charles Chan | c11ecd6 | 2022-02-07 15:46:48 -0800 | [diff] [blame] | 222 | ## : downloads commits, files, and refs from remotes. Intentionally leave out t3. |
| 223 | apps: trellis-control up4 fabric-tna |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 224 | |
Charles Chan | c11ecd6 | 2022-02-07 15:46:48 -0800 | [diff] [blame] | 225 | ## : Build the onos apps. Intentionally leave out t3. |
| 226 | apps-build: trellis-control-build up4-build fabric-tna-build |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 227 | |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 228 | onos: ## : Checkout onos code |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 229 | if [ ! -d "onos" ]; then \ |
| 230 | git clone https://gerrit.onosproject.org/onos; \ |
| 231 | fi |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 232 | |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 233 | @modified=$$(cd ${ONOS_ROOT} && git status --porcelain); \ |
| 234 | if [ ! -z "$${modified}" ]; then \ |
| 235 | echo "Unable to checkout, you have pending changes in onos repository"; \ |
| 236 | exit 1; \ |
| 237 | fi |
| 238 | |
pierventre | 3b5f9f1 | 2020-10-22 16:24:34 +0200 | [diff] [blame] | 239 | cd ${ONOS_ROOT} && git remote update |
| 240 | |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 241 | # In case of failure, we do not proceed because we cannot build with mvn |
pierventre | 3b5f9f1 | 2020-10-22 16:24:34 +0200 | [diff] [blame] | 242 | if ! (cd ${ONOS_ROOT} && (git checkout origin/${ONOS_VERSION} || git checkout ${ONOS_VERSION})); then \ |
pierventre | 8361142 | 2020-08-14 22:53:15 +0200 | [diff] [blame] | 243 | if ! (cd ${ONOS_ROOT} && git fetch ${ONOS_REPO} ${ONOS_VERSION} && git checkout FETCH_HEAD); then \ |
| 244 | echo "Unable to fetch the changes from the onos repository"; \ |
| 245 | exit 1; \ |
| 246 | fi \ |
| 247 | fi |
pierventre | d9cb729 | 2020-07-31 00:01:47 +0200 | [diff] [blame] | 248 | |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 249 | onos-build: onos ## : Builds the onos-base docker image |
Daniele Moro | f969c74 | 2022-01-03 22:01:00 +0100 | [diff] [blame] | 250 | rm -rf .onos-publish-local |
pierventre | 7fdd360 | 2021-05-05 10:54:38 +0200 | [diff] [blame] | 251 | ifeq ($(PROFILER),true) |
| 252 | # profiler enabled |
| 253 | cd ${ONOS_ROOT} && \ |
| 254 | . tools/build/envDefaults && \ |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 255 | docker build . -t ${ONOS_BASE_IMAGENAME} \ |
pierventre | 7fdd360 | 2021-05-05 10:54:38 +0200 | [diff] [blame] | 256 | --build-arg PROFILE=${ONOS_PROFILE} \ |
| 257 | --build-arg ONOS_YOURKIT=${ONOS_YOURKIT} \ |
Yi Tseng | e3aba92 | 2022-03-17 16:22:40 -0700 | [diff] [blame] | 258 | --build-arg JOBS=${JOBS} \ |
pierventre | 7fdd360 | 2021-05-05 10:54:38 +0200 | [diff] [blame] | 259 | -f tools/dev/Dockerfile-yourkit |
Daniele Moro | d49dd09 | 2021-06-04 17:56:32 +0200 | [diff] [blame] | 260 | else ifeq ($(USE_ONOS_BAZEL_OUTPUT),true) |
| 261 | # profiler not enabled, using local bazel output |
| 262 | cd ${ONOS_ROOT} && \ |
| 263 | . tools/build/envDefaults && \ |
Yi Tseng | e3aba92 | 2022-03-17 16:22:40 -0700 | [diff] [blame] | 264 | bazel build onos --define profile=${ONOS_PROFILE} --jobs ${JOBS} |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 265 | docker build -t ${ONOS_BASE_IMAGENAME} -f ${ONOS_ROOT}/tools/dev/Dockerfile-bazel ${ONOS_ROOT}/bazel-bin |
pierventre | 7fdd360 | 2021-05-05 10:54:38 +0200 | [diff] [blame] | 266 | else |
| 267 | # profiler not enabled |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 268 | cd ${ONOS_ROOT} && \ |
| 269 | . tools/build/envDefaults && \ |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 270 | docker build . -t ${ONOS_BASE_IMAGENAME} \ |
Yi Tseng | e3aba92 | 2022-03-17 16:22:40 -0700 | [diff] [blame] | 271 | --build-arg PROFILE=${ONOS_PROFILE} \ |
| 272 | --build-arg JOBS=${JOBS} |
pierventre | 7fdd360 | 2021-05-05 10:54:38 +0200 | [diff] [blame] | 273 | endif |
Daniele Moro | f969c74 | 2022-01-03 22:01:00 +0100 | [diff] [blame] | 274 | make .onos-publish-local |
| 275 | |
| 276 | .onos-publish-local: |
| 277 | ifeq ($(USE_LOCAL_SNAPSHOT_ARTIFACTS),true) |
| 278 | @# TODO: build custom docker container with required dependencies instead of installing via publish-local script |
Daniele Moro | ace831e | 2022-03-28 23:12:57 +0200 | [diff] [blame] | 279 | docker run --rm --entrypoint bash -v $(shell pwd)/:/src \ |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 280 | -e ONOS_ROOT=/src/onos -e MAVEN_REPO=/src/.m2/repository -w /src \ |
Daniele Moro | f969c74 | 2022-01-03 22:01:00 +0100 | [diff] [blame] | 281 | bitnami/minideb:buster ./publish-local.sh |
| 282 | endif |
| 283 | touch .onos-publish-local |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 284 | |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 285 | package: ## : Builds the sdfabric-onos docker image |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 286 | docker build $(DOCKER_BUILD_ARGS) \ |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 287 | -t ${FINAL_IMAGENAME} \ |
pierventre | 7fdd360 | 2021-05-05 10:54:38 +0200 | [diff] [blame] | 288 | --build-arg DOCKER_TAG="${DOCKER_TAG}${DOCKER_TAG_PROFILER}${DOCKER_TAG_BUILD_DATE}" \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 289 | --build-arg LOCAL_APPS=${LOCAL_APPS} \ |
| 290 | --build-arg KARAF_VERSION=${KARAF_VERSION} \ |
pierventre | 7fdd360 | 2021-05-05 10:54:38 +0200 | [diff] [blame] | 291 | --build-arg org_label_schema_version="${DOCKER_TAG}${DOCKER_TAG_PROFILER}${DOCKER_TAG_BUILD_DATE}" \ |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 292 | --build-arg org_label_schema_vcs_url="${DOCKER_LABEL_VCS_URL}" \ |
| 293 | --build-arg org_label_schema_vcs_ref="${DOCKER_LABEL_VCS_REF}" \ |
| 294 | --build-arg org_label_schema_build_date="${DOCKER_LABEL_BUILD_DATE}" \ |
pierventre | dd90010 | 2020-11-06 19:23:41 +0100 | [diff] [blame] | 295 | --build-arg org_onosproject_onos_version="$(shell cd ${ONOS_ROOT} && git rev-parse HEAD)"\ |
| 296 | --build-arg org_onosproject_trellis_control_version="$(shell cd ${TRELLIS_CONTROL_ROOT} && git rev-parse HEAD)"\ |
pierventre | dd90010 | 2020-11-06 19:23:41 +0100 | [diff] [blame] | 297 | --build-arg org_omecproject_up4_version="$(shell cd ${UP4_ROOT} && git rev-parse HEAD)"\ |
pierventre | dd90010 | 2020-11-06 19:23:41 +0100 | [diff] [blame] | 298 | --build-arg org_stratumproject_fabric_tna_version="$(shell cd ${FABRIC_TNA_ROOT} && git rev-parse HEAD)"\ |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 299 | -f Dockerfile . |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 300 | |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 301 | onos-push: ## : Pushes the onos-base docker image to an external repository |
| 302 | docker push ${ONOS_BASE_IMAGENAME} |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 303 | |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 304 | push: ## : Pushes the sdfabric-onos docker image to an external repository |
| 305 | docker push ${FINAL_IMAGENAME} |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 306 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 307 | # Used for CI job |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 308 | docker-build: check-scripts onos-build apps-build package ## : Builds the sdfabric-onos image |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 309 | |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 310 | # User for CD job |
Carmelo Cascone | 68528e8 | 2022-02-04 18:42:34 -0800 | [diff] [blame] | 311 | docker-push: push ## : Pushes the sdfabric-onos Docker image |
pierventre | f03097a | 2020-07-15 18:49:05 +0200 | [diff] [blame] | 312 | |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 313 | clean: ## : Deletes any locally copied files or artifacts |
| 314 | rm -rf ${ONOS_ROOT} |
| 315 | rm -rf ${TRELLIS_CONTROL_ROOT} |
| 316 | rm -rf ${TRELLIS_T3_ROOT} |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 317 | rm -rf ${UP4_ROOT} |
pierventre | f33fc11 | 2020-07-30 12:55:54 +0200 | [diff] [blame] | 318 | rm -rf ${FABRIC_TNA_ROOT} |
pierventre | 1670916 | 2020-07-16 20:48:24 +0200 | [diff] [blame] | 319 | rm -rf ${LOCAL_APPS} |
| 320 | rm -rf .m2 |
| 321 | rm -rf mvn_settings.xml |
Daniele Moro | f969c74 | 2022-01-03 22:01:00 +0100 | [diff] [blame] | 322 | rm -rf .onos-publish-local |
pierventre | 2c7a4db | 2020-06-26 21:24:00 +0200 | [diff] [blame] | 323 | |
| 324 | # end file |