blob: 155fefab6850028b4a4f6c8164aec60e480b728f [file] [log] [blame]
Mike Marchetti65fdf232017-05-09 12:55:50 -04001#!/bin/bash
2#
3# Copyright 2017 Sandvine
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17# Authors:
18# - Michael Marchetti - mmarchetti@sandvine.com
19#
20
21HERE=$(realpath $(dirname $0))
22OSM_JENKINS=$(dirname $HERE)
23. $OSM_JENKINS/common/all_funcs
24
25# SET YOU MDG repository name here
26export OSM_MDG=osmclient
27OSM_load_config
28
29NOTEST=""
30if [ "$1" = "--notest" ]; then
31 shift
32 NOTEST="y"
33fi
34
35OSM_git_checkout "$@"
36
garciadeblas7a2b4b72017-08-31 13:14:45 +020037apt-get update
38apt-get install -y docker.io
Mike Marchetti6acd4dc2017-05-25 10:48:11 -040039
Mike Marchetti7a747722017-06-19 17:20:42 -040040# cleanup all pre-existing builds.
41# deb pkg build fails if previous build image is present
42rm -rf deb_dist dist
43
Mike Marchetti6acd4dc2017-05-25 10:48:11 -040044docker build -t $OSM_MDG .
45DOCKER_ARGS="-v $(pwd):$(pwd) -w $(pwd) -u $(id -u):$(id -g) $OSM_MDG"
46
47if [ -n "$NOTEST" ]; then
48 docker run $DOCKER_ARGS /bin/bash -c "./docker_command.sh $(id -u -n) $(id -g -n) tox"
49fi
50
51docker run $DOCKER_ARGS /bin/bash -c "./docker_command.sh $(id -u -n) $(id -g -n) tox -e build"
Mike Marchetti65fdf232017-05-09 12:55:50 -040052
53RC=$?
54INFO "done, RC=$RC"
55exit $RC