Browse Source

Let taskgraph load tasks for nightly cron

master
Johan Lorenzo 2 years ago
committed by Sebastian Kaspari
parent
commit
00748497af
  1. 8
      .cron.yml
  2. 47
      automation/taskcluster/decision_task.py
  3. 4
      automation/taskcluster/lib/tasks.py
  4. 19
      taskcluster/fenix_taskgraph/loader/old_decision.py
  5. 6
      taskcluster/fenix_taskgraph/target_tasks.py

8
.cron.yml

@ -4,6 +4,14 @@
---
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
job:
type: decision-task

47
automation/taskcluster/decision_task.py

@ -96,6 +96,7 @@ def release(builder, channel, engine, is_staging, version_name):
signing_task['label'],
taskcluster_apk_paths,
channel=channel,
variant=variant,
# 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,
@ -108,21 +109,16 @@ def release_as_fennec(builder, is_staging, version_name):
variant = get_variant('fennecProduction', 'geckoBeta')
channel = 'fennec-production'
build_tasks = {}
signing_tasks = {}
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,
build_task = builder.craft_assemble_release_task(variant, channel, is_staging, version_name)
signing_task = builder.craft_release_signing_task(
build_task['label'],
variant.upstream_artifacts(),
channel,
variant,
is_staging,
)
return (build_tasks, signing_tasks)
return [build_task, signing_task]
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')
taskcluster_apk_paths = variant.upstream_artifacts()
build_tasks = {}
signing_tasks = {}
push_tasks = {}
other_tasks = {}
build_task_id = _generate_slug_id()
build_tasks[build_task_id] = builder.craft_assemble_release_task(
build_task = builder.craft_assemble_release_task(
variant, 'nightly-legacy', is_staging, version_name)
signing_task_id = _generate_slug_id()
signing_tasks[signing_task_id] = builder.craft_release_signing_task(
build_task_id,
signing_task = builder.craft_release_signing_task(
build_task['label'],
taskcluster_apk_paths,
channel='production', # Since we're publishing to the "production" app, we need to sign for production
is_staging=is_staging,
publish_to_index=False,
)
push_task_id = _generate_slug_id()
push_tasks[push_task_id] = builder.craft_push_task(
signing_task_id,
push_task = builder.craft_push_task(
signing_task['label'],
taskcluster_apk_paths,
channel='production', # We're publishing to the "production" app on the "nightly" track
variant=variant,
override_google_play_track='nightly',
is_staging=is_staging,
)
tasks = [build_task, signing_task, push_task]
if not is_staging:
nimbledroid_task_id = _generate_slug_id()
other_tasks[nimbledroid_task_id] = builder.craft_upload_apk_nimbledroid_task(
build_task_id
)
tasks.append(builder.craft_upload_apk_nimbledroid_task(build_task['label']))
return (build_tasks, signing_tasks, push_tasks, other_tasks)
def _generate_slug_id():
return taskcluster.slugId()
return tasks

4
automation/taskcluster/lib/tasks.py

@ -516,7 +516,7 @@ class TaskBuilder(object):
)
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 = {
"commit": True,
@ -544,7 +544,7 @@ class TaskBuilder(object):
':dep' if is_staging else ''
)
],
name="Push task",
name="Push task {}".format(variant.name),
description="Upload signed release builds of Fenix to Google Play",
payload=payload,
treeherder={

19
taskcluster/fenix_taskgraph/loader/old_decision.py

@ -4,6 +4,7 @@
from __future__ import print_function, unicode_literals
import datetime
import os
import re
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, '..', '..', '..'))
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
@ -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", '
'e.g.: "v1.0.0-beta.0" (beta), "v1.0.0-rc.0" (production) or "v1.0.0" (production)')
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)
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:
raise NotImplementedError('Unsupported task_name "{}"'.format(params))
else:

6
taskcluster/fenix_taskgraph/target_tasks.py

@ -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)]
@_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')
def target_tasks_raptor(full_task_graph, parameters, graph_config):
# TODO Change this target task method once old-decision loader is no more

Loading…
Cancel
Save