Commit 268e98b0 authored by Dustin J. Mitchell's avatar Dustin J. Mitchell
Browse files

Bug 1328727: use a version-1 .taskcluster.yml; r=aki,jonasfj

This makes a slight change to the resulting decision task, by putting the
comment in an environment variable. This avoids the need to perform shell
quoting (which mozilla-taskcluster was doing a poor job of anyway).

MozReview-Commit-ID: 4MRhJKDIZkk

--HG--
extra : rebase_source : 7fd4a55c574d7542825a9a2a6f37aba0b4fbec1d
parent 75ef0012
Loading
Loading
Loading
Loading
+89 −113
Original line number Original line Diff line number Diff line
---
# This file is handled by mozilla-taskcluster; see
version: 0
# https://docs.taskcluster.net/reference/integrations/mozilla-taskcluster/docs/taskcluster-yml
metadata:
version: 1
  name: 'Taskcluster tasks for Gecko'
  description: "The taskcluster task graph for Gecko trees"
  owner: mozilla-taskcluster-maintenance@mozilla.com
  source: {{{source}}}

scopes:
  # Note the below scopes are insecure however these get overriden on the server
  # side to whatever scopes are set by mozilla-taskcluster.
  - queue:*
  - docker-worker:*
  - scheduler:*

# This file undergoes substitution to create tasks.  For on-push tasks, that
# substitution is done by mozilla-taskcluster.  For cron tasks, that substitution
# is done by `taskcluster/taskgraph/cron/decision.py`.  If you change any of the
# template parameters, please do so in all three places!
#
# Available template parameters:
#
# - now:            current time
# - owner:          push user (email address)
# - source:         URL of this YAML file
# - url:            repository URL
# - project:        alias for the destination repository (basename of
#                   the repo url)
# - level:          SCM level of the destination repository
#                   (1 = try, 3 = core)
# - revision:       hg revision of the head of the push
# - comment:        comment of the push
# - pushlog_id:     id in the pushlog table of the repository
#
# and functions:
# - as_slugid:      convert a label into a slugId
# - from_now:       generate a timestamp at a fixed offset from now
# - shellquote:     quote the contents for injection into shell

# The resulting tasks' taskGroupId will be equal to the taskId of the first
# task listed here, which should be the decision task.  This gives other tools
# an easy way to determine the ID of the decision task that created a
# particular group.

tasks:
tasks:
  - taskId: '{{#as_slugid}}decision task{{/as_slugid}}'
  $let:
    task:
    # sometimes the push user is just `ffxbld` or the like, but we want an email-like field..
      created: '{{now}}'
    ownerEmail: {$if: '"@" in push.owner', then: '${push.owner}', else: '${push.owner}@noreply.mozilla.org'}
      deadline: '{{#from_now}}1 day{{/from_now}}'
  in:
      expires: '{{#from_now}}365 day{{/from_now}}'
  - taskId: '${as_slugid("decision")}'
    taskGroupId: '${as_slugid("decision")}' # same as tsakId; this is how automation identifies a decision tsak
    schedulerId: 'gecko-level-${repository.level}'

    created: {$fromNow: ''}
    deadline: {$fromNow: '1 day'}
    expires: {$fromNow: '1 year 1 second'} # 1 second so artifacts expire first, despite rounding errors
    metadata:
    metadata:
        owner: mozilla-taskcluster-maintenance@mozilla.com
      owner: "${ownerEmail}"
        source: {{{source}}}
      source: "${repository.url}/raw-file/${push.revision}/.taskcluster.yml"
      name: "Gecko Decision Task"
      name: "Gecko Decision Task"
      description: |
      description: |
          The task that creates all of the other tasks in the task graph
          The task that creates all of the other tasks in the task graph


      workerType: "gecko-decision"
    provisionerId: "aws-provisioner-v1"
    provisionerId: "aws-provisioner-v1"
    workerType: "gecko-decision"


    tags:
    tags:
        createdForUser: {{owner}}
      createdForUser: "${ownerEmail}"


    routes:
    routes:
        - "index.gecko.v2.{{project}}.latest.firefox.decision"
      - "index.gecko.v2.${repository.project}.latest.firefox.decision"
        - "index.gecko.v2.{{project}}.pushlog-id.{{pushlog_id}}.decision"
      - "index.gecko.v2.${repository.project}.pushlog-id.${push.pushlog_id}.decision"
        - "tc-treeherder.v2.{{project}}.{{revision}}.{{pushlog_id}}"
      - "tc-treeherder.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
        - "tc-treeherder-stage.v2.{{project}}.{{revision}}.{{pushlog_id}}"
      - "tc-treeherder-stage.v2.${repository.project}.${push.revision}.${push.pushlog_id}"
        - "notify.email.{{owner}}.on-failed"
      - "notify.email.${ownerEmail}.on-failed"
        - "notify.email.{{owner}}.on-exception"
      - "notify.email.${ownerEmail}.on-exception"

    scopes:
      - 'assume:repo:${repository.url[8:-1]}:*'
      - 'queue:route:notify.email.${ownerEmail}.*'

    dependencies: []
    requires: all-completed

    priority: lowest
    retries: 5


    payload:
    payload:
      env:
      env:
        # checkout-gecko uses these to check out the source; the inputs
        # checkout-gecko uses these to check out the source; the inputs
        # to `mach taskgraph decision` are all on the command line.
        # to `mach taskgraph decision` are all on the command line.
        GECKO_BASE_REPOSITORY: 'https://hg.mozilla.org/mozilla-unified'
        GECKO_BASE_REPOSITORY: 'https://hg.mozilla.org/mozilla-unified'
          GECKO_HEAD_REPOSITORY: '{{{url}}}'
        GECKO_HEAD_REPOSITORY: '${repository.url}'
          GECKO_HEAD_REF: '{{revision}}'
        GECKO_HEAD_REF: '${push.revision}'
          GECKO_HEAD_REV: '{{revision}}'
        GECKO_HEAD_REV: '${push.revision}'
        GECKO_COMMIT_MSG: '${push.comment}'
        HG_STORE_PATH: /home/worker/checkouts/hg-store
        HG_STORE_PATH: /home/worker/checkouts/hg-store


      cache:
      cache:
          level-{{level}}-checkouts: /home/worker/checkouts
        level-${repository.level}-checkouts: /home/worker/checkouts


      features:
      features:
        taskclusterProxy: true
        taskclusterProxy: true
@@ -106,22 +82,22 @@ tasks:
            cd /home/worker/checkouts/gecko &&
            cd /home/worker/checkouts/gecko &&
            ln -s /home/worker/artifacts artifacts &&
            ln -s /home/worker/artifacts artifacts &&
            ./mach --log-no-times taskgraph decision
            ./mach --log-no-times taskgraph decision
              --pushlog-id='{{pushlog_id}}'
            --pushlog-id='${push.pushlog_id}'
              --pushdate='{{pushdate}}'
            --pushdate='${push.pushdate}'
              --project='{{project}}'
            --project='${repository.project}'
              --message={{#shellquote}}{{{comment}}}{{/shellquote}}
            --message="$GECKO_COMMIT_MSG"
              --owner='{{owner}}'
            --owner='${ownerEmail}'
              --level='{{level}}'
            --level='${repository.level}'
              --base-repository='https://hg.mozilla.org/mozilla-central'
            --base-repository="$GECKO_BASE_REPOSITORY"
              --head-repository='{{{url}}}'
            --head-repository="$GECKO_HEAD_REPOSITORY"
              --head-ref='{{revision}}'
            --head-ref="$GECKO_HEAD_REF"
              --head-rev='{{revision}}'
            --head-rev="$GECKO_HEAD_REV"


      artifacts:
      artifacts:
        'public':
        'public':
          type: 'directory'
          type: 'directory'
          path: '/home/worker/artifacts'
          path: '/home/worker/artifacts'
            expires: '{{#from_now}}364 days{{/from_now}}'
          expires: {$fromNow: '1 year'}


    extra:
    extra:
      treeherder:
      treeherder: