From ace29e6a7986e2bad1b3193d2e3858d452f803a1 Mon Sep 17 00:00:00 2001 From: David Galloway Date: Thu, 28 Sep 2017 12:50:39 -0400 Subject: [PATCH] scripts: Keep vagrant boxes up to date on static libvirt slaves Signed-off-by: David Galloway --- ceph-ansible-nightly/build/build | 1 + ceph-ansible-prs/build/build | 1 + ceph-ansible-scenario/build/build | 1 + ceph-docker-nightly/build/build | 1 + ceph-docker-prs/build/build | 1 + scripts/build_utils.sh | 12 ++++++++++++ 6 files changed, 17 insertions(+) diff --git a/ceph-ansible-nightly/build/build b/ceph-ansible-nightly/build/build index 4cea7f09..21e182d9 100644 --- a/ceph-ansible-nightly/build/build +++ b/ceph-ansible-nightly/build/build @@ -12,6 +12,7 @@ WORKDIR=$(mktemp -td tox.XXXXXXXXXX) delete_libvirt_vms clear_libvirt_networks restart_libvirt_services +update_vagrant_boxes # the $SCENARIO var is injected by the job template. It maps # to an actual, defined, tox environment diff --git a/ceph-ansible-prs/build/build b/ceph-ansible-prs/build/build index 11a41a1c..2ef63acb 100644 --- a/ceph-ansible-prs/build/build +++ b/ceph-ansible-prs/build/build @@ -12,6 +12,7 @@ WORKDIR=$(mktemp -td tox.XXXXXXXXXX) delete_libvirt_vms clear_libvirt_networks restart_libvirt_services +update_vagrant_boxes # This was initially in teardown but sometimes, it happens that the Jenkins Slave process # crashes before teardown is executed, it means we keep leftofver from previous build. diff --git a/ceph-ansible-scenario/build/build b/ceph-ansible-scenario/build/build index 665c4355..678004d4 100644 --- a/ceph-ansible-scenario/build/build +++ b/ceph-ansible-scenario/build/build @@ -12,6 +12,7 @@ WORKDIR=$(mktemp -td tox.XXXXXXXXXX) delete_libvirt_vms clear_libvirt_networks restart_libvirt_services +update_vagrant_boxes # the $SCENARIO var is injected by the job configuration. It maps # to an actual, defined, tox environment diff --git a/ceph-docker-nightly/build/build b/ceph-docker-nightly/build/build index 8b9adb4b..68a64c5f 100644 --- a/ceph-docker-nightly/build/build +++ b/ceph-docker-nightly/build/build @@ -18,6 +18,7 @@ newgrp docker delete_libvirt_vms clear_libvirt_networks restart_libvirt_services +update_vagrant_boxes # adding groups on the fly doesn't guarantee their availability # so we must use `sg` to execute the tests as part of the docker group to avoid diff --git a/ceph-docker-prs/build/build b/ceph-docker-prs/build/build index 6eabf8e4..a2995e87 100644 --- a/ceph-docker-prs/build/build +++ b/ceph-docker-prs/build/build @@ -18,6 +18,7 @@ newgrp docker delete_libvirt_vms clear_libvirt_networks restart_libvirt_services +update_vagrant_boxes # adding groups on the fly doesn't guarantee their availability # so we must use `sg` to execute the tests as part of the docker group to avoid diff --git a/scripts/build_utils.sh b/scripts/build_utils.sh index 611c6385..1e143ff2 100644 --- a/scripts/build_utils.sh +++ b/scripts/build_utils.sh @@ -439,3 +439,15 @@ restart_libvirt_services() { sudo service libvirt-bin restart sudo service libvirt-guests restart } + +# Function to update vagrant boxes on static libvirt slaves used for ceph-ansible and ceph-docker testing +update_vagrant_boxes() { + outdated_boxes=`vagrant box outdated --global | grep 'is outdated' | awk '{ print $2 }' | | tr -d "'"` + if [ -n "$outdated_boxes" ]; then + for box in $outdated_boxes; do + vagrant box update --box $box + done + # Clean up old images + vagrant box prune + fi +} -- 2.39.5