Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/buildfarm/release/release-runner3.py b/buildfarm/release/release-runner3.py
- --- a/buildfarm/release/release-runner3.py
- +++ b/buildfarm/release/release-runner3.py
- @@ -1,14 +1,15 @@
- #!/usr/bin/env python
- """
- Release runner to schedule action tasks (in-tree scheduling)
- """
- import argparse
- +import copy
- import logging
- import os
- import re
- import site
- import sys
- import taskcluster
- import time
- import yaml
- @@ -109,17 +110,16 @@ def main(options):
- rr = ReleaseRunner(api_root=api_root, username=username, password=password)
- tc_config = {
- "credentials": {
- "clientId": config["taskcluster"].get("client_id"),
- "accessToken": config["taskcluster"].get("access_token"),
- },
- "maxRetries": 12,
- }
- - queue = taskcluster.Queue(tc_config)
- while True:
- try:
- log.debug('Fetching release requests')
- rr.get_release_requests([r['pattern'] for r in config['releases']])
- if rr.new_releases:
- new_releases = run_prebuild_sanity_checks(
- rr, config['releases'])
- @@ -131,23 +131,26 @@ def main(options):
- except:
- log.error("Caught exception when polling:", exc_info=True)
- sys.exit(5)
- rc = 0
- for release in new_releases:
- try:
- next_version = bump_version(release["version"].replace("esr", ""))
- - action_task_id, action_task = generate_action_task(
- + action_task_id, action_task, scopes = generate_action_task(
- project=release["branchShortName"],
- revision=release["mozillaRevision"],
- next_version=next_version,
- build_number=release["buildNumber"],
- release_promotion_flavor="promote_{}".format(release["product"])
- )
- + options = copy.deepcopy(tc_config)
- + options["authorizedScopes"] = scopes
- + queue = taskcluster.Queue(tc_config)
- submit_action_task(queue=queue, action_task_id=action_task_id,
- action_task=action_task)
- rr.mark_as_completed(release)
- l10n_url = rr.release_l10n_api.getL10nFullUrl(release['name'])
- email_release_drivers(smtp_server=smtp_server, from_=notify_from,
- to=notify_to, release=release,
- task_group_id=action_task_id, l10n_url=l10n_url)
- except Exception as exception:
- diff --git a/buildfarm/release/trigger_action.py b/buildfarm/release/trigger_action.py
- --- a/buildfarm/release/trigger_action.py
- +++ b/buildfarm/release/trigger_action.py
- @@ -30,36 +30,38 @@ def main():
- )
- parser.add_argument("--release-runner-config", required=True, type=argparse.FileType('r'),
- help="Release runner config")
- parser.add_argument("--action-flavor", required=True, choices=SUPPORTED_ACTIONS)
- parser.add_argument("--force", action="store_true", default=False,
- help="Submit action task without asking")
- args = parser.parse_args()
- release_runner_config = yaml.safe_load(args.release_runner_config)
- +
- + task = get_task(args.action_task_id)
- + action_input = task["extra"]["action"]["context"]["input"]
- + parameters = task["extra"]["action"]["context"]["parameters"]
- + action_task_id, action_task, scopes = generate_action_task(
- + project=parameters["project"],
- + revision=parameters["head_rev"],
- + next_version=action_input["next_version"],
- + build_number=action_input["build_number"],
- + release_promotion_flavor=args.action_flavor
- + )
- +
- tc_config = {
- "credentials": {
- "clientId": release_runner_config["taskcluster"].get("client_id"),
- "accessToken": release_runner_config["taskcluster"].get("access_token"),
- },
- "maxRetries": 12,
- + "authorizedScopes": scopes,
- }
- queue = taskcluster.Queue(tc_config)
- - task = get_task(args.action_task_id)
- - action_input = task["extra"]["action"]["context"]["input"]
- - parameters = task["extra"]["action"]["context"]["parameters"]
- - action_task_id, action_task = generate_action_task(
- - project=parameters["project"],
- - revision=parameters["head_rev"],
- - next_version=action_input["next_version"],
- - build_number=action_input["build_number"],
- - release_promotion_flavor=args.action_flavor
- - )
- -
- log.info("Submitting action task %s for %s", action_task_id, args.action_flavor)
- log.info("Project: %s", parameters["project"])
- log.info("Revision: %s", parameters["head_rev"])
- log.info("Next version: %s", action_input["next_version"])
- log.info("Build number: %s", action_input["build_number"])
- log.info("Task definition:\n%s", json.dumps(action_task, sort_keys=True, indent=2))
- if not args.force:
- yes_no = raw_input("Submit the task? [y/N]: ")
- diff --git a/lib/python/kickoff/actions.py b/lib/python/kickoff/actions.py
- --- a/lib/python/kickoff/actions.py
- +++ b/lib/python/kickoff/actions.py
- @@ -24,16 +24,19 @@ def fetch_actions_json(task_id):
- return q.json()
- def generate_action_task(project, revision, next_version, build_number, release_promotion_flavor):
- decision_task_route = "gecko.v2.{project}.revision.{revision}.firefox.decision".format(
- project=project, revision=revision)
- index = taskcluster.Index()
- decision_task_id = index.findTask(decision_task_route)["taskId"]
- + queue = taskcluster.Queue()
- + decision_task = queue.task(decision_task_id)
- + decision_task_scopes = decision_task["scopes"]
- actions = fetch_actions_json(decision_task_id)
- relpro = find_action("release-promotion", actions)
- context = copy.deepcopy(actions["variables"]) # parameters
- action_task_id = slugid.nice()
- context.update({
- "input": {
- "build_number": build_number,
- @@ -42,16 +45,16 @@ def generate_action_task(project, revisi
- },
- "ownTaskId": action_task_id,
- "taskId": None,
- "task": None,
- })
- action_task = jsone.render(relpro["task"], context)
- # override ACTION_TASK_GROUP_ID, so we know the new ID in advance
- action_task["payload"]["env"]["ACTION_TASK_GROUP_ID"] = action_task_id
- - return action_task_id, action_task
- + return action_task_id, action_task, decision_task_scopes
- def submit_action_task(queue, action_task_id, action_task):
- result = queue.createTask(action_task_id, action_task)
- log.info("Submitted action task %s", action_task_id)
- log.info("Action task:\n%s", action_task)
- log.info("Result:\n%s", result)
Add Comment
Please, Sign In to add comment