diff options
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/build_rpm/build_rpms.sh | 5 | ||||
-rwxr-xr-x | ci/deploy/deploy.sh | 2 | ||||
-rwxr-xr-x | ci/kolla-build.sh | 13 |
3 files changed, 14 insertions, 6 deletions
diff --git a/ci/build_rpm/build_rpms.sh b/ci/build_rpm/build_rpms.sh index e0472a24..48a87236 100755 --- a/ci/build_rpm/build_rpms.sh +++ b/ci/build_rpm/build_rpms.sh @@ -33,7 +33,7 @@ function cleanup_container { 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} \ + "$ops" ${containers_to_kill} \ | egrep -v '(^\s*$)' \ | sort | uniq) @@ -47,8 +47,7 @@ function cleanup_container { } function cleanup_docker_image { - images_to_delete=$(sudo docker images -a \ - --format "{{.ID}}" \ + images_to_delete=$(sudo docker images -q \ --filter "label=daisy_image_version") echo "Removing images... $images_to_delete" diff --git a/ci/deploy/deploy.sh b/ci/deploy/deploy.sh index a2d18496..91d97784 100755 --- a/ci/deploy/deploy.sh +++ b/ci/deploy/deploy.sh @@ -88,7 +88,7 @@ sleep 20 echo "====== install daisy===========" $deploy_path/trustme.sh $daisy_ip $daisy_passwd scp -r $WORKSPACE root@$daisy_ip:/home - +ssh root@$daisy_ip "touch /root/.ssh/know_hosts" execute_on_jumpserver $daisy_ip "mkdir -p /home/daisy_install" update_config $WORKSPACE/deploy/daisy.conf daisy_management_ip $daisy_ip scp $WORKSPACE/deploy/daisy.conf root@$daisy_ip:/home/daisy_install diff --git a/ci/kolla-build.sh b/ci/kolla-build.sh index 39828ece..53ad8c16 100755 --- a/ci/kolla-build.sh +++ b/ci/kolla-build.sh @@ -21,6 +21,7 @@ set -o pipefail KOLLA_GIT=$1 KOLLA_BRANCH=$2 KOLLA_GIT_VERSION= +KOLLA_IMAGE_VERSION= KOLLA_GIT_DIR=/tmp/kolla-git REGISTRY_VOLUME_DIR=/tmp/registry BUILD_OUTPUT_DIR=/tmp/kolla-build-output @@ -106,7 +107,7 @@ function cleanup_registry_data { function cleanup_kolla_image { echo "Cleaning Kolla images" - if [ -d $KOLLA_GIT_DIR ] ; then + if [ -d $KOLLA_GIT_DIR/kolla ] ; then pushd $KOLLA_GIT_DIR/kolla (./tools/cleanup-images 2>&1) || true > /dev/null; popd @@ -132,6 +133,9 @@ function pack_registry_data { pushd $BUILD_OUTPUT_DIR echo $KOLLA_GIT_VERSION > registry-$version-$datetag.version + echo "branch = $KOLLA_BRANCH" >> registry-$version-$datetag.version + echo "tag = $KOLLA_IMAGE_VERSION" >> registry-$version-$datetag.version + echo "date = $datetag" >> registry-$version-$datetag.version tar czf kolla-image-$version-$datetag.tgz $REGISTRY_VOLUME_DIR \ registry-$version-$datetag.version rm -rf registry-$version-$datetag.version @@ -147,8 +151,10 @@ function update_kolla_code { if [ ! -d $KOLLA_GIT_DIR/kolla ] ; then pushd $KOLLA_GIT_DIR git clone $KOLLA_GIT + pushd $KOLLA_GIT_DIR/kolla git checkout $KOLLA_BRANCH popd + popd else pushd $KOLLA_GIT_DIR/kolla git remote update @@ -158,8 +164,10 @@ function update_kolla_code { fi pushd $KOLLA_GIT_DIR/kolla - KOLLA_GIT_VERSION=`git log -1 --pretty="%H"` + KOLLA_GIT_VERSION=$(git log -1 --pretty="%H") tox -e genconfig + KOLLA_IMAGE_VERSION=$(cat $KOLLA_GIT_DIR/kolla/etc/kolla/kolla-build.conf \ + | grep "#tag" | gawk -F' = ' '{print $2}') popd } @@ -189,6 +197,7 @@ pre_check # Try to cleanup images of the last failed run, if any. cleanup_kolla_image update_kolla_code +cleanup_kolla_image # Make sure there is no garbage in the registry server. cleanup_registry_server |