X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=ci%2Fbuild.sh;fp=ci%2Fbuild.sh;h=918e3cab73f63a351b0a4d57a1a924afa3acf56e;hb=843dfef73c86a8ad71afe36e2db9e711dddc199a;hp=064c48a8b626629160e8f63bf139c84ab9135cd9;hpb=881aa3fcf152088440444d6f4296eaac3783801c;p=kvmfornfv.git diff --git a/ci/build.sh b/ci/build.sh index 064c48a8b..918e3cab7 100755 --- a/ci/build.sh +++ b/ci/build.sh @@ -2,6 +2,7 @@ # # Common parameter parsing for kvmfornfv scripts # + function usage() { echo "" echo "Usage --> $0 [-p package_type] [-o output_dir] [-h]" @@ -14,29 +15,35 @@ function usage() { output_dir="" type="" +function run() { + case $1 in + centos) + cd $WORKSPACE/ci/build_rpm + sudo docker build -t kvm_rpm . + sudo docker run --privileged=true -v $WORKSPACE:/opt/kvmfornfv -t kvm_rpm \ + /opt/kvmfornfv/ci/build_interface.sh $1 + ;; + ubuntu) + cd $WORKSPACE/ci/build_deb + sudo docker build -t kvm_deb . + sudo docker run -v $WORKSPACE:/opt/kvmfornfv -t kvm_deb \ + /opt/kvmfornfv/ci/build_interface.sh $1 + ;; + *) echo "Not supported system"; exit 1;; + esac +} + function build_package() { choice=$1 - case "$choice" in - "centos") - echo "Build $choice Rpms" - cd ci/build_rpm - ./build_rpms.sh - cd $WORKSPACE - ;; - "ubuntu") - echo "Build $choice Debians" - cd ci/build_deb - ./build_debs.sh - cd $WORKSPACE + "centos"|"ubuntu") + echo "Build $choice Rpms/Debians" + run $choice ;; "both") echo "Build $choice Debians and Rpms" - cd ci/build_deb - ./build_debs.sh - cd ../build_rpm - ./build_rpms.sh - cd $WORKSPACE + run "centos" + run "ubuntu" ;; *) echo "Invalid package option"