def craft_release_signing_task( self, build_task_id, apk_paths, track, is_staging=False, ): capitalized_track = upper_case_first_letter(track) index_release = 'staging.{}'.format(track) if is_staging else track routes = [ "index.project.mobile.fenix.v2.{}.{}.{}.{}.latest".format( index_release, self.date.year, self.date.month, self.date.day), "index.project.mobile.fenix.v2.{}.{}.{}.{}.revision.{}".format( index_release, self.date.year, self.date.month, self.date.day, self.commit), "index.project.mobile.fenix.v2.{}.latest".format(index_release), ] return self._craft_signing_task( name="Signing {} task".format(capitalized_track), description="Sign {} builds of Fenix".format(capitalized_track), signing_type="dep" if is_staging else track, assemble_task_id=build_task_id, apk_paths=apk_paths, routes=routes, treeherder={ 'jobKind': 'other', 'machine': { 'platform': 'android-all', }, 'symbol': '{}-s'.format(track), 'tier': 1, }, )
def craft_assemble_release_task(self, architectures, channel, is_staging, version_name): 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), "expires": taskcluster.stringDate( taskcluster.fromNow(DEFAULT_EXPIRES_IN)), } for arch in architectures } if is_staging: secret_index = 'garbage/staging/project/mobile/fenix' else: secret_index = 'project/mobile/fenix/{}'.format(channel) pre_gradle_commands = ( 'python automation/taskcluster/helper/get-secret.py -s {} -k {} -f {}' .format(secret_index, key, target_file) for key, target_file in ( ('sentry_dsn', '.sentry_token'), ('leanplum', '.leanplum_token'), ('adjust', '.adjust_token'), )) capitalized_channel = upper_case_first_letter(channel) gradle_commands = ( './gradlew --no-daemon -PversionName={} clean test assemble{}'. format(version_name, capitalized_channel), ) command = ' && '.join(cmd for commands in (pre_gradle_commands, gradle_commands) for cmd in commands if cmd) routes = [] if is_staging else [ "[email protected]" ] return self._craft_build_ish_task( name='Build {} task'.format(capitalized_channel), description='Build Fenix {} from source code'.format( capitalized_channel), command=command, scopes=["secrets:get:{}".format(secret_index)], artifacts=artifacts, routes=routes, treeherder={ 'jobKind': 'build', 'machine': { 'platform': 'android-all', }, 'symbol': '{}-A'.format(channel), 'tier': 1, }, )
def craft_release_signing_task( 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, index_channel, self.date.year, self.date.month, self.date.day ), "index.project.mobile.fenix.v2{}.{}.{}.{}.{}.revision.{}".format( staging_prefix, index_channel, self.date.year, self.date.month, self.date.day, self.commit ), "index.project.mobile.fenix.v2{}.{}.latest".format(staging_prefix, index_channel), ] capitalized_channel = upper_case_first_letter(channel) return self._craft_signing_task( name="Signing {} task".format(capitalized_channel), description="Sign {} builds of Fenix".format(capitalized_channel), signing_type="dep" if is_staging else channel, assemble_task_id=build_task_id, apk_paths=apk_paths, routes=routes, treeherder={ 'jobKind': 'other', 'machine': { 'platform': 'android-all', }, 'symbol': '{}-s'.format(channel), 'tier': 1, }, )
def craft_assemble_release_task(self, variant, channel, is_staging, version_name): if is_staging: secret_index = 'garbage/staging/project/mobile/fenix' else: secret_index = 'project/mobile/fenix/{}'.format(channel) pre_gradle_commands = ( 'python automation/taskcluster/helper/get-secret.py -s {} -k {} -f {}'.format( secret_index, key, target_file ) for key, target_file in ( ('sentry_dsn', '.sentry_token'), ('leanplum', '.leanplum_token'), ('adjust', '.adjust_token'), ('firebase', 'app/src/{}/res/values/firebase.xml'.format(variant.build_type)), ) ) capitalized_build_type = upper_case_first_letter(variant.build_type) gradle_commands = ( './gradlew --no-daemon -PversionName="{}" clean test assemble{}'.format( version_name, capitalized_build_type), ) command = ' && '.join( cmd for commands in (pre_gradle_commands, gradle_commands) for cmd in commands if cmd ) routes = [] if is_staging else [ "[email protected]" ] return self._craft_build_ish_task( 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) ], artifacts=variant.artifacts(), routes=routes, treeherder={ 'jobKind': 'build', 'machine': { 'platform': 'android-all', }, 'symbol': '{}-A'.format(variant.build_type), 'tier': 1, }, )
def craft_assemble_release_task(self, architectures, track, is_staging, version_name): artifacts = { 'public/target.{}.apk'.format(arch): { "type": 'file', "path": '/opt/fenix/app/build/outputs/apk/' '{arch}/{track}/app-{arch}-{track}-unsigned.apk'.format( arch=arch, track=track), "expires": taskcluster.stringDate( taskcluster.fromNow(DEFAULT_EXPIRES_IN)), } for arch in architectures } def secret_index(name): if is_staging: return 'garbage/staging/project/mobile/fenix/{}'.format(name) elif track == 'nightly': # TODO: Move nightly secrets to "project/mobile/fenix/nightly/..." return 'project/mobile/fenix/{}'.format(name) else: return 'project/mobile/fenix/{}/{}'.format(track, name) sentry_secret = secret_index('sentry') leanplum_secret = secret_index('leanplum') adjust_secret = secret_index('adjust') pre_gradle_commands = ( 'python automation/taskcluster/helper/get-secret.py -s {} -k {} -f {}' .format(secret, key, target_file) for secret, key, target_file in ( (sentry_secret, 'dsn', '.sentry_token'), (leanplum_secret, 'production', '.leanplum_token'), (adjust_secret, 'adjust', '.adjust_token'), )) capitalized_track = upper_case_first_letter(track) gradle_commands = ( './gradlew --no-daemon -PcrashReports=true -Ptelemetry=true -PversionName={} clean test assemble{}' .format(version_name, capitalized_track), ) command = ' && '.join(cmd for commands in (pre_gradle_commands, gradle_commands) for cmd in commands if cmd) routes = [] if is_staging else [ "[email protected]" ] return self._craft_build_ish_task( name='Build {} task'.format(capitalized_track), description='Build Fenix {} from source code'.format( capitalized_track), command=command, scopes=[ "secrets:get:{}".format(secret) for secret in (sentry_secret, leanplum_secret, adjust_secret) ], artifacts=artifacts, routes=routes, treeherder={ 'jobKind': 'build', 'machine': { 'platform': 'android-all', }, 'symbol': '{}-A'.format(track), 'tier': 1, }, )