Bug 1534500 - Allow to configure diffoscope tasks that fail when they detect differences. r=dustin
authorMike Hommey <mh+mozilla@glandium.org>
Tue, 12 Mar 2019 20:27:34 +0000
changeset 521618 d410e91f369943daafd53906ee15357f795b06ff
parent 521617 08bd6dbd61cff62c448e03669ec0ff24fad7d8af
child 521619 fc4d0ac008223e2d800819892e660aaceb271db6
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 to configure diffoscope tasks that fail when they detect differences. r=dustin Differential Revision: https://phabricator.services.mozilla.com/D23073
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
@@ -46,14 +46,27 @@ case "$ORIG_URL" in
 		dmg/hfsplus $i.hfs extractall / $i
 	done
 	;;
 esac
 
 # Builds are 99% of the time differing in some small ways, so it's not
 # really useful to report a failure (at least not until we actually
 # care about the builds being 100% identical).
+POST=true
+
+for option; do
+	case "$option" in
+	--fail)
+		POST="exit 1"
+		;;
+	*)
+		echo "Unsupported option: $option" >&2
+		exit 1
+	esac
+done
+
 diffoscope \
 	--html diff.html \
 	--text diff.txt \
 	--progress \
 	$DIFFOSCOPE_ARGS \
-	a b || true
+	a b || $POST
--- a/taskcluster/taskgraph/transforms/diffoscope.py
+++ b/taskcluster/taskgraph/transforms/diffoscope.py
@@ -39,16 +39,19 @@ diff_description_schema = Schema({
     Required('new'): index_or_string,
 
     # Arguments to pass to diffoscope, used for job-defaults in
     # taskcluster/ci/diffoscope/kind.yml
     Optional('args'): basestring,
 
     # Extra arguments to pass to diffoscope, that can be set per job.
     Optional('extra-args'): basestring,
+
+    # Fail the task when differences are detected.
+    Optional('fail-on-diff'): bool,
 })
 
 transforms = TransformSequence()
 transforms.add_validate(diff_description_schema)
 
 
 @transforms.add
 def fill_template(config, tasks):
@@ -132,18 +135,19 @@ def fill_template(config, tasks):
                     'DIFFOSCOPE_ARGS': ' '.join(
                         task[k] for k in ('args', 'extra-args') if k in task)
                 },
                 'max-run-time': 1800,
             },
             'run': {
                 'using': 'run-task',
                 'checkout': False,
-                'command': '/builds/worker/bin/get_and_diffoscope '
-                           '"$ORIG_URL" "$NEW_URL"',
+                'command': '/builds/worker/bin/get_and_diffoscope{}'.format(
+                    ' --fail' if task.get('fail-on-diff') else '',
+                ),
             },
             'dependencies': deps,
         }
 
         if artifact.endswith('.dmg'):
             taskdesc['toolchains'] = [
                 'linux64-cctools-port',
                 'linux64-libdmg',