Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge automation as shipit ff product #1421

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
15 changes: 15 additions & 0 deletions api/products.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,21 @@ firefox:
- push_firefox
- ship_firefox
version-class: "mozilla_version.gecko.FirefoxVersion"
merge-automation:
can-be-disabled: true
authorized-ldap-groups:
- shipit_firefox
- shipit_relman
phases:
[
"beta-to-release",
"bump-central",
"bump-esr115",
"central-to-beta",
"early-to-late-beta",
"release-to-esr",
]
version-class: "mozilla_version.gecko.FirefoxVersion"
firefox-android:
can-be-disabled: true
authorized-ldap-groups:
Expand Down
5 changes: 5 additions & 0 deletions api/src/backend_common/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def create_app(project_name, app_name, root_path, extensions=[], config=None, re
if redirect_root_to_api:
app.add_url_rule("/", "root", lambda: flask.redirect(app.api.swagger_url))

# from pprint import pformat
# logger.warn(pformat(build_api_specification(root_path)))
app.api.register(build_api_specification(root_path))
logger.debug("Initialized %s", app.name)
return app
Expand Down Expand Up @@ -94,11 +96,14 @@ def _read_specification_file(path):

def get_product_names(include_legacy=False):
products_config = get_products_config()
# logger.warn(products_config)
# logger.warn([product_name for product_name, product_config in products_config.items() if not product_config["legacy"] or include_legacy])
return [product_name for product_name, product_config in products_config.items() if not product_config["legacy"] or include_legacy]


@cache
def get_products_config():
# logger.warn(_PRODUCT_YML_PATH)
with open(_PRODUCT_YML_PATH) as f:
products_config = yaml.safe_load(f)

Expand Down
101 changes: 101 additions & 0 deletions api/src/backend_common/action.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"context": [],
"description": "Merge repository branches.",
"extra": {
"actionPerm": "merge-automation"
},
"hookGroupId": "project-gecko",
"hookId": "in-tree-action-3-merge-automation/f526da500b",
"hookPayload": {
"decision": {
"action": {
"cb_name": "merge-automation",
"description": "Merge repository branches.",
"name": "merge-automation",
"symbol": "${input.behavior}",
"taskGroupId": "Q3lH6-MQQA68FxgMpa89Cw",
"title": "Merge Day Automation"
},
"push": {
"base_revision": "2a006ccd4a0f986d95177aa1cf2875b054b4e52b",
"owner": "[email protected]",
"pushlog_id": "19187",
"revision": "bcf5880a2381bd2062bb754047fe6b64308de475"
},
"repository": {
"level": "3",
"project": "mozilla-beta",
"url": "https://hg.mozilla.org/releases/mozilla-beta"
}
},
"user": {
"input": {
"$eval": "input"
},
"taskGroupId": {
"$eval": "taskGroupId"
},
"taskId": {
"$eval": "taskId"
}
}
},
"kind": "hook",
"name": "merge-automation",
"schema": {
"properties": {
"behavior": {
"default": "central-to-beta",
"description": "The type of release promotion to perform.",
"enum": [
"beta-to-release",
"bump-central",
"bump-esr115",
"central-to-beta",
"early-to-late-beta",
"release-to-esr"
],
"type": "string"
},
"fetch-version-from": {
"description": "Path to file used when querying current version.",
"type": "string"
},
"force-dry-run": {
"default": true,
"description": "Override other options and do not push changes",
"type": "boolean"
},
"from-branch": {
"description": "The fx head of the source, such as central",
"type": "string"
},
"from-repo": {
"description": "The URI of the source repository",
"type": "string"
},
"push": {
"default": false,
"description": "Push changes using to_repo and to_branch",
"type": "boolean"
},
"ssh-user-alias": {
"description": "The alias of an ssh account to use when pushing changes.",
"type": "string"
},
"to-branch": {
"description": "The fx head of the target, such as beta",
"type": "string"
},
"to-repo": {
"description": "The push URI of the target repository",
"type": "string"
}
},
"required": [
"behavior"
],
"type": "object"
},
"title": "Merge Day Automation"
}
1 change: 1 addition & 0 deletions api/src/shipit_api/admin/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ def add_release(body):
)
try:
next_version = bump_version(release.product, release.version)
# this is input to the release-promotion action - the merge-automation action has a diff input schema
common_input = {
"build_number": release.build_number,
"next_version": next_version,
Expand Down
9 changes: 7 additions & 2 deletions api/src/shipit_api/admin/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,13 @@ def get_parameters(decision_task_id):


def release_promotion_flavors(release, actions, verify_supported_flavors=True):
relpro = find_action("release-promotion", actions)
avail_flavors = relpro["schema"]["properties"]["release_promotion_flavor"]["enum"]
if release.product == "merge-automation": # I am just exploring, so I special cased merge-automation here (cuz it's not release-promotion)
action_name = "merge-automation"
else:
action_name = "release-promotion"
action = find_action(action_name, actions)
flavors_key = "release_promotion_flavor" if release.product != "merge-automation" else "behavior"
avail_flavors = action["schema"]["properties"][flavors_key]["enum"]
if verify_supported_flavors:
return extract_our_flavors(avail_flavors, release.product, release.version, release.partial_updates, release.product_key)
return [{"name": name, "in_previous_graph_ids": True} for name in avail_flavors]
16 changes: 16 additions & 0 deletions api/src/shipit_api/public/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,26 @@ def list_releases(product=None, branch=None, version=None, build_number=None, st
releases = releases.filter(Release.build_number == build_number)
elif build_number:
raise BadRequest(description="Filtering by build_number without version is not supported.")
if product == "merge-automation":
print(product)
print(branch)
print(version)
print(build_number)
print(status)
releases = releases.filter(Release.status.in_(status))
if product == "merge-automation":
print(releases)
releases = [r.json for r in releases.all()]
if product == "merge-automation":
print(releases)
return releases
# filter out not parsable releases, like 1.1, 1.1b1, etc
releases = filter(good_version, releases)
if product == "merge-automation":
print(releases)
print(_sort_releases_by_product_then_version(releases))
import sys
sys.stdout.flush()
return _sort_releases_by_product_then_version(releases)


Expand Down
17 changes: 17 additions & 0 deletions frontend/src/configs/development.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,23 @@ module.exports = {
],
enablePartials: false,
},
{
product: 'merge-automation',
prettyName: 'Merge Automation',
appName: 'merge-automation',
branches: [
{
prettyName: 'Beta',
project: 'mozilla-beta',
branch: 'releases/mozilla-beta',
repo: 'https://hg.mozilla.org/releases/mozilla-beta',
enableReleaseEta: false,
disableable: true,
versionFile: 'browser/config/version_display.txt',
},
],
enablePartials: false,
},
],
thunderbird: [
{
Expand Down
18 changes: 12 additions & 6 deletions frontend/src/views/NewRelease/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,20 @@ export default function NewRelease() {
};

const renderReleaseInfo = () => {
// shipit is looking for a version_display.txt file here:
// https://hg.mozilla.org/try/raw-file/bd34c4d287cae93983357f5ef26f41d29f590878/merge-automation/config/version_display.txt
return (
<React.Fragment>
<Typography component="h3" variant="h6">
Version: {version}
</Typography>
<Typography component="h3" variant="h6">
Build #: {buildNumber}
</Typography>
{version && (
<Typography component="h3" variant="h6">
Version: {version}
</Typography>
)}
{buildNumber && (
<Typography component="h3" variant="h6">
Build #: {buildNumber}
</Typography>
)}
</React.Fragment>
);
};
Expand Down