summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdeployments/build.sh15
-rwxr-xr-xdeployments/start.sh32
-rw-r--r--src/k8splugin/Makefile11
-rwxr-xr-xvagrant/tests/plugin.sh4
4 files changed, 47 insertions, 15 deletions
diff --git a/deployments/build.sh b/deployments/build.sh
index a88ebbc7..3a6ea856 100755
--- a/deployments/build.sh
+++ b/deployments/build.sh
@@ -18,12 +18,15 @@ pushd $k8s_path/src/k8splugin/
make
popd
-pushd $k8s_path/deployments
-for file in k8plugin *so; do
- rm -f $file
- mv $k8s_path/src/k8splugin/$file .
-done
+rm -f k8plugin *so
+mv $k8s_path/src/k8splugin/k8plugin .
+mv $k8s_path/src/k8splugin/plugins/*.so .
+
+echo "Cleaning previous execution"
+docker-compose kill
+image=$(grep "image.*k8plugin" docker-compose.yml)
+docker images ${image#*:} -q | xargs docker rmi -f
+docker ps -a --filter "status=exited" -q | xargs docker rm
echo "Starting docker building process"
docker-compose build --no-cache
-popd
diff --git a/deployments/start.sh b/deployments/start.sh
new file mode 100755
index 00000000..0a14fc35
--- /dev/null
+++ b/deployments/start.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# SPDX-license-identifier: Apache-2.0
+##############################################################################
+# Copyright (c) 2018 Intel Corporation
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+set -o nounset
+set -o pipefail
+
+k8s_path="$(git rev-parse --show-toplevel)"
+export GOPATH=$k8s_path
+
+export CSAR_DIR=/opt/csar
+export KUBE_CONFIG_DIR=/opt/kubeconfig
+export DATABASE_TYPE=consul
+export DATABASE_IP=consul-svr
+export PLUGINS_DIR=$k8s_path/src/k8splugin/plugins
+
+echo "Starting consul services"
+docker-compose kill
+docker-compose up -d consul
+echo "Compiling source code"
+
+pushd $k8s_path/src/k8splugin/
+make clean
+make plugins
+go run cmd/main.go
+popd
diff --git a/src/k8splugin/Makefile b/src/k8splugin/Makefile
index 542de958..6171d8c2 100644
--- a/src/k8splugin/Makefile
+++ b/src/k8splugin/Makefile
@@ -16,10 +16,9 @@ export GOPATH ...
all: clean dep
- CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=plugin -a -tags netgo -o ./deployment.so ./plugins/deployment/plugin.go
- CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=plugin -a -tags netgo -o ./namespace.so ./plugins/namespace/plugin.go
- CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -buildmode=plugin -a -tags netgo -o ./service.so ./plugins/service/plugin.go
- CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -a -tags netgo -o ./k8plugin ./cmd/main.go
+ CGO_ENABLED=1 GOOS=linux GOARCH=amd64
+ @find plugins -type d -not -path plugins -exec sh -c "ls {}/plugin.go | xargs go build -buildmode=plugin -a -tags netgo -o $(basename {}).so" \;
+ go build -a -tags netgo -o ./k8plugin ./cmd/main.go
# The following is done this way as each patch on CI runs build and each merge runs deploy. So for build we don't need to build binary and hence
# no need to create a static binary with additional flags. However, for generating binary, additional build flags are necessary. This if used with
@@ -36,9 +35,7 @@ format:
go fmt ./...
plugins:
- go build -buildmode=plugin -o ./plugins/deployment/deployment.so ./plugins/deployment/plugin.go
- go build -buildmode=plugin -o ./plugins/namespace/namespace.so ./plugins/namespace/plugin.go
- go build -buildmode=plugin -o ./plugins/service/service.so ./plugins/service/plugin.go
+ @find plugins -type d -not -path plugins -exec sh -c "ls {}/plugin.go | xargs go build -buildmode=plugin -o $(basename {}).so" \;
dep:
go get -u $(DEPENDENCIES)
diff --git a/vagrant/tests/plugin.sh b/vagrant/tests/plugin.sh
index a40cb60c..3ff3a54d 100755
--- a/vagrant/tests/plugin.sh
+++ b/vagrant/tests/plugin.sh
@@ -33,7 +33,7 @@ fi
if [[ $(docker ps -q --all --filter "name=aai") ]]; then
docker rm aai -f
fi
-docker run --name aai -v $(pwd)/output:/tmp/generic_sim/ -v $(pwd)/generic_simulator/aai/:/etc/generic_sim/ -p 8443:8080 -d generic_sim
+docker run --name aai -v $(mktemp):/tmp/generic_sim/ -v $(pwd)/generic_simulator/aai/:/etc/generic_sim/ -p 8443:8080 -d generic_sim
vnf_id_list=$(curl -s "${base_url}${cloud_region_id}/${namespace}" | jq -r '.vnf_id_list')
@@ -94,4 +94,4 @@ payload_raw="
}
"
payload=$(echo $payload_raw | tr '\n' ' ')
-curl -v -X POST -d "$payload" "${base_url}"
+curl -v -d "$payload" "${base_url}"