1
0
Fork 0

Let taskgraph load tasks for nightly cron

master
Johan Lorenzo 2019-09-16 11:03:42 +02:00 committed by Sebastian Kaspari
parent aa6021959e
commit 00748497af
5 changed files with 48 additions and 36 deletions

View File

@ -4,6 +4,14 @@
--- ---
jobs: jobs:
- name: nightly
job:
type: decision-task
treeherder-symbol: Nd
# TODO change target method once first tasks are migrated off "old-decision"
target-tasks-method: nightly
when: [{hour: 6, minute: 0}]
when: [{hour: 18, minute: 0}]
- name: raptor - name: raptor
job: job:
type: decision-task type: decision-task

View File

@ -96,6 +96,7 @@ def release(builder, channel, engine, is_staging, version_name):
signing_task['label'], signing_task['label'],
taskcluster_apk_paths, taskcluster_apk_paths,
channel=channel, channel=channel,
variant=variant,
# TODO until org.mozilla.fenix.nightly is made public, put it on the internally-testable track # 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", override_google_play_track=None if channel != "nightly" else "internal",
is_staging=is_staging, is_staging=is_staging,
@ -108,21 +109,16 @@ def release_as_fennec(builder, is_staging, version_name):
variant = get_variant('fennecProduction', 'geckoBeta') variant = get_variant('fennecProduction', 'geckoBeta')
channel = 'fennec-production' channel = 'fennec-production'
build_tasks = {} build_task = builder.craft_assemble_release_task(variant, channel, is_staging, version_name)
signing_tasks = {} signing_task = builder.craft_release_signing_task(
build_task['label'],
build_task_id = _generate_slug_id()
build_tasks[build_task_id] = builder.craft_assemble_release_task(variant, channel, is_staging, version_name)
signing_task_id = _generate_slug_id()
signing_tasks[signing_task_id] = builder.craft_release_signing_task(
build_task_id,
variant.upstream_artifacts(), variant.upstream_artifacts(),
channel, channel,
variant,
is_staging, is_staging,
) )
return (build_tasks, signing_tasks) return [build_task, signing_task]
def nightly_to_production_app(builder, is_staging, version_name): def nightly_to_production_app(builder, is_staging, version_name):
@ -132,41 +128,28 @@ def nightly_to_production_app(builder, is_staging, version_name):
variant = get_variant('fenixNightlyLegacy', 'geckoNightly') variant = get_variant('fenixNightlyLegacy', 'geckoNightly')
taskcluster_apk_paths = variant.upstream_artifacts() taskcluster_apk_paths = variant.upstream_artifacts()
build_tasks = {} build_task = builder.craft_assemble_release_task(
signing_tasks = {}
push_tasks = {}
other_tasks = {}
build_task_id = _generate_slug_id()
build_tasks[build_task_id] = builder.craft_assemble_release_task(
variant, 'nightly-legacy', is_staging, version_name) variant, 'nightly-legacy', is_staging, version_name)
signing_task_id = _generate_slug_id() signing_task = builder.craft_release_signing_task(
signing_tasks[signing_task_id] = builder.craft_release_signing_task( build_task['label'],
build_task_id,
taskcluster_apk_paths, taskcluster_apk_paths,
channel='production', # Since we're publishing to the "production" app, we need to sign for production channel='production', # Since we're publishing to the "production" app, we need to sign for production
is_staging=is_staging, is_staging=is_staging,
publish_to_index=False, publish_to_index=False,
) )
push_task_id = _generate_slug_id() push_task = builder.craft_push_task(
push_tasks[push_task_id] = builder.craft_push_task( signing_task['label'],
signing_task_id,
taskcluster_apk_paths, taskcluster_apk_paths,
channel='production', # We're publishing to the "production" app on the "nightly" track channel='production', # We're publishing to the "production" app on the "nightly" track
variant=variant,
override_google_play_track='nightly', override_google_play_track='nightly',
is_staging=is_staging, is_staging=is_staging,
) )
tasks = [build_task, signing_task, push_task]
if not is_staging: if not is_staging:
nimbledroid_task_id = _generate_slug_id() tasks.append(builder.craft_upload_apk_nimbledroid_task(build_task['label']))
other_tasks[nimbledroid_task_id] = builder.craft_upload_apk_nimbledroid_task(
build_task_id
)
return (build_tasks, signing_tasks, push_tasks, other_tasks) return tasks
def _generate_slug_id():
return taskcluster.slugId()

View File

@ -516,7 +516,7 @@ class TaskBuilder(object):
) )
def craft_push_task( def craft_push_task(
self, signing_task_label, apk_paths, channel, is_staging=False, override_google_play_track=None self, signing_task_label, apk_paths, channel, variant, is_staging=False, override_google_play_track=None,
): ):
payload = { payload = {
"commit": True, "commit": True,
@ -544,7 +544,7 @@ class TaskBuilder(object):
':dep' if is_staging else '' ':dep' if is_staging else ''
) )
], ],
name="Push task", name="Push task {}".format(variant.name),
description="Upload signed release builds of Fenix to Google Play", description="Upload signed release builds of Fenix to Google Play",
payload=payload, payload=payload,
treeherder={ treeherder={

View File

@ -4,6 +4,7 @@
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
import datetime
import os import os
import re import re
import sys import sys
@ -12,7 +13,14 @@ current_dir = os.path.dirname(os.path.realpath(__file__))
project_dir = os.path.realpath(os.path.join(current_dir, '..', '..', '..')) project_dir = os.path.realpath(os.path.join(current_dir, '..', '..', '..'))
sys.path.append(project_dir) sys.path.append(project_dir)
from automation.taskcluster.decision_task import pr, push, release, raptor from automation.taskcluster.decision_task import (
pr,
push,
raptor,
nightly_to_production_app,
release,
release_as_fennec,
)
from automation.taskcluster.lib.tasks import TaskBuilder from automation.taskcluster.lib.tasks import TaskBuilder
@ -55,8 +63,15 @@ def loader(kind, path, config, params, loaded_tasks):
raise ValueError('Github tag must be in semver format and prefixed with a "v", ' raise ValueError('Github tag must be in semver format and prefixed with a "v", '
'e.g.: "v1.0.0-beta.0" (beta), "v1.0.0-rc.0" (production) or "v1.0.0" (production)') 'e.g.: "v1.0.0-beta.0" (beta), "v1.0.0-rc.0" (production) or "v1.0.0" (production)')
elif tasks_for == 'cron': elif tasks_for == 'cron':
if params['target_tasks_method'] == 'raptor': target_tasks_method = params['target_tasks_method']
if target_tasks_method == 'raptor':
ordered_groups_of_tasks = raptor(builder, is_staging) ordered_groups_of_tasks = raptor(builder, is_staging)
elif target_tasks_method == 'nightly':
now = datetime.datetime.now().strftime('%y%m%d %H:%M')
nightly_version = 'Nightly {}'.format(now)
ordered_groups_of_tasks = release(builder, 'nightly', 'geckoNightly', is_staging, nightly_version) \
+ nightly_to_production_app(builder, is_staging, nightly_version)
ordered_groups_of_tasks += release_as_fennec(builder, is_staging, 'Signed-as-Fennec Nightly {}'.format(now))
else: else:
raise NotImplementedError('Unsupported task_name "{}"'.format(params)) raise NotImplementedError('Unsupported task_name "{}"'.format(params))
else: else:

View File

@ -20,6 +20,12 @@ def target_tasks_default(full_task_graph, parameters, graph_config):
return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)] return [l for l, t in full_task_graph.tasks.iteritems() if filter(t, parameters)]
@_target_task('nightly')
def target_tasks_raptor(full_task_graph, parameters, graph_config):
# TODO Change this target task method once old-decision loader is no more
return target_tasks_default(full_task_graph, parameters, graph_config)
@_target_task('raptor') @_target_task('raptor')
def target_tasks_raptor(full_task_graph, parameters, graph_config): def target_tasks_raptor(full_task_graph, parameters, graph_config):
# TODO Change this target task method once old-decision loader is no more # TODO Change this target task method once old-decision loader is no more