← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~hyask/autopkgtest-cloud:skia/improve_eol_experience into autopkgtest-cloud:master

 

Skia has proposed merging ~hyask/autopkgtest-cloud:skia/improve_eol_experience into autopkgtest-cloud:master.

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~hyask/autopkgtest-cloud/+git/autopkgtest-cloud/+merge/469477

Improve the EOL experience after I did it for `mantic`.
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~hyask/autopkgtest-cloud:skia/improve_eol_experience into autopkgtest-cloud:master.
diff --git a/.gitignore b/.gitignore
index 0682011..676396f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 docs/_build
 *.charm
 __pycache__
+.ipynb_checkpoints
diff --git a/dev-tools/clean_eol.sh b/dev-tools/clean_eol.sh
new file mode 100644
index 0000000..313d140
--- /dev/null
+++ b/dev-tools/clean_eol.sh
@@ -0,0 +1,36 @@
+#!/usr/bin/bash
+
+function usage() {
+    echo -e "$0 \e[4mRELEASE\e[0m"
+    echo ""
+    echo "Clean swift containers and openstack images for RELEASE"
+    echo ""
+    echo "This is meant to be run on the bastion, from the prod-proposed environment you want to clean."
+    echo "This script will look for datacenter credentials in ~/.scalingstack/*.rc and iterate on them for the removal of images."
+}
+
+
+eol_release="$1"
+if [ -z "$eol_release" ]; then
+    usage
+    exit 1
+fi
+
+echo "Cleaning $eol_release after EOL"
+
+echo "Cleaning swift containers"
+(
+    load_creds openstack
+    containers="$(swift list | grep "$eol_release")"
+    for cont in $containers; do echo "  container: ${cont}"; swift delete "$cont"; done
+)
+
+for rc in ~/.scalingstack/*.rc; do
+    echo "Cleaning $(basename "$rc")"
+    (
+        # shellcheck disable=SC1090
+        source "$rc"
+        images="$(openstack image list | grep "adt/.*$eol_release" | awk -F "| " "/adt\/ubuntu-$eol_release/"' { print $4 }')"
+        for image in $images; do echo "  image: ${image}"; echo openstack delete "$image"; done
+    )
+done
diff --git a/docs/administration.rst b/docs/administration.rst
index 6040a9c..d5b0c2f 100644
--- a/docs/administration.rst
+++ b/docs/administration.rst
@@ -202,17 +202,35 @@ being copied forward (``seed-new-release``) or devel results existing
 * Check `/running <https://autopkgtest.ubuntu.com/running/>`_ lists the new
   release, and check some package pages too.
 
+
 Removing an End of Life series
 ------------------------------
 
+Before proceeding with the steps below, please make sure that the serie is
+properly removed from ``mojo/service-bundle``, and that this change was applied
+successfully to all workers.
+
+
+Removing the tests results, logs, and images from swift and the datacenters
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+There is a script for that. On the bastion, in the *proposed-migration*
+environment, from the ``autopkgtest-cloud`` repository, just run the following
+and ensure it doesn't run into trouble:
+
+``./dev-tools/clean_eol.sh mantic``
+
+Removing the results from the web unit database
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 You’ll first want to stop the apache2 service so that browsing results will not
 fail while the database is being modified. Then there are two jobs which use
 the autopkgtest.db which will also need disabling. The ``download-results``
 service is constantly using the ``~/autopkgtest.db`` and will need to be
 stopped. The ``publish-db`` service which updates ``~/public/autopkgtest.db``
-is run minutely and will need to be disabled with ```systemctl disable publish-db```.
+is run minutely and will need to be disabled with ``systemctl disable publish-db``.
 Please re-enable it once you're finished. *NOTE* it is not enough to simply
-```systemctl stop``` the service since it gets restarted by a timer,
+``systemctl stop`` the service since it gets restarted by a timer,
 so it must be disabled.
 
 Once those steps are done then the rows can be deleted from the database.
@@ -222,6 +240,7 @@ Once those steps are done then the rows can be deleted from the database.
 * ``sqlite3 -header -column autopkgtest.db "DELETE FROM test WHERE test.release='impish';"``
 * ``sqlite3 -header -column autopkgtest.db "vacuum;"``
 
+
 API Key Integration
 -------------------
 

Follow ups