From f96b283dec0aa2d899ac800332ca94d835d2b52e Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: Mon, 3 Oct 2016 11:54:24 -0700 Subject: [PATCH] openqa/dispatcher: add an ugly workaround for openQA #673 We currently can't tell openQA to download the ARM kernel and initramfs with a filename unique to the build being tested, so they just get downloaded as `vmlinuz` and `initrd.img`, which means that when the next compose is tested, we won't download them again, we'll just use the existing copies (which are no longer the right ones). Because of this our current 'F25' and 'Rawhide' ARM tests are actually still using some F24 kernel image. Until the openQA bug which prevents us giving the files unique names is resolved, here's a hacky workaround: a script which wipes the files every hour if no openQA jobs are pending. --- .../openqa/dispatcher/files/openqa-arm-delete | 49 +++++++++++++++++++ roles/openqa/dispatcher/tasks/main.yml | 3 ++ 2 files changed, 52 insertions(+) create mode 100755 roles/openqa/dispatcher/files/openqa-arm-delete diff --git a/roles/openqa/dispatcher/files/openqa-arm-delete b/roles/openqa/dispatcher/files/openqa-arm-delete new file mode 100755 index 0000000000..4de6735a9b --- /dev/null +++ b/roles/openqa/dispatcher/files/openqa-arm-delete @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2016 Red Hat +# +# This script is free software; you can redistribute it +# and/or modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation, either version 3 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# Author(s): Adam Williamson + +"""Simple script to wipe ARM vmlinuz/initrd if no tests are running. +Works around https://github.com/os-autoinst/openQA/pull/673 +""" + +from openqa_client.client import OpenQA_Client +from openqa_client.const import JOB_PENDING_STATES + +def main(): + """Main function.""" + client = OpenQA_Client() + params = { + 'arch': 'arm', + 'state': ','.join(JOB_PENDING_STATES), + } + pending = client.openqa_request('GET', 'jobs', params=params)['jobs'] + if pending: + # Not safe to wipe while jobs are running or scheduled. + return + + for _file in ('/var/lib/openqa/share/factory/other/initrd.img', + '/var/lib/openqa/share/factory/other/vmlinuz'): + if os.path.isfile(_file): + os.remove(_file) + +if __name__ == '__main__': + try: + main() + except KeyboardInterrupt: + sys.stderr.write("Interrupted, exiting...\n") + sys.exit(1) diff --git a/roles/openqa/dispatcher/tasks/main.yml b/roles/openqa/dispatcher/tasks/main.yml index 55efa9319a..bb894cef02 100644 --- a/roles/openqa/dispatcher/tasks/main.yml +++ b/roles/openqa/dispatcher/tasks/main.yml @@ -124,3 +124,6 @@ - restart fedmsg-hub tags: - config + +- name: Wipe ARM kernel/initramfs hourly (workaround https://github.com/os-autoinst/openQA/pull/673 ) + copy: src=openqa-arm-delete dest=/etc/cron.hourly owner=root group=root mode=0755