Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Commit

Permalink
Re-enables pushing nightly to org.mozilla.fenix (#3823)
Browse files Browse the repository at this point in the history
* Re-enables pushing nightly to org.mozilla.fenix

* Publishes org.mozilla.fenix.nightly releases on internal track
  • Loading branch information
Mitchell Hentges committed Jul 2, 2019
1 parent dbe29eb commit aebcc92
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 13 deletions.
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/org/mozilla/fenix/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
42 changes: 41 additions & 1 deletion automation/taskcluster/decision_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

Expand Down Expand Up @@ -168,7 +207,8 @@ def release(channel, is_staging, version_name):
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+$')
Expand Down
26 changes: 14 additions & 12 deletions automation/taskcluster/lib/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ def __init__(
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
Expand All @@ -54,7 +55,7 @@ def craft_assemble_release_task(self, architectures, channel, is_staging, versio
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(
Expand All @@ -67,10 +68,10 @@ def craft_assemble_release_task(self, architectures, channel, is_staging, versio
)
)

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(
Expand All @@ -85,8 +86,8 @@ def craft_assemble_release_task(self, architectures, channel, is_staging, versio
]

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)
Expand All @@ -98,7 +99,7 @@ def craft_assemble_release_task(self, architectures, channel, is_staging, versio
'machine': {
'platform': 'android-all',
},
'symbol': '{}-A'.format(channel),
'symbol': '{}-A'.format(build_type),
'tier': 1,
},
)
Expand Down Expand Up @@ -423,18 +424,19 @@ def craft_raptor_signing_task(
)

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)
Expand Down

0 comments on commit aebcc92

Please sign in to comment.