From aebcc9208063847bfbf8d564986fc35ca26c252f Mon Sep 17 00:00:00 2001 From: Mitchell Hentges Date: Tue, 2 Jul 2019 11:34:04 -0700 Subject: [PATCH] Re-enables pushing nightly to org.mozilla.fenix (#3823) * Re-enables pushing nightly to org.mozilla.fenix * Publishes org.mozilla.fenix.nightly releases on internal track --- app/build.gradle | 3 ++ app/src/main/java/org/mozilla/fenix/Config.kt | 1 + automation/taskcluster/decision_task.py | 42 ++++++++++++++++++- automation/taskcluster/lib/tasks.py | 26 ++++++------ 4 files changed, 59 insertions(+), 13 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index c59ce02ee..7cc1bcbf0 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -47,6 +47,9 @@ android { applicationIdSuffix ".performancetest" debuggable true } + nightlyLegacy releaseTemplate >> { + buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true" + } nightly releaseTemplate >> { applicationIdSuffix ".nightly" buildConfigField "boolean", "USE_RELEASE_VERSIONING", "true" diff --git a/app/src/main/java/org/mozilla/fenix/Config.kt b/app/src/main/java/org/mozilla/fenix/Config.kt index 01d965642..060c93f56 100644 --- a/app/src/main/java/org/mozilla/fenix/Config.kt +++ b/app/src/main/java/org/mozilla/fenix/Config.kt @@ -19,6 +19,7 @@ object Config { "production" -> ReleaseChannel.Production "beta" -> ReleaseChannel.Beta "nightly" -> ReleaseChannel.Nightly + "nightlyLegacy" -> ReleaseChannel.Nightly "debug" -> ReleaseChannel.Debug else -> ReleaseChannel.Production // Performance-test builds should test production behaviour } diff --git a/automation/taskcluster/decision_task.py b/automation/taskcluster/decision_task.py index ef190b0df..16cdb7f2e 100644 --- a/automation/taskcluster/decision_task.py +++ b/automation/taskcluster/decision_task.py @@ -131,6 +131,45 @@ def release(channel, is_staging, version_name): signing_task_id, apks=apk_paths, channel=channel, + # TODO until org.mozilla.fenix.nightly is made public, put it on the internally-testable track + override_google_play_track=None if channel != "nightly" else "internal", + is_staging=is_staging, + ) + + return (build_tasks, signing_tasks, push_tasks) + + +def nightly_to_production_app(is_staging, version_name): + # Since the Fenix nightly was launched, we've pushed it to the production app "org.mozilla.fenix" on the + # "nightly" track. We're moving towards having each channel be published to its own app, but we need to + # keep updating this "backwards-compatible" nightly for a while yet + build_type = 'nightlyLegacy' + variants = get_variants_for_build_type(build_type) + architectures = [variant.abi for variant in variants] + apk_paths = ["public/target.{}.apk".format(arch) for arch in architectures] + + build_tasks = {} + signing_tasks = {} + push_tasks = {} + + build_task_id = taskcluster.slugId() + build_tasks[build_task_id] = BUILDER.craft_assemble_release_task(architectures, build_type, is_staging, version_name, index_channel='nightly') + + signing_task_id = taskcluster.slugId() + signing_tasks[signing_task_id] = BUILDER.craft_release_signing_task( + build_task_id, + apk_paths=apk_paths, + channel='production', # Since we're publishing to the "production" app, we need to sign for production + index_channel='nightly', + is_staging=is_staging, + ) + + push_task_id = taskcluster.slugId() + push_tasks[push_task_id] = BUILDER.craft_push_task( + signing_task_id, + apks=apk_paths, + channel='production', # We're publishing to the "production" app on the "nightly" track + override_google_play_track='nightly', is_staging=is_staging, ) @@ -168,7 +207,8 @@ if __name__ == "__main__": ordered_groups_of_tasks = raptor(result.staging) elif command == 'nightly': nightly_version = datetime.datetime.now().strftime('Nightly %y%m%d %H:%M') - ordered_groups_of_tasks = release('nightly', result.staging, nightly_version) + ordered_groups_of_tasks = release('nightly', result.staging, nightly_version) \ + + nightly_to_production_app(result.staging, nightly_version) elif command == 'github-release': version = result.tag[1:] # remove prefixed "v" beta_semver = re.compile(r'^v\d+\.\d+\.\d+-beta\.\d+$') diff --git a/automation/taskcluster/lib/tasks.py b/automation/taskcluster/lib/tasks.py index 176af03aa..424720f99 100644 --- a/automation/taskcluster/lib/tasks.py +++ b/automation/taskcluster/lib/tasks.py @@ -40,12 +40,13 @@ class TaskBuilder(object): self.date = arrow.get(date_string) self.trust_level = trust_level - def craft_assemble_release_task(self, architectures, channel, is_staging, version_name): + def craft_assemble_release_task(self, architectures, build_type, is_staging, version_name, index_channel=None): + index_channel = index_channel or build_type artifacts = { 'public/target.{}.apk'.format(arch): { "type": 'file', "path": '/opt/fenix/app/build/outputs/apk/' - '{arch}/{channel}/app-{arch}-{channel}-unsigned.apk'.format(arch=arch, channel=channel), + '{arch}/{build_type}/app-{arch}-{build_type}-unsigned.apk'.format(arch=arch, build_type=build_type), "expires": taskcluster.stringDate(taskcluster.fromNow(DEFAULT_EXPIRES_IN)), } for arch in architectures @@ -54,7 +55,7 @@ class TaskBuilder(object): if is_staging: secret_index = 'garbage/staging/project/mobile/fenix' else: - secret_index = 'project/mobile/fenix/{}'.format(channel) + secret_index = 'project/mobile/fenix/{}'.format(index_channel) pre_gradle_commands = ( 'python automation/taskcluster/helper/get-secret.py -s {} -k {} -f {}'.format( @@ -67,10 +68,10 @@ class TaskBuilder(object): ) ) - capitalized_channel = upper_case_first_letter(channel) + capitalized_build_type = upper_case_first_letter(build_type) gradle_commands = ( './gradlew --no-daemon -PversionName="{}" clean test assemble{}'.format( - version_name, capitalized_channel), + version_name, capitalized_build_type), ) command = ' && '.join( @@ -85,8 +86,8 @@ class TaskBuilder(object): ] return self._craft_build_ish_task( - name='Build {} task'.format(capitalized_channel), - description='Build Fenix {} from source code'.format(capitalized_channel), + name='Build {} task'.format(capitalized_build_type), + description='Build Fenix {} from source code'.format(capitalized_build_type), command=command, scopes=[ "secrets:get:{}".format(secret_index) @@ -98,7 +99,7 @@ class TaskBuilder(object): 'machine': { 'platform': 'android-all', }, - 'symbol': '{}-A'.format(channel), + 'symbol': '{}-A'.format(build_type), 'tier': 1, }, ) @@ -423,18 +424,19 @@ class TaskBuilder(object): ) def craft_release_signing_task( - self, build_task_id, apk_paths, channel, is_staging + self, build_task_id, apk_paths, channel, is_staging, index_channel=None ): + index_channel = index_channel or channel staging_prefix = '.staging' if is_staging else '' routes = [ "index.project.mobile.fenix.v2{}.{}.{}.{}.{}.latest".format( - staging_prefix, channel, self.date.year, self.date.month, self.date.day + staging_prefix, index_channel, self.date.year, self.date.month, self.date.day ), "index.project.mobile.fenix.v2{}.{}.{}.{}.{}.revision.{}".format( - staging_prefix, channel, self.date.year, self.date.month, self.date.day, self.commit + staging_prefix, index_channel, self.date.year, self.date.month, self.date.day, self.commit ), - "index.project.mobile.fenix.v2{}.{}.latest".format(staging_prefix, channel), + "index.project.mobile.fenix.v2{}.{}.latest".format(staging_prefix, index_channel), ] capitalized_channel = upper_case_first_letter(channel)