RIC:1060: Change in PTL
[ric-plt/vespamgr.git] / build_vesmgr.sh
1 #!/bin/bash
2 #
3 #  Copyright (c) 2019 AT&T Intellectual Property.
4 #  Copyright (c) 2018-2019 Nokia.
5 #
6 #  Licensed under the Apache License, Version 2.0 (the "License");
7 #  you may not use this file except in compliance with the License.
8 #  You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 #  Unless required by applicable law or agreed to in writing, software
13 #  distributed under the License is distributed on an "AS IS" BASIS,
14 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 #  See the License for the specific language governing permissions and
16 #  limitations under the License.
17 #
18 #   This source code is part of the near-RT RIC (RAN Intelligent Controller)
19 #   platform project (RICP).
20 #
21
22 # Install RMR from deb packages at packagecloud.io
23 rmr=rmr_4.8.0_amd64.deb
24 wget --content-disposition  https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/$rmr/download.deb
25 sudo dpkg -i $rmr
26 rm $rmr
27 rmrdev=rmr-dev_4.8.0_amd64.deb
28 wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/$rmrdev/download.deb
29 sudo dpkg -i $rmrdev
30 rm $rmrdev
31
32 # Required to find nng and rmr libs
33 export LD_LIBRARY_PATH=/usr/local/lib
34
35 # Go install, build, etc
36 export GOPATH=$HOME/go
37 export PATH=$GOPATH/bin:$PATH
38
39 # xApp-framework stuff
40 export CFG_FILE=$PWD/config/config-file-ut.json
41 export RMR_SEED_RT=$PWD/config/uta_rtg.rt
42
43 GO111MODULE=on GO_ENABLED=0 GOOS=linux
44
45 # Run vesmgr UT
46 GO111MODULE=on go test -v -p 1 -cover -coverprofile=coverage.out ./...
47
48 # setup version tag
49 if [ -f container-tag.yaml ]
50 then
51     tag=$(grep "tag:" container-tag.yaml | awk '{print $2}')
52 else
53     tag="-"
54 fi
55
56 hash=$(git rev-parse --short HEAD || true)
57
58 # Install vespamgr
59 go install -ldflags "-X main.Version=$tag -X main.Hash=$hash" -v $PWD/cmd/vespamgr