-
Notifications
You must be signed in to change notification settings - Fork 55
/
Makefile
160 lines (134 loc) · 6.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# backwards compatibility name for CONTIV_INSTALLER_VERSION
export BUILD_VERSION ?= devbuild
# sets the version for the installer output artifacts
export CONTIV_INSTALLER_VERSION ?= $(BUILD_VERSION)
# downloaded and built assets intended to go in installer by build.sh
export CONTIV_ARTIFACT_STAGING := $(PWD)/artifact_staging
# some assets are retrieved from GitHub, this is the default version to fetch
export DEFAULT_DOWNLOAD_CONTIV_VERSION := 1.2.0
export CONTIV_ACI_GW_VERSION ?= latest
export NETPLUGIN_OWNER ?= contiv
# setting NETPLUGIN_BRANCH compiles that commit on demand,
# setting CONTIV_NETPLUGIN_VERSION will download that released version
ifeq ($(NETPLUGIN_BRANCH),)
export CONTIV_NETPLUGIN_VERSION ?= $(DEFAULT_DOWNLOAD_CONTIV_VERSION)
export CONTIV_V2PLUGIN_VERSION ?= $(DEFAULT_DOWNLOAD_CONTIV_VERSION)
else
export CONTIV_NETPLUGIN_VERSION := $(NETPLUGIN_OWNER)-$(NETPLUGIN_BRANCH)
export CONTIV_V2PLUGIN_VERSION ?= $(NETPLUGIN_OWNER)-$(NETPLUGIN_BRANCH)
endif
export CONTIV_NETPLUGIN_TARBALL_NAME := netplugin-$(CONTIV_NETPLUGIN_VERSION).tar.bz2
export CONTIV_ANSIBLE_COMMIT ?= 8e20f56d541af8bc7a3ecbde0d9c64fa943812ed
export CONTIV_ANSIBLE_OWNER ?= contiv
# TODO(chrisplo): restore the normal default after 1.1.8 has been pushed
#export CONTIV_ANSIBLE_IMAGE ?= contiv/install:$(DEFAULT_DOWNLOAD_CONTIV_VERSION)
export CONTIV_ANSIBLE_IMAGE ?= contiv/install:1.1.7-bash-netcat
export CONTIV_V2PLUGIN_TARBALL_NAME := v2plugin-$(CONTIV_V2PLUGIN_VERSION).tar.gz
export CONTIV_ANSIBLE_COMMIT ?= 00da7b2a1fd9f631bcfe283a0a640d903ca389f4
export CONTIV_ANSIBLE_OWNER ?= contiv
# this is the classic first makefile target, and it's also the default target
# run when `make` is invoked with no specific target.
all: build
rel_ver = $(shell ./scripts/get_latest_release.sh)
# accepts CONTIV_ANSIBLE_COMMIT and CONTIV_ANSIBLE_OWNER environment vars
download-ansible-repo:
@scripts/download_ansible_repo.sh
# set NETPLUGIN_OWNER (default contiv) and NETPLUGIN_BRANCH make variables
# to compile locally
# e.g. make NETPLUGIN_OWNER=contiv NETPLUGIN_BRANCH=master
prepare-netplugin-artifacts:
@./scripts/prepare_netplugin_artifacts.sh
assemble-build:
@./scripts/build.sh
# build creates a release package for contiv.
# It uses a pre-built image specified by BUILD_VERSION.
build: download-ansible-repo prepare-netplugin-artifacts assemble-build
# ansible-image creates the docker image for ansible container
# It uses the version specified by BUILD_VERSION or creates an image with the latest tag.
ansible-image:
@bash ./scripts/build_image.sh
# Brings up a demo cluster to install Contiv on with docker, centos.
cluster-legacy-swarm: vagrant-clean
@bash ./scripts/vagrantup.sh legacy-swarm
# Brings up a demo cluster to install Contiv on with swarm, centos.
cluster-swarm-mode: vagrant-clean
@bash ./scripts/vagrantup.sh swarm-mode
# Brings up a demo cluster to install Contiv on with kubeadm, centos.
cluster-kubeadm: vagrant-clean
@bash ./scripts/vagrantup.sh kubeadm
cluster-destroy: vagrant-clean
# demo-swarm-mode brings up a cluster with native docker swarm, runs the installer on it, and shows the URL
# of the demo Contiv Admin Console which was set up
# BUILD_VERSION must be setup to use a specific build, e.g.
# export BUILD_VERSION=1.0.0-beta.3
# Or run make as BUILD_VERSION=1.0.0-beta.3 make demo-swarm-mode
demo-swarm-mode:
BUILD_VERSION=$(rel_ver) make cluster-swarm-mode
BUILD_VERSION=$(rel_ver) make install-test-swarm-mode
# demo-kubeadm brings up a cluster with kubeadm, runs the installer on it, and shows the URL
# of the demo Contiv Admin Console which was set up
# BUILD_VERSION must be setup to use a specific build, e.g.
# export BUILD_VERSION=1.0.0-beta.3
# Or run make as BUILD_VERSION=1.0.0-beta.3 make demo-kubeadm
demo-kubeadm:
BUILD_VERSION=$(rel_ver) make cluster-kubeadm
BUILD_VERSION=$(rel_ver) make install-test-kubeadm
# demo-swarm brings up a cluster with docker swarm, runs the installer on it, and shows the URL
# of the demo Contiv Admin Console which was set up
# BUILD_VERSION must be setup to use a specific build, e.g.
# export BUILD_VERSION=1.0.0-beta.3
# Or run make as BUILD_VERSION=1.0.0-beta.3 make demo-legacy-swarm
demo-legacy-swarm:
BUILD_VERSION=$(rel_ver) make cluster-legacy-swarm
BUILD_VERSION=$(rel_ver) make install-test-legacy-swarm
vagrant-clean:
cd cluster && vagrant destroy -f
@bash ./scripts/vbcleanup.sh
# Create a build and test the release installation on a vagrant cluster
# TODO: The vagrant part of this can be optimized by taking snapshots instead
# of creating a new set of VMs for each case
release-test-swarm-mode: build
# Test swarm-mode (centos by default)
make cluster-swarm-mode
make install-test-swarm-mode
# create k8s release testing image (do not contains ansible)
k8s-build: prepare-netplugin-images assemble-build
prepare-netplugin-images:
@bash ./scripts/prepare_netplugin_images.sh
# Create a build and test the release installation on a vagrant cluster
# TODO: The vagrant part of this can be optimized by taking snapshots instead
# of creating a new set of VMs for each case
release-test-kubeadm: k8s-build
# Test kubeadm (centos by default)
make cluster-kubeadm
make install-test-kubeadm
release-test-legacy-swarm: build
# Test docker + swarm (centos by default)
make cluster-legacy-swarm
make install-test-legacy-swarm
release-test-kubelegacy: build
# Test k8s ansible (centos by default)
make cluster-kubeadm
make install-test-kube-legacy
# shfmt reformats all shell scripts in this repo
shfmt:
go get github.com/contiv-experimental/sh/cmd/shfmt
find . -type f -name "*.sh" -print0 | xargs -0 shfmt -w
# Test the installation on the provided cluster. This is for bare-metal and other
# setups where the cluster is created using non-vagrant mechanisms.
# Clusters need to have k8s installed for kubernetes kubeadm based mechanism and
# docker installed on the master node for all others.
install-test-swarm-mode:
@bash ./scripts/swarm_mode_test.sh
install-test-kubeadm:
@bash ./scripts/kubeadm_test.sh
install-test-kube-legacy:
@bash ./scripts/kube_legacy_test.sh
install-test-legacy-swarm:
@bash ./scripts/legacy_swarm_test.sh
# ci does everything necessary for a Github PR-triggered CI run.
# currently, this means building a container image and running
# all of the available tests.
ci: release-test-kubeadm
ci-old: release-test-swarm-mode release-test-kubeadm release-test-legacy-swarm
.PHONY: all build cluster cluster-destroy release-test-legacy-swarm release-test-swarm-mode release-test-kubeadm release-test-kubelegacy install-test-legacy-swarm install-test-swarm-mode install-test-kubeadm install-test-kube-legacy k8s-build prepare-netplugin-images