diff options
author | Zygmunt Krynicki <zygmunt.krynicki@canonical.com> | 2015-08-10 19:51:39 +0200 |
---|---|---|
committer | Zygmunt Krynicki <zygmunt.krynicki@canonical.com> | 2015-08-10 19:51:39 +0200 |
commit | 6e7ec6f353dad6f1a7808db02268c1c7318a4ff9 (patch) | |
tree | 61121d866b81ec5c40ec701d93d0963328632312 /jobs | |
parent | 969028605296490ef2cdac3c13e57590b2878a6d (diff) |
providers:checkbox: base64 encode binary attachments
This patch changes the following attachment jobs: firmware/fwts_desktop_diagnosis_results.log firmware/fwts_desktop_diagnosis_results_hwe.log installer_bootchart.tgz power-management/poweroff-log-attach power-management/reboot-log-attach stress/graphics-tarball stress/poweroff_30_check_log stress/poweroff_30_log stress/poweroff_check_log stress/poweroff_log stress/reboot_30_check_log stress/reboot_30_log stress/reboot_check_log stress/reboot_log suspend/xrandr_screens_after_suspend.tar.gz In addition, the following local job, which generates attachment jobs, is also changed: suspend/xrandr_screens_after_suspend.tar.gz There are several changes applied here. First, for jobs that use this, the test condition is changed from -e to -f. The rest of the code won't cope with non-file input so it's better to be explicit. While it might, perhaps, be better for those jobs to fail, the condition is there because there is no explicit dependency (because we want to attach log files even if, or especially when, the related non-attachment job fails. The most important change is the way those two attachment jobs operate. Instead of compressing the file and then dumping the binary, compressed data each of the log files is compressed on the fly (to stdout) and base64 encoded. This makes the job re-runnable (as the original log file is no longer removed by gzip) and, most importantly, the output is always valid ASCII text. This should address the issue where those attachments would just end up being empty in the submission. As a small detail, to ensure that the errors are propagated a bash-specific 'pipefail' option is enabled. This lets simple constructs such as: tar cvz /path/to/some/things | base64 Behave correctly when tar fails for any reason. This change was only made to jobs that don't already use the [ -f ... ] && construct as it seems not to be needed there. Fixes: https://bugs.launchpad.net/plainbox-provider-checkbox/+bug/1479648 Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
Diffstat (limited to 'jobs')
-rw-r--r-- | jobs/firmware.txt.in | 4 | ||||
-rw-r--r-- | jobs/info.txt.in | 4 | ||||
-rw-r--r-- | jobs/power-management.txt.in | 8 | ||||
-rw-r--r-- | jobs/stress.txt.in | 30 | ||||
-rw-r--r-- | jobs/suspend.txt.in | 4 |
5 files changed, 33 insertions, 17 deletions
diff --git a/jobs/firmware.txt.in b/jobs/firmware.txt.in index 3e6f935..c653120 100644 --- a/jobs/firmware.txt.in +++ b/jobs/firmware.txt.in @@ -51,7 +51,7 @@ plugin: attachment estimated_duration: 0.5 id: firmware/fwts_desktop_diagnosis_results.log command: - [ -e $PLAINBOX_SESSION_SHARE/fwts_desktop_diagnosis_results.log ] && gzip -c $PLAINBOX_SESSION_SHARE/fwts_desktop_diagnosis_results.log + [ -f $PLAINBOX_SESSION_SHARE/fwts_desktop_diagnosis_results.log ] && gzip -c $PLAINBOX_SESSION_SHARE/fwts_desktop_diagnosis_results.log | base64 _description: Attaches the FWTS desktop diagnosis results log to the submission _summary: Attach FWTS desktop diagnosis log to submission @@ -59,7 +59,7 @@ plugin: attachment estimated_duration: 0.5 id: firmware/fwts_desktop_diagnosis_results_hwe.log command: - [ -e $PLAINBOX_SESSION_SHARE/fwts_desktop_diagnosis_results_hwe.log ] && gzip -c $PLAINBOX_SESSION_SHARE/fwts_desktop_diagnosis_results_hwe.log + [ -f $PLAINBOX_SESSION_SHARE/fwts_desktop_diagnosis_results_hwe.log ] && gzip -c $PLAINBOX_SESSION_SHARE/fwts_desktop_diagnosis_results_hwe.log | base64 _description: Attaches the FWTS desktop diagnosis results log to the submission (to HWE) _summary: Attach FWTS desktop diagnosis log to submission (to HWE) diff --git a/jobs/info.txt.in b/jobs/info.txt.in index 199f816..22ae54f 100644 --- a/jobs/info.txt.in +++ b/jobs/info.txt.in @@ -223,13 +223,13 @@ command: plugin: attachment id: installer_bootchart.tgz -command: [ -e /var/log/installer/bootchart.tgz ] && cat /var/log/installer/bootchart.tgz +command: [ -f /var/log/installer/bootchart.tgz ] && base64 /var/log/installer/bootchart.tgz _description: installs the installer bootchart tarball if it exists. plugin: attachment id: installer_debug.gz user: root -command: [ -e /var/log/installer/debug ] && gzip -9 -c /var/log/installer/debug +command: [ -f /var/log/installer/debug ] && gzip -9 -c /var/log/installer/debug | base64 estimated_duration: 0.1 _description: Attaches the installer debug log if it exists. diff --git a/jobs/power-management.txt.in b/jobs/power-management.txt.in index 7fae122..af93f2c 100644 --- a/jobs/power-management.txt.in +++ b/jobs/power-management.txt.in @@ -57,7 +57,9 @@ _description: plugin: attachment id: power-management/poweroff-log-attach estimated_duration: 1.0 -command: tar cvfz ${PLAINBOX_SESSION_SHARE}/power-management_poweroff.tgz ${PLAINBOX_SESSION_SHARE}/*poweroff.1.log && cat ${PLAINBOX_SESSION_SHARE}/power-management_poweroff.tgz +command: + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/*poweroff.1.log | base64 _description: This will attach any logs from the power-management/poweroff test to the results. @@ -85,7 +87,9 @@ _description: plugin: attachment id: power-management/reboot-log-attach estimated_duration: 1.0 -command: tar cvfz ${PLAINBOX_SESSION_SHARE}/power-management_reboot.tgz ${PLAINBOX_SESSION_SHARE}/*reboot.1.log && cat ${PLAINBOX_SESSION_SHARE}/power-management_reboot.tgz +command: + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/*reboot.1.log | base64 _description: This will attach any logs from the power-management/reboot test to the results. diff --git a/jobs/stress.txt.in b/jobs/stress.txt.in index 00c0492..855dfe3 100644 --- a/jobs/stress.txt.in +++ b/jobs/stress.txt.in @@ -175,7 +175,9 @@ plugin: attachment id: stress/reboot_log estimated_duration: 1.0 depends: stress/reboot -command: tar cvfz $PLAINBOX_SESSION_SHARE/stress_reboot.tgz $PLAINBOX_SESSION_SHARE/*reboot.100.log && cat $PLAINBOX_SESSION_SHARE/stress_reboot.tgz +command: + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/*reboot.100.log | base64 plugin: shell id: stress/reboot_30 @@ -193,7 +195,9 @@ _description: plugin: attachment id: stress/reboot_30_log depends: stress/reboot_30 -command: tar cvfz $PLAINBOX_SESSION_SHARE/stress_reboot_30.tgz $PLAINBOX_SESSION_SHARE/*reboot.30.log && cat $PLAINBOX_SESSION_SHARE/stress_reboot_30.tgz +command: + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/*reboot.30.log | base64 plugin: shell id: stress/poweroff @@ -212,7 +216,9 @@ plugin: attachment id: stress/poweroff_log estimated_duration: 1.0 depends: stress/poweroff -command: tar cvfz $PLAINBOX_SESSION_SHARE/stress_poweroff.tgz $PLAINBOX_SESSION_SHARE/*poweroff.100.log && cat $PLAINBOX_SESSION_SHARE/stress_poweroff.tgz +command: + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/*poweroff.100.log | base64 plugin: shell id: stress/poweroff_30 @@ -230,7 +236,9 @@ _description: plugin: attachment id: stress/poweroff_30_log depends: stress/poweroff_30 -command: tar cvfz $PLAINBOX_SESSION_SHARE/stress_poweroff_30.tgz $PLAINBOX_SESSION_SHARE/*poweroff.30.log && cat $PLAINBOX_SESSION_SHARE/stress_poweroff_30.tgz +command: + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/*poweroff.30.log | base64 plugin: shell id: stress/reboot_30_check @@ -244,7 +252,8 @@ id: stress/reboot_30_check_log estimated_duration: 1.0 depends: stress/reboot_30_check command: - tar cvfz $PLAINBOX_SESSION_SHARE/stress_reboot_check_30.tgz $PLAINBOX_SESSION_SHARE/pm_log_check_reboot.30.log && cat $PLAINBOX_SESSION_SHARE/stress_reboot_check_30.tgz + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/pm_log_check_reboot.30.log | base64 plugin: shell id: stress/poweroff_30_check @@ -258,7 +267,8 @@ id: stress/poweroff_30_check_log estimated_duration: 1.0 depends: stress/poweroff_30_check command: - tar cvfz $PLAINBOX_SESSION_SHARE/stress_poweroff_check_30.tgz $PLAINBOX_SESSION_SHARE/pm_log_check_poweroff.30.log && cat $PLAINBOX_SESSION_SHARE/stress_poweroff_check_30.tgz + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/pm_log_check_poweroff.30.log | base64 plugin: shell id: stress/reboot_check @@ -272,7 +282,8 @@ id: stress/reboot_check_log estimated_duration: 1.0 depends: stress/reboot_check command: - tar cvfz $PLAINBOX_SESSION_SHARE/stress_reboot_check.tgz $PLAINBOX_SESSION_SHARE/pm_log_check_reboot.100.log && cat $PLAINBOX_SESSION_SHARE/stress_reboot_check.tgz + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/pm_log_check_reboot.100.log | base64 plugin: shell id: stress/poweroff_check @@ -286,7 +297,8 @@ id: stress/poweroff_check_log estimated_duration: 1.0 depends: stress/poweroff_check command: - tar cvfz $PLAINBOX_SESSION_SHARE/stress_poweroff_check.tgz $PLAINBOX_SESSION_SHARE/pm_log_check_poweroff.100.log && cat $PLAINBOX_SESSION_SHARE/stress_poweroff_check.tgz + set -o pipefail + tar cvz $PLAINBOX_SESSION_SHARE/pm_log_check_poweroff.100.log | base64 plugin: shell id: stress/graphics @@ -304,7 +316,7 @@ id: stress/graphics-tarball estimated_duration: 1.0 requires: package.name == 'x11-apps' -command: [ -e $PLAINBOX_SESSION_SHARE/graphics-stress-results ] && tar cvfz $PLAINBOX_SESSION_SHARE/graphics-stress-results.tar.gz $PLAINBOX_SESSION_SHARE/graphics-stress-results +command: [ -f $PLAINBOX_SESSION_SHARE/graphics-stress-results ] && tar cvz $PLAINBOX_SESSION_SHARE/graphics-stress-results | base64 _description: Attaches the graphics stress results to the submission. plugin: shell diff --git a/jobs/suspend.txt.in b/jobs/suspend.txt.in index 80d8c4e..16b8755 100644 --- a/jobs/suspend.txt.in +++ b/jobs/suspend.txt.in @@ -1422,7 +1422,7 @@ command: xrandr_cycle --keyword=after_suspend --screenshot-dir $PLAINBOX_SESSION plugin: attachment id: suspend/xrandr_screens_after_suspend.tar.gz depends: suspend/cycle_resolutions_after_suspend -command: [ -e $PLAINBOX_SESSION_SHARE/xrandr_screens_after_suspend.tgz ] && cat $PLAINBOX_SESSION_SHARE/xrandr_screens_after_suspend.tgz +command: [ -f $PLAINBOX_SESSION_SHARE/xrandr_screens_after_suspend.tgz ] && base64 $PLAINBOX_SESSION_SHARE/xrandr_screens_after_suspend.tgz _description: This attaches screenshots from the suspend/cycle_resolutions_after_suspend test to the results submission. plugin: local @@ -1434,7 +1434,7 @@ command: plugin: attachment id: suspend/`echo ${index}`_xrandr_screens_after_suspend.tar.gz depends: suspend/`echo ${index}`_cycle_resolutions_after_suspend_`echo "${product}" | sed 's/ /_/g;s/[^_a-zA-Z0-9-]//g'` - command: [ -e $PLAINBOX_SESSION_SHARE/`echo ${index}`_xrandr_screens_after_suspend.tgz ] && cat $PLAINBOX_SESSION_SHARE/`echo ${index}`_xrandr_screens_after_suspend.tgz + command: [ -f $PLAINBOX_SESSION_SHARE/`echo ${index}`_xrandr_screens_after_suspend.tgz ] && base64 $PLAINBOX_SESSION_SHARE/`echo ${index}`_xrandr_screens_after_suspend.tgz _description: This attaches screenshots from the suspend/cycle_resolutions_after_suspend test to the results submission. EOF |