2 # SPDX-license-identifier: Apache-2.0
3 ##############################################################################
4 # Copyright (c) 2018 Intel Corporation
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
14 k8s_path="$(git rev-parse --show-toplevel)"
15 export GOPATH=$k8s_path
17 VERSION="0.1.0-SNAPSHOT"
18 export IMAGE_NAME="nexus3.onap.org:10003/onap/multicloud/k8s"
20 function _compile_src {
21 echo "Compiling source code"
22 pushd $k8s_path/src/k8splugin/
28 echo "Moving binaries"
30 mv $k8s_path/src/k8splugin/k8plugin .
31 mv $k8s_path/src/k8splugin/plugins/*.so .
35 echo "Cleaning previous execution"
37 image=$(grep "image.*k8plugin" docker-compose.yml)
38 if [[ -n ${image} ]]; then
39 docker images ${image#*:} -q | xargs docker rmi -f
41 docker ps -a --filter "status=exited" -q | xargs docker rm
44 function _build_docker {
45 echo "Building docker image"
46 docker-compose build --no-cache
49 function _push_image {
50 local tag_name=${IMAGE_NAME}:${1:-latest}
52 echo "Start push {$tag_name}"
53 docker push ${IMAGE_NAME}:latest
54 docker tag ${IMAGE_NAME}:latest ${tag_name}
55 docker push ${tag_name}
58 if [[ -n "${JENKINS_HOME+x}" ]]; then
65 source /etc/environment