Bug 1486970 - Create revision and pushlog-id index routes for cron decision tasks. r=dustin,aki

This changeset actually creates the new routes we want for decision tasks, and adds the supporting code for passing push info
in to the taskgraph.

This must land after scriptworker is updated and deployed. This has the affect of also un-hardcoding the .taskcluster.yml
fields applied in the first part of this bug.

This changeset in particular will ride trains and not be uplifted (outside of compelling reasons).

Differential Revision: https://phabricator.services.mozilla.com/D5195

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Prince 2018-11-27 22:33:09 +00:00
parent 7f70461a06
commit fe977ab920
2 changed files with 14 additions and 14 deletions

View file

@ -13,12 +13,6 @@ tasks:
ownerEmail: {$if: '"@" in push.owner', then: '${push.owner}', else: '${push.owner}@noreply.mozilla.org'}
# ensure there's no trailing `/` on the repo URL
repoUrl: {$if: 'repository.url[-1] == "/"', then: {$eval: 'repository.url[:-1]'}, else: {$eval: 'repository.url'}}
# Hardcode cron push info for now, so that we can transition to using real values without breaking callers of Chain of Trust
_pushId: {$if: 'tasks_for == "cron"', then: '-1', else: {$eval: 'push.pushlog_id'}}
# action tasks can fail because of no pushdate or push comment information in context, so include them in
# hardcodes (even though they don't use these variables)
_pushDate: {$if: 'tasks_for == "cron" || tasks_for == "action"', then: '0', else: {$eval: 'push.pushdate'}}
_pushComment: {$if: 'tasks_for == "cron" || tasks_for == "action"', then: '', else: {$eval: 'push.comment'}}
in:
taskId: {$if: 'tasks_for != "action"', then: '${as_slugid("decision")}'}
taskGroupId:
@ -69,12 +63,12 @@ tasks:
routes:
$flatten:
- "tc-treeherder.v2.${repository.project}.${push.revision}.${_pushId}"
- "tc-treeherder.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
- $if: 'tasks_for == "hg-push"'
then:
- "index.gecko.v2.${repository.project}.latest.taskgraph.decision"
- "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision"
- "index.gecko.v2.${repository.project}.pushlog-id.${_pushId}.decision"
- "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision"
- "notify.email.${ownerEmail}.on-failed"
- "notify.email.${ownerEmail}.on-exception"
# Send a notification email if the push comes from try
@ -95,9 +89,11 @@ tasks:
then:
- "notify.email.taskcluster-notifications+action-task@mozilla.com.on-failed"
- "notify.email.taskcluster-notifications+action-task@mozilla.com.on-exception"
- "index.gecko.v2.${repository.project}.pushlog-id.${_pushId}.actions.${ownTaskId}"
- "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.actions.${ownTaskId}"
else: # cron
- "index.gecko.v2.${repository.project}.latest.taskgraph.decision-${cron.job_name}"
- "index.gecko.v2.${repository.project}.revision.${push.revision}.taskgraph.decision-${cron.job_name}"
- "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision-${cron.job_name}"
# list each cron task on this revision, so actions can find them
- 'index.gecko.v2.${repository.project}.revision.${push.revision}.cron.${as_slugid("decision")}'
# These are the old index routes for the decision task.
@ -147,7 +143,7 @@ tasks:
GECKO_HEAD_REPOSITORY: '${repoUrl}'
GECKO_HEAD_REF: '${push.revision}'
GECKO_HEAD_REV: '${push.revision}'
GECKO_COMMIT_MSG: {$if: 'tasks_for != "action"', then: '${_pushComment}'}
GECKO_COMMIT_MSG: {$if: 'tasks_for != "action"', then: '${push.comment}'}
HG_STORE_PATH: /builds/worker/checkouts/hg-store
TASKCLUSTER_CACHES: /builds/worker/checkouts
- $if: 'tasks_for == "action"'
@ -190,8 +186,8 @@ tasks:
cd /builds/worker/checkouts/gecko &&
ln -s /builds/worker/artifacts artifacts &&
./mach --log-no-times taskgraph decision
--pushlog-id='${_pushId}'
--pushdate='${_pushDate}'
--pushlog-id='${push.pushlog_id}'
--pushdate='${push.pushdate}'
--project='${repository.project}'
--message="$GECKO_COMMIT_MSG"
--owner='${ownerEmail}'

View file

@ -14,6 +14,7 @@ import os
import slugid
from taskgraph.util.time import current_json_time
from taskgraph.util.hg import find_hg_revision_push_info
def run_decision_task(job, params, root):
@ -36,6 +37,9 @@ def make_decision_task(params, root, symbol, arguments=[], head_rev=None):
if not head_rev:
head_rev = params['head_rev']
push_info = find_hg_revision_push_info(
params['repository_url'],
params['head_rev'])
slugids = {}
@ -59,8 +63,8 @@ def make_decision_task(params, root, symbol, arguments=[], head_rev=None):
'push': {
'revision': params['head_rev'],
# remainder are fake values, but the decision task expects them anyway
'pushlog_id': -1,
'pushdate': 0,
'pushlog_id': push_info['pushid'],
'pushdate': push_info['pushdate'],
'owner': 'cron',
'comment': '',
},