Commit 0a44f01f authored by Dustin J. Mitchell's avatar Dustin J. Mitchell
Browse files

Bug 1524358 - use ownTaskId, instead of as_slugid('decision'), in...

Bug 1524358 - use ownTaskId, instead of as_slugid('decision'), in .taskcluster.yml r=Callek,tomprince

This is a forward-looking change to allow evaluation of .taskcluster.yml in
situations where as_slugid is not defined -- such as in the Taskcluster hooks
service.

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

--HG--
extra : moz-landing-system : lando
parent da6fa3a0
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@
#     repository: {url, project, level},
#     now,
#     as_slugid: // function
#     ownTaskId: // taskId of the task that will be created
#   }
#
# - cron tasks - See taskcluster/taskgraph/cron/decision.py
@@ -16,7 +17,7 @@
#     repository: {url, project, level},
#     cron: {task_id, job_name, job_symbol, quoted_args},
#     now,
#     as_slugid, // function
#     ownTaskId: // taskId of the task that will be created
#   }
#
# - action tasks - See:
@@ -58,13 +59,13 @@ tasks:
        # ensure there's no trailing `/` on the repo URL
        repoUrl: {$if: 'repository.url[-1] == "/"', then: {$eval: 'repository.url[:-1]'}, else: {$eval: 'repository.url'}}
      in:
        taskId: {$if: 'tasks_for != "action"', then: '${as_slugid("decision")}'}
        taskId: {$if: 'tasks_for != "action"', then: '${ownTaskId}'}
        taskGroupId:
          $if: 'tasks_for == "action"'
          then:
            '${action.taskGroupId}'
          else:
            '${as_slugid("decision")}' # same as taskId; this is how automation identifies a decision tsak
            '${ownTaskId}' # same as taskId; this is how automation identifies a decision tsak
        schedulerId: 'gecko-level-${repository.level}'

        created: {$fromNow: ''}
@@ -137,7 +138,7 @@ tasks:
                - "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")}'
                - 'index.gecko.v2.${repository.project}.revision.${push.revision}.cron.${ownTaskId}'
                # BUG 1500166 Notify ciduty by email if a nightly hook fails
                - "notify.email.ciduty+failedcron@mozilla.com.on-failed"
                - "notify.email.ciduty+exceptioncron@mozilla.com.on-exception"
+1 −10
Original line number Diff line number Diff line
@@ -43,15 +43,6 @@ def make_decision_task(params, root, symbol, arguments=[]):
        params['repository_url'],
        params['head_rev'])

    slugids = {}

    def as_slugid(name):
        # https://github.com/taskcluster/json-e/issues/164
        name = name[0]
        if name not in slugids:
            slugids[name] = slugid.nice()
        return slugids[name]

    # provide a similar JSON-e context to what mozilla-taskcluster provides:
    # https://docs.taskcluster.net/reference/integrations/mozilla-taskcluster/docs/taskcluster-yml
    # but with a different tasks_for and an extra `cron` section
@@ -78,7 +69,7 @@ def make_decision_task(params, root, symbol, arguments=[]):
            'quoted_args': ' '.join(pipes.quote(a) for a in arguments),
        },
        'now': current_json_time(),
        'as_slugid': as_slugid,
        'ownTaskId': slugid.nice(),
    }

    rendered = jsone.render(taskcluster_yml, context)