summaryrefslogtreecommitdiffstats
path: root/ci
diff options
context:
space:
mode:
authorJulien <zhang.jun3g@zte.com.cn>2017-01-04 00:42:01 +0800
committerJulien <zhang.jun3g@zte.com.cn>2017-01-05 22:29:04 +0800
commit173c0521aa2c15f786be4c7be477e7cfea865f74 (patch)
treeeb4883662fc2e7761599a8af730f7441697ac839 /ci
parente412a63ae5a0791512347d7ab842f27f0afc59aa (diff)
Run docker from dockerhub
1. Use the build image in releng; 2. Pull down the newest image and run; 3. Delete unused codes; wait from docker image build(26449) and upload in the dockerhub Change-Id: I72b072aff6cd905b426451768dc51d17eee6c0a3 Signed-off-by: Julien <zhang.jun3g@zte.com.cn>
Diffstat (limited to 'ci')
-rwxr-xr-xci/build_rpm/build_rpms.sh36
1 files changed, 5 insertions, 31 deletions
diff --git a/ci/build_rpm/build_rpms.sh b/ci/build_rpm/build_rpms.sh
index 48a87236..c98747b6 100755
--- a/ci/build_rpm/build_rpms.sh
+++ b/ci/build_rpm/build_rpms.sh
@@ -17,45 +17,19 @@ function build_rpm_pkg {
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 \
+ sudo docker run --rm -t \
+ -v $DAISYDIR:/opt/daisy4nfv \
-v $CACHE_DIRECTORY:/home/cache \
- -t daisy4nfv_rpm \
+ --name daisy opnfv/daisy \
/opt/daisy4nfv/ci/build_rpm/build_rpms_docker.sh \
$OPNFV_ARTIFACT_VERSION
}
-function cleanup_container {
- 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 -q \
- --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
+ if [ ! -z "$(sudo docker images -q opnfv/daisy)" ]; then
+ sudo docker rmi opnfv/daisy >/dev/null 2>&1
fi
}
-cleanup_container
cleanup_docker_image
build_rpm_pkg