diff options
Diffstat (limited to 'ci')
-rw-r--r-- | ci/build_rpm/Dockerfile | 51 | ||||
-rwxr-xr-x | ci/build_rpm/build_rpms.sh | 76 |
2 files changed, 36 insertions, 91 deletions
diff --git a/ci/build_rpm/Dockerfile b/ci/build_rpm/Dockerfile deleted file mode 100644 index f10d95e4..00000000 --- a/ci/build_rpm/Dockerfile +++ /dev/null @@ -1,51 +0,0 @@ -FROM centos:7 -LABEL daisy_image_version=1.0 -RUN yum -y update -RUN yum -y install centos-release-openstack-newton -RUN yum -y install \ - wget \ - coreutils \ - which \ - gawk \ - grep \ - git \ - intltool \ - make \ - rpm \ - rpm-build \ - python-sphinx \ - python-XStatic-Angular \ - python-XStatic-Angular-Bootstrap \ - python-XStatic-Angular-lrdragndrop \ - python-XStatic-Angular-Mock \ - python-XStatic-Bootstrap-Datepicker \ - python-XStatic-Bootstrap-SCSS \ - python-XStatic-D3 \ - python-XStatic-Font-Awesome \ - python-XStatic-Hogan \ - python-XStatic-Jasmine \ - python-XStatic-jQuery \ - python-XStatic-JQuery-Migrate \ - python-XStatic-JQuery-quicksearch \ - python-XStatic-JQuery-TableSorter \ - python-XStatic-jquery-ui \ - python-XStatic-JSEncrypt \ - python-XStatic-Magic-Search \ - python-XStatic-QUnit \ - python-XStatic-Rickshaw \ - python-XStatic-smart-table \ - python-XStatic-Spin \ - python-XStatic-termjs \ - python2-oslo-sphinx \ - python2-oslo-messaging \ - python2-oslo-concurrency \ - python2-oslo-sphinx \ - python-devel \ - python-d2to1 \ - python-django-compressor \ - python-django-openstack-auth \ - python-django-pyscss \ - python-lesscpy \ - python-migrate \ - python-pint \ - python-routes diff --git a/ci/build_rpm/build_rpms.sh b/ci/build_rpm/build_rpms.sh index 2d5d23e0..e0472a24 100755 --- a/ci/build_rpm/build_rpms.sh +++ b/ci/build_rpm/build_rpms.sh @@ -13,54 +13,50 @@ 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 build -t daisy4nfv_rpm . - sudo docker run --rm -v $DAISYDIR:/opt/daisy4nfv -v $CACHE_DIRECTORY:/home/cache -t daisy4nfv_rpm \ - /opt/daisy4nfv/ci/build_rpm/build_rpms_docker.sh $OPNFV_ARTIFACT_VERSION - - # Here to collect build result from $DAISYDIR/build_output + # Cleanup prev build resutls + rm -rf $DAISYDIR/build_output + mkdir -p $DAISYDIR/build_output + + sudo docker build -t daisy4nfv_rpm ../../docker + sudo docker run --rm -v $DAISYDIR:/opt/daisy4nfv \ + -v $CACHE_DIRECTORY:/home/cache \ + -t daisy4nfv_rpm \ + /opt/daisy4nfv/ci/build_rpm/build_rpms_docker.sh \ + $OPNFV_ARTIFACT_VERSION } function cleanup_container { - containers_to_kill=$(sudo docker ps --filter "label=daisy_image_version" \ - --format "{{.Names}}" -a) - - if [[ -z "$containers_to_kill" ]]; then - echo "No containers to cleanup." - else - volumes_to_remove=$(sudo docker inspect -f \ - '{{range .Mounts}} {{printf "%s\n" .Name }}{{end}}' \ - ${containers_to_kill} | egrep -v '(^\s*$)' | sort | uniq) - echo "Stopping containers... $containers_to_kill" - sudo docker stop -t 2 ${containers_to_kill} >/dev/null 2>&1 - - echo "Removing containers... $containers_to_kill" - sudo docker rm -v -f ${containers_to_kill} >/dev/null 2>&1 - - if [[ -z "$volumes_to_remove" ]]; then - echo "No volumes to cleanup." - else - echo "Removing volumes... $volumes_to_remove" - sudo docker volume rm ${volumes_to_remove} >/dev/null 2>&1 - fi + containers_to_kill=$(sudo docker ps -a \ + --filter "label=daisy_image_version" \ + --format "{{.Names}}") + + if [[ ! -z "$containers_to_kill" ]]; then + ops='{{range .Mounts}} {{printf "%s\n" .Name }}{{end}}' + volumes_to_remove=$(sudo docker inspect -f \ + $ops ${containers_to_kill} \ + | egrep -v '(^\s*$)' \ + | sort | uniq) + + sudo docker stop -t 2 ${containers_to_kill} >/dev/null 2>&1 + sudo docker rm -v -f ${containers_to_kill} >/dev/null 2>&1 + + if [[ ! -z "$volumes_to_remove" ]]; then + sudo docker volume rm ${volumes_to_remove} >/dev/null 2>&1 fi + fi } function cleanup_docker_image { - images_to_delete=$(sudo docker images -a --filter "label=daisy_image_version" \ - --format "{{.ID}}") - - echo "Removing images... $images_to_delete" - if [[ -z "$images_to_delete" ]]; then - echo "No images to cleanup" - else - sudo docker rmi -f ${images_to_delete} >/dev/null 2>&1 - fi + images_to_delete=$(sudo docker images -a \ + --format "{{.ID}}" \ + --filter "label=daisy_image_version") + + echo "Removing images... $images_to_delete" + if [[ ! -z "$images_to_delete" ]]; then + sudo docker rmi -f ${images_to_delete} >/dev/null 2>&1 + fi } cleanup_container +cleanup_docker_image build_rpm_pkg -cleanup_container |