Bug 1285608 - Part 2: Make --artifact handle Android builds. r=chmanchester,maja_zf
authorNick Alexander <nalexander@mozilla.com>
Tue, 29 Nov 2016 19:52:01 -0800
changeset 324852 f72e2fa55bf5c2e87b1e5f6f1c7657ff7a635dfb
parent 324851 7ba1a4d296a14a632b85ad0a4146478c9b46c116
child 324853 e26b6b6d7d9800539151a781a684e22f525b7a57
push id24
push usermaklebus@msu.edu
push dateTue, 20 Dec 2016 03:11:33 +0000
reviewerschmanchester, maja_zf
bugs1285608
milestone53.0a1
Bug 1285608 - Part 2: Make --artifact handle Android builds. r=chmanchester,maja_zf I'm not a fan of introducing a new configuration flags (and not knowing where or how to document it!), but there's a clear need for configuration in the absence of a documented way to add a coherent "artifact build dimension" akin to "opt/debug". I like adding a subtle tri-state flag even less, but I tried this with two flags (ignore and build-variant) and it was worse, so I'm rolling with a tri-state flag. MozReview-Commit-ID: KTNvacTBUXB
testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15.py
testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_gradle.py
testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_gradle_dependencies.py
testing/mozharness/configs/builds/releng_sub_android_configs/64_checkstyle.py
testing/mozharness/configs/builds/releng_sub_android_configs/64_findbugs.py
testing/mozharness/configs/builds/releng_sub_android_configs/64_lint.py
testing/mozharness/configs/builds/releng_sub_android_configs/64_test.py
testing/mozharness/scripts/fx_desktop_build.py
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15.py
@@ -1,8 +1,9 @@
 config = {
     'base_name': 'Android armv7 API 15+ %(branch)s',
     'stage_platform': 'android-api-15',
     'build_type': 'api-15-opt',
     'src_mozconfig': 'mobile/android/config/mozconfigs/android-api-15/nightly',
     'tooltool_manifest_src': 'mobile/android/config/tooltool-manifests/android/releng.manifest',
     'multi_locale_config_platform': 'android',
+    'artifact_flag_build_variant_in_try': 'api-15-artifact',
 }
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_gradle.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_gradle.py
@@ -10,9 +10,10 @@ config = {
     # GeckoView AAR.
     'postflight_build_mach_commands': [
         ['gradle',
          'geckoview:assembleWithGeckoBinaries',
          'geckoview_example:assembleWithGeckoBinaries',
          'uploadArchives',
         ],
     ],
+    'artifact_flag_build_variant_in_try': 'api-15-gradle-artifact',
 }
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_gradle_dependencies.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_api_15_gradle_dependencies.py
@@ -14,9 +14,10 @@ config = {
          'findbugsAutomationDebug',
          # Does not include Gecko binaries -- see mobile/android/gradle/with_gecko_binaries.gradle.
          'geckoview:assembleWithoutGeckoBinaries',
          # So that we pick up the test dependencies for the builders.
          'geckoview_example:assembleWithoutGeckoBinaries',
          'geckoview_example:assembleWithoutGeckoBinariesAndroidTest',
         ],
     ],
+    'artifact_flag_build_variant_in_try': None, # There's no artifact equivalent.
 }
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_checkstyle.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_checkstyle.py
@@ -3,9 +3,10 @@ config = {
     'stage_platform': 'android-checkstyle',
     'build_type': 'api-15-opt',
     'src_mozconfig': 'mobile/android/config/mozconfigs/android-api-15-frontend/nightly',
     'tooltool_manifest_src': 'mobile/android/config/tooltool-manifests/android-frontend/releng.manifest',
     'multi_locale_config_platform': 'android',
     'postflight_build_mach_commands': [
         ['gradle', 'app:checkstyle'],
     ],
+    'artifact_flag_build_variant_in_try': None, # There's no artifact equivalent.
 }
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_findbugs.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_findbugs.py
@@ -3,9 +3,10 @@ config = {
     'stage_platform': 'android-findbugs',
     'build_type': 'api-15-opt',
     'src_mozconfig': 'mobile/android/config/mozconfigs/android-api-15-frontend/nightly',
     'tooltool_manifest_src': 'mobile/android/config/tooltool-manifests/android-frontend/releng.manifest',
     'multi_locale_config_platform': 'android',
     'postflight_build_mach_commands': [
         ['gradle', 'app:findbugsAutomationDebug'],
     ],
+    'artifact_flag_build_variant_in_try': None, # There's no artifact equivalent.
 }
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_lint.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_lint.py
@@ -3,9 +3,10 @@ config = {
     'stage_platform': 'android-lint',
     'build_type': 'api-15-opt',
     'src_mozconfig': 'mobile/android/config/mozconfigs/android-api-15-frontend/nightly',
     'tooltool_manifest_src': 'mobile/android/config/tooltool-manifests/android-frontend/releng.manifest',
     'multi_locale_config_platform': 'android',
     'postflight_build_mach_commands': [
         ['gradle', 'app:lintAutomationDebug'],
     ],
+    'artifact_flag_build_variant_in_try': None, # There's no artifact equivalent.
 }
--- a/testing/mozharness/configs/builds/releng_sub_android_configs/64_test.py
+++ b/testing/mozharness/configs/builds/releng_sub_android_configs/64_test.py
@@ -3,9 +3,10 @@ config = {
     'stage_platform': 'android-test',
     'build_type': 'api-15-opt',
     'src_mozconfig': 'mobile/android/config/mozconfigs/android-api-15-frontend/nightly',
     'tooltool_manifest_src': 'mobile/android/config/tooltool-manifests/android-frontend/releng.manifest',
     'multi_locale_config_platform': 'android',
     'postflight_build_mach_commands': [
         ['gradle', 'app:testAutomationDebugUnitTest'],
     ],
+    'artifact_flag_build_variant_in_try': None, # There's no artifact equivalent.
 }
--- a/testing/mozharness/scripts/fx_desktop_build.py
+++ b/testing/mozharness/scripts/fx_desktop_build.py
@@ -119,20 +119,48 @@ class FxDesktopBuild(BuildScript, TryToo
                 # postrun.py uses stage_platform buildbot prop as part of the log url
                 self.set_buildbot_property('stage_platform',
                                            platform_for_log_url,
                                            write_to_file=True)
             else:
                 self.fatal("'stage_platform' not determined and is required in your config")
 
         if self.try_message_has_flag('artifact'):
+            # Not all jobs that look like builds can be made into artifact
+            # builds (for example, various SAN builds might not make sense as
+            # artifact builds).  For jobs that can't be turned into artifact
+            # jobs, provide a falsy `artifact_flag_build_variant_in_try`.
+            #
+            # In addition, some jobs want to specify their artifact equivalent.
+            # Use `artifact_flag_build_variant_in_try` to specify that variant.
+            # Defaults to `artifact`, or `debug-artifact` for `debug` and
+            # `cross-debug` build variants.
+            #
+            # This is temporary, until we find a way to introduce an "artifact
+            # build dimension" like "opt"/"debug" into the CI configurations.
             self.info('Artifact build requested in try syntax.')
-            variant = 'artifact'
+
+            default = 'artifact'
             if c.get('build_variant') in ['debug', 'cross-debug']:
-                variant = 'debug-artifact'
+                default = 'debug-artifact'
+
+            variant = None
+            if 'artifact_flag_build_variant_in_try' in c:
+                variant = c.get('artifact_flag_build_variant_in_try')
+                if not variant:
+                    self.info('Build variant has falsy `artifact_flag_build_variant_in_try`; '
+                              'ignoring artifact build request and performing original build.')
+                    return
+
+                self.info('Build variant has non-falsy `artifact_build_variant_in_try`.')
+            else:
+                variant = default
+
+            self.info('Using artifact build variant "%s".' % variant)
+
             self._update_build_variant(rw_config, variant)
 
     # helpers
     def _update_build_variant(self, rw_config, variant='artifact'):
         """ Intended for use in _pre_config_lock """
         c = self.config
         variant_cfg_path, _ = BuildOptionParser.find_variant_cfg_path(
             '--custom-build-variant-cfg',