Bug 1304487 - Make incompatible mozharness actions a no-op when try syntax includes '--artifact'; r?armenzg draft
authorMaja Frydrychowicz <mjzffr@gmail.com>
Fri, 30 Sep 2016 14:15:52 -0400
changeset 419672 3db2762360ec102e9bfe44e8e6038df225479eae
parent 419507 5ffed033557e5b6f9694123f1948f867f913ede3
child 532633 385d7408c949ca43b7f57c5fece19b84d3b22a99
push id30995
push usermjzffr@gmail.com
push dateFri, 30 Sep 2016 19:46:34 +0000
reviewersarmenzg
bugs1304487
milestone52.0a1
Bug 1304487 - Make incompatible mozharness actions a no-op when try syntax includes '--artifact'; r?armenzg Rather than clearing actions in volatile_config, add in actions from the artifact config's default_actions. Incompatible actions are then skipped based on 'forced_artifact_build' config value. MozReview-Commit-ID: IZuDvxcQ7cN
testing/mozharness/mozharness/mozilla/building/buildbase.py
testing/mozharness/mozharness/mozilla/secrets.py
testing/mozharness/scripts/fx_desktop_build.py
--- a/testing/mozharness/mozharness/mozilla/building/buildbase.py
+++ b/testing/mozharness/mozharness/mozilla/building/buildbase.py
@@ -1814,16 +1814,19 @@ or run without that action (ie: --no-{ac
         files = shlex.split(output)
         abs_files = [os.path.abspath(os.path.join(objdir, f)) for f in files]
         manifest_file = os.path.join(env["UPLOAD_PATH"],
                                      "signing_manifest.json")
         self.write_to_file(manifest_file,
                            self.generate_signing_manifest(abs_files))
 
     def check_test(self):
+        if self.config.get('forced_artifact_build'):
+            self.info('Skipping due to forced artifact build.')
+            return
         c = self.config
         dirs = self.query_abs_dirs()
 
         env = self.query_build_env()
         env.update(self.query_check_test_env())
 
         if c.get('enable_pymake'):  # e.g. windows
             pymake_path = os.path.join(dirs['abs_src_dir'], 'build',
@@ -1852,16 +1855,20 @@ or run without that action (ie: --no-{ac
 
     def generate_build_stats(self):
         """grab build stats following a compile.
 
         This action handles all statistics from a build: 'count_ctors'
         and then posts to graph server the results.
         We only post to graph server for non nightly build
         """
+        if self.config.get('forced_artifact_build'):
+            self.info('Skipping due to forced artifact build.')
+            return
+
         import tarfile
         import zipfile
         c = self.config
 
         if c.get('enable_count_ctors'):
             self.info("counting ctors...")
             self._count_ctors()
         else:
@@ -2039,16 +2046,19 @@ or run without that action (ie: --no-{ac
                                    branch=unittest_branch,
                                    sendchange_props=sendchange_props)
         else:
             self.fatal('type: "%s" is unknown for sendchange type. valid '
                        'strings are "unittest" or "talos"' % test_type)
 
     def update(self):
         """ submit balrog update steps. """
+        if self.config.get('forced_artifact_build'):
+            self.info('Skipping due to forced artifact build.')
+            return
         if not self.query_is_nightly():
             self.info("Not a nightly build, skipping balrog submission.")
             return
 
         # grab any props available from this or previous unclobbered runs
         self.generate_build_props(console_output=False,
                                   halt_on_failure=False)
 
--- a/testing/mozharness/mozharness/mozilla/secrets.py
+++ b/testing/mozharness/mozharness/mozilla/secrets.py
@@ -41,16 +41,20 @@ class SecretsMixin(object):
 
         The `filename` key in the dictionary gives the filename to which the
         secret should be written.
 
         The optional `min_scm_level` key gives a minimum SCM level at which this
         secret is required.  For lower levels, the value of the 'default` key
         is used, or no secret is written.
         """
+        if self.config.get('forced_artifact_build'):
+            self.info('Skipping due to forced artifact build.')
+            return
+
         secret_files = self.config.get('secret_files', [])
 
         scm_level = self.config.get('scm-level', 1)
         subst = {
             'scm-level': scm_level,
         }
 
         for sf in secret_files:
--- a/testing/mozharness/scripts/fx_desktop_build.py
+++ b/testing/mozharness/scripts/fx_desktop_build.py
@@ -147,20 +147,31 @@ class FxDesktopBuild(BuildScript, TryToo
         c.update({
             'build_variant': variant,
             'config_files': c['config_files'] + [variant_cfg_path]
         })
 
         self.info("Updating self.config with the following from {}:".format(variant_cfg_path))
         self.info(pprint.pformat(variant_cfg_dict))
         c.update(variant_cfg_dict)
+        c['forced_artifact_build'] = True
         # Bug 1231320 adds MOZHARNESS_ACTIONS in TaskCluster tasks to override default_actions
         # We don't want that when forcing an artifact build.
-        self.info("Clearing actions from volatile_config to use default_actions.")
-        rw_config.volatile_config['actions'] = None
+        if rw_config.volatile_config['actions']:
+            self.info("Updating volatile_config to include default_actions "
+                      "from {}.".format(variant_cfg_path))
+            # add default actions in correct order
+            combined_actions = []
+            for a in rw_config.all_actions:
+                if a in c['default_actions'] or a in rw_config.volatile_config['actions']:
+                    combined_actions.append(a)
+            rw_config.volatile_config['actions'] = combined_actions
+            self.info("Actions in volatile_config are now: {}".format(
+                rw_config.volatile_config['actions'])
+            )
         # replace rw_config as well to set actions as in BaseScript
         rw_config.set_config(c, overwrite=True)
         rw_config.update_actions()
         self.actions = tuple(rw_config.actions)
         self.all_actions = tuple(rw_config.all_actions)
 
 
     def query_abs_dirs(self):