Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .taskcluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ tasks:
routes:
$flattenDeep:
- checks
- $if: 'level == "3"'
- $if: 'level == "3" || repoUrl == "https://github.com/mozilla-mobile/staging-firefox-ios"'
then:
- tc-treeherder.v2.${project}.${head_sha}
- $if: 'tasks_for == "github-push"'
Expand Down
34 changes: 27 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dependencies": {
"@mozilla/readability": "^0.4.4",
"darkreader": "^4.9.89",
"dompurify": "^3.1.3",
"dompurify": "^3.2.4",
"page-metadata-parser": "1.1.4"
},
"devDependencies": {
Expand Down
9 changes: 9 additions & 0 deletions taskcluster/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,12 @@ workers:

scriptworker:
scope-prefix: project:mobile:firefox-ios:releng

release-promotion:
flavors:
promote:
target-tasks-method: promote
push:
target-tasks-method: push
ship:
target-tasks-method: ship
2 changes: 1 addition & 1 deletion taskcluster/ffios_taskgraph/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def register(graph_config):
# Setup mozilla-taskgraph
register_mozilla_taskgraph(graph_config)

_import_modules(["job", "parameters", "routes", "target_tasks"])
_import_modules(["job", "parameters", "routes", "target_tasks", "release_promotion"])


def _import_modules(modules):
Expand Down
201 changes: 201 additions & 0 deletions taskcluster/ffios_taskgraph/release_promotion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,201 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.


import os

from mozilla_version.mobile import MobileVersion
from taskgraph.actions.registry import register_callback_action
from taskgraph.decision import taskgraph_decision
from taskgraph.parameters import Parameters
from taskgraph.taskgraph import TaskGraph
from taskgraph.util.taskcluster import get_artifact
from taskgraph.util.taskgraph import (
find_decision_task,
find_existing_tasks_from_previous_kinds,
)

RELEASE_PROMOTION_PROJECTS = (
"https://github.com/mozilla-mobile/firefox-ios",
"https://github.com/mozilla-mobile/staging-firefox-ios",
)


def is_release_promotion_available(parameters):
return parameters["head_repository"] in RELEASE_PROMOTION_PROJECTS


@register_callback_action(
name="release-promotion",
title="Release Promotion",
symbol="${input.release_promotion_flavor}",
description="Release Promotion",
permission="release-promotion",
order=500,
context=[],
available=is_release_promotion_available,
schema=lambda graph_config: {
"type": "object",
"properties": {
"build_number": {
"type": "integer",
"default": 1,
"minimum": 1,
"title": "The release build number",
"description": (
"The release build number. Starts at 1 per "
"release version, and increments on rebuild."
),
},
"do_not_optimize": {
"type": "array",
"description": (
"Optional: a list of labels to avoid optimizing out "
"of the graph (to force a rerun of, say, "
"funsize docker-image tasks)."
),
"items": {
"type": "string",
},
},
"revision": {
"type": "string",
"title": "Optional: revision to ship",
"description": ("Optional: the revision to ship."),
},
"release_promotion_flavor": {
"type": "string",
"description": "The flavor of release promotion to perform.",
"default": "build",
"enum": sorted(graph_config["release-promotion"]["flavors"].keys()),
},
"rebuild_kinds": {
"type": "array",
"description": (
"Optional: an array of kinds to ignore from the previous "
"graph(s)."
),
"default": graph_config["release-promotion"].get("rebuild-kinds", []),
"items": {
"type": "string",
},
},
"previous_graph_ids": {
"type": "array",
"description": (
"Optional: an array of taskIds of decision or action "
"tasks from the previous graph(s) to use to populate "
"our `previous_graph_kinds`."
),
"items": {
"type": "string",
},
},
"version": {
"type": "string",
"description": (
"Optional: override the version for release promotion. "
"Occasionally we'll land a taskgraph fix in a later "
"commit, but want to act on a build from a previous "
"commit. If a version bump has landed in the meantime, "
"relying on the in-tree version will break things."
),
"default": "",
},
"next_version": {
"type": "string",
"description": "Next version.",
"default": "",
},
},
"required": [
"release_promotion_flavor",
"version",
"build_number",
"next_version",
],
},
)
def release_promotion_action(parameters, graph_config, input, task_group_id, task_id):
release_promotion_flavor = input["release_promotion_flavor"]
promotion_config = graph_config["release-promotion"]["flavors"][
release_promotion_flavor
]

target_tasks_method = promotion_config["target-tasks-method"].format(
project=parameters["project"]
)
rebuild_kinds = input.get(
"rebuild_kinds", promotion_config.get("rebuild-kinds", [])
)
do_not_optimize = input.get(
"do_not_optimize", promotion_config.get("do-not-optimize", [])
)

# make parameters read-write
parameters = dict(parameters)
# Build previous_graph_ids from ``previous_graph_ids`` or ``revision``.
previous_graph_ids = input.get("previous_graph_ids")
if not previous_graph_ids:
previous_graph_ids = [find_decision_task(parameters, graph_config)]

# Download parameters from the first decision task
parameters = get_artifact(previous_graph_ids[0], "public/parameters.yml")
# Download and combine full task graphs from each of the previous_graph_ids.
# Sometimes previous relpro action tasks will add tasks, like partials,
# that didn't exist in the first full_task_graph, so combining them is
# important. The rightmost graph should take precedence in the case of
# conflicts.
combined_full_task_graph = {}
for graph_id in previous_graph_ids:
full_task_graph = get_artifact(graph_id, "public/full-task-graph.json")
combined_full_task_graph.update(full_task_graph)
_, combined_full_task_graph = TaskGraph.from_json(combined_full_task_graph)
parameters["existing_tasks"] = find_existing_tasks_from_previous_kinds(
combined_full_task_graph, previous_graph_ids, rebuild_kinds
)
parameters["do_not_optimize"] = do_not_optimize
parameters["target_tasks_method"] = target_tasks_method
parameters["build_number"] = int(input["build_number"])
# When doing staging releases on try, we still want to re-use tasks from
# previous graphs.
parameters["optimize_target_tasks"] = True
parameters["shipping_phase"] = input["release_promotion_flavor"]

version_in_file = read_version_file()
version_string = input.get("version", None)

# shipit uses the version in version.txt to determine next version number; check that its passed in
# in the payload
if not version_string:
version_string = version_in_file
elif version_string != version_in_file:
raise ValueError(
"Version given in tag ({}) does not match the one in version.txt ({})".format(
version_string, version_in_file
)
)

parameters["version"] = version_string
parameters["head_tag"] = "v{}".format(version_string)
parameters["next_version"] = input["next_version"]

release_type = "release"
version = MobileVersion.parse(version_string)
if version.is_beta:
release_type = "beta"

parameters["release_type"] = release_type
parameters["tasks_for"] = "action"
parameters["pull_request_number"] = None

# make parameters read-only
parameters = Parameters(**parameters)

taskgraph_decision({"root": graph_config.root_dir}, parameters=parameters)


def read_version_file():
with open(os.path.join(os.path.dirname(__file__), "..", "..", "version.txt")) as f:
return f.read().strip()
1 change: 1 addition & 0 deletions taskcluster/requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
# https://taskcluster-taskgraph.readthedocs.io/en/latest/howto/bootstrap-taskgraph.html

mozilla-taskgraph>=3.0.3
mozilla-version>=3.1.0
taskcluster-taskgraph>=13.1.0
8 changes: 8 additions & 0 deletions taskcluster/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ arrow==1.3.0 \
--hash=sha256:c728b120ebc00eb84e01882a6f5e7927a53960aa990ce7dd2b10f39005a67f80 \
--hash=sha256:d4540617648cb5f895730f1ad8c82a65f2dad0166f57b75f3ca54759c4d67a85
# via cookiecutter
attrs==25.1.0 \
--hash=sha256:1c97078a80c814273a76b2a298a932eb681c87415c11dee0a6921de7f1b02c3e \
--hash=sha256:c75a69e28a550a7e93789579c22aa26b0f5b83b75dc4e08fe092980051e1090a
# via mozilla-version
binaryornot==0.4.4 \
--hash=sha256:359501dfc9d40632edc9fac890e19542db1a287bbcfa58175b66658392018061 \
--hash=sha256:b8b71173c917bddcd2c16070412e369c3ed7f0528926f70cac18a6c97fd563e4
Expand Down Expand Up @@ -214,6 +218,10 @@ mozilla-taskgraph==3.0.3 \
--hash=sha256:0a9a4ad20163fb85f56584ce05c5c9fdd4948e2ddfe1a568446b7e63e5da95fd \
--hash=sha256:65d0dcadae2960d7a45ffeb07479dcf9f4d9c5478555e5b6f3ba2098c5af3f06
# via -r requirements.in
mozilla-version==3.1.0 \
--hash=sha256:3a9463ebcf2249dc8bcf504e246b6b5977c902dfa819de31602e10bce032ed93 \
--hash=sha256:f798e716da9063608a0b49ca1ec0a51b73ac810c3cc8a4bcc2c461df902b147c
# via -r requirements.in
pygments==2.18.0 \
--hash=sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199 \
--hash=sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a
Expand Down