Bug 1534500 - Allow diffoscope tasks to run commands before running the diff. r=dustin
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 12 Mar 2019 20:21:14 +0000
changeset 521620 01712a69cb3960e602d452a39ed71396d60bfc80
parent 521619 fc4d0ac008223e2d800819892e660aaceb271db6
child 521621 3d4efdb98e8aa845a5f09239e4344ce2b2727f7d
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1534500
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534500 - Allow diffoscope tasks to run commands before running the diff. r=dustin Depends on D23074 Differential Revision: https://phabricator.services.mozilla.com/D23075
taskcluster/docker/diffoscope/get_and_diffoscope
taskcluster/taskgraph/transforms/diffoscope.py
--- a/taskcluster/docker/diffoscope/get_and_diffoscope
+++ b/taskcluster/docker/diffoscope/get_and_diffoscope
@@ -76,14 +76,18 @@ for option; do
 		POST="exit 1"
 		;;
 	*)
 		echo "Unsupported option: $option" >&2
 		exit 1
 	esac
 done
 
+if [ -n "$PRE_DIFF" ]; then
+	eval $PRE_DIFF
+fi
+
 diffoscope \
 	--html diff.html \
 	--text diff.txt \
 	--progress \
 	$DIFFOSCOPE_ARGS \
 	a b || $POST
--- a/taskcluster/taskgraph/transforms/diffoscope.py
+++ b/taskcluster/taskgraph/transforms/diffoscope.py
@@ -47,16 +47,19 @@ diff_description_schema = Schema({
 
     # Fail the task when differences are detected.
     Optional('fail-on-diff'): bool,
 
     # Whether to unpack first. Diffoscope can normally work without unpacking,
     # but when one needs to --exclude some contents, that doesn't work out well
     # if said content is packed (e.g. in omni.ja).
     Optional('unpack'): bool,
+
+    # Commands to run before performing the diff.
+    Optional('pre-diff-commands'): [basestring],
 })
 
 transforms = TransformSequence()
 transforms.add_validate(diff_description_schema)
 
 
 @transforms.add
 def fill_template(config, tasks):
@@ -133,17 +136,18 @@ def fill_template(config, tasks):
                     'type': 'file',
                     'path': '/builds/worker/diff.txt',
                     'name': 'public/diff.txt',
                 }],
                 'env': {
                     'ORIG_URL': urls['original'],
                     'NEW_URL': urls['new'],
                     'DIFFOSCOPE_ARGS': ' '.join(
-                        task[k] for k in ('args', 'extra-args') if k in task)
+                        task[k] for k in ('args', 'extra-args') if k in task),
+                    'PRE_DIFF': '; '.join(task.get('pre-diff-commands', [])),
                 },
                 'max-run-time': 1800,
             },
             'run': {
                 'using': 'run-task',
                 'checkout': task.get('unpack', False),
                 'command': '/builds/worker/bin/get_and_diffoscope{}{}'.format(
                     ' --unpack' if task.get('unpack') else '',