summaryrefslogtreecommitdiffstats
path: root/ci/build_rpm/build_rpms.sh
blob: c98747b64cf1a428d4398dc8116cb8093dd51b2e (plain)
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
#!/bin/bash
##############################################################################
# Copyright (c) 2016 ZTE Coreporation and others.
# hu.zhijiang@zte.com.cn
# sun.jing22@zte.com.cn
# 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 -eux
DAISYDIR=$1
OPNFV_ARTIFACT_VERSION=$2

function build_rpm_pkg {
    # Cleanup prev build resutls
    rm -rf $DAISYDIR/build_output
    mkdir -p $DAISYDIR/build_output

    sudo docker run --rm -t \
                    -v $DAISYDIR:/opt/daisy4nfv \
                    -v $CACHE_DIRECTORY:/home/cache \
                    --name daisy opnfv/daisy \
                    /opt/daisy4nfv/ci/build_rpm/build_rpms_docker.sh \
                    $OPNFV_ARTIFACT_VERSION
}

function cleanup_docker_image {
    if [ ! -z "$(sudo docker images -q opnfv/daisy)" ]; then
        sudo docker rmi opnfv/daisy >/dev/null 2>&1
    fi
}

cleanup_docker_image
build_rpm_pkg