hg-push-template.yml
author Aki Sasaki <asasaki@mozilla.com>
Tue, 22 Feb 2022 21:19:00 +0000
changeset 1283 ef4fae54de4063ab072aa6c203d72de036817641
parent 1103 55358db212bbbe2c612006c5a6c2ecf718184eab
child 1353 d3ad97ca8b1066a66de31d71cd93516581285882
permissions -rw-r--r--
no bug - RELENG-798 - grant glean access to project/gecko/mac-sdk/* r=releng-reviewers,gbrown Differential Revision: https://phabricator.services.mozilla.com/D139427

# This is the template for the task definition for hg push hooks.  Its job is
# to run a decision task for the given revision of the given repository.
#
# This is rendered with JSON-e to create a JSON-e task template in a hook,
# meaning that the content of this file is rendered *twice* with JSON-e.  The
# context values for the first rendering are;
#
#  - level -- SCM level
#  - trust_domain -- project's trust domain
#  - hookGroupId / hookId -- hook identifiers
#  - project_repo -- repository URL
#  - project_repo_path -- path portion of the repository URL
#  - alias -- project alias
#
# Uses of `$${..}` and `$$..: ..` are intended to occur in the second rendering.
# The context for the second rendering is that provided by the hooks service in response
# to a Pulse message from exchange/hgpushes/v2 or a triggerHook call with the same payload

---
provisionerId: infra
workerType: build-decision
schedulerId: ${trust_domain}-level-${level}

# The "$fromNow" options here are escaped so that they are processed by the hooks service's
# JSON-e rendering when the hook is fired.
deadline: {$$fromNow: '30 minutes'}
expires: {$$fromNow: '3 days'}
scopes:
    - assume:${project_role_prefix}:branch:*
routes:
    - index.hg-push.v1.${alias}.revision.$${payload.payload.data.heads[0]}
    - index.hg-push.v1.${alias}.pushlog-id.$${payload.payload.data.pushlog_pushes[0].pushid}
payload:
    # built by pushes to the ci-configuration repository
    image:
        mozillareleases/build-decision:c8c65816c6f80d7f6466a8561549a5d9bc21db7f@sha256:97b21a2cf55f323127c1ec3f7d1a73a672efa5bfc0fd2aa11f6b348b6aac7d67
    env:
       # pass along the hook payload, which is the Pulse message from hg (v2)
       # https://mozilla-version-control-tools.readthedocs.io/en/latest/hgmo/notifications.html#pulse-notifications
       PULSE_MESSAGE: {$$json: {$$eval: 'payload'}}
    command:
        $flatten:
            - "hg-push"
            # hard-coded values that can't be changed by the hook payload
            - "--repo-url"
            - "${project_repo}"
            - "--project"
            - "${alias}"
            - "--level"
            - "${level}"
            - "--trust-domain"
            - "${trust_domain}"
            - "--repository-type"
            - "hg"
            - $if: 'taskcluster_yml_repo'
              then:
                  - "--taskcluster-yml-repo"
                  - "${taskcluster_yml_repo}"
    features:
        taskclusterProxy: true

    # If this task does not succeed immediately, something is probably wrong.  We want to avoid a storm of
    # decision tasks when that problem is resolved, so we are conservative with the time it can possibly retry
    maxRunTime: 600
metadata:
    $$let:
        description:
            $$if: 'firedBy == "triggerHook"'
            then: 'Fired by triggerHook call from $${clientId}'
            else: 'Fired by $${firedBy}'
    in:
        owner: 'mozilla-taskcluster-maintenance@mozilla.com'
        source: https://firefox-ci-tc.services.mozilla.com/hooks/${hookGroupId}/${hookId}
        description: "$${description}"
        name: On-Push task for ${project_repo}
priority: 'highest'
retries: 5
tags: {}
extra: {}