tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

release-promotion-action.rst (8486B)


      1 Release Promotion Action
      2 ========================
      3 
      4 The release promotion action is how Releng triggers `release promotion`_
      5 taskgraphs. The one action covers all release promotion needs: different
      6 *flavors* allow for us to trigger the different :ref:`release promotion phases`
      7 for each product. The input schema and release promotion flavors are defined in
      8 the `release promotion action`_.
      9 
     10 .. _snowman model:
     11 
     12 The snowman model
     13 -----------------
     14 
     15 The `release promotion action`_ allows us to chain multiple taskgraphs (aka graphs, aka task groups) together.
     16 Essentially, we're using `optimization`_ logic to replace task labels in the
     17 current taskgraph with task IDs from the previous taskgraph(s).
     18 
     19 This is the ``snowman`` model. If you request the body of
     20 the snowman and point at the base, we only create the middle section of the snowman.
     21 If you request the body of the snowman and don't point it at the base, we build the
     22 first base and body of the snowman from scratch.
     23 
     24 For example, let's generate a task ``t2`` that depends on ``t1``. Let's call our new taskgraph ``G``::
     25 
     26    G
     27    |
     28    t1
     29    |
     30    t2
     31 
     32 Task ``t2`` will wait on task ``t1`` to finish, and downloads some artifacts from task ``t1``.
     33 
     34 Now let's specify task group ``G1`` and ``G2`` as previous task group IDs. If task ``t1`` is in one of them, ``t2`` will depend on that task, rather than spawning a new ``t1`` in task group ``G``::
     35 
     36    G1        G2        G
     37    |         |         |
     38    t1        t1        |
     39                \______ |
     40                       \|
     41                        t2
     42 
     43    or
     44 
     45    G1        G2        G
     46    |         |         |
     47    t1        t0        |
     48      \________________ |
     49                       \|
     50                        t2
     51 
     52 For a more real-world example::
     53 
     54         G
     55         |
     56       build
     57         |
     58      signing
     59         |
     60    l10n-repack
     61         |
     62    l10n-signing
     63 
     64 If we point the ``promote`` task group G at the on-push build task group ``G1``, the l10n-repack job will depend on the previously finished build and build-signing tasks::
     65 
     66         G1            G
     67         |             |
     68       build           |
     69         |             |
     70      signing          |
     71             \_________|
     72                       |
     73                  l10n-repack
     74                       |
     75                  l10n-signing
     76 
     77 We can also explicitly exclude certain tasks from being optimized out.
     78 We currently do this by specifying ``rebuild_kinds`` in the action; these
     79 are `kinds`_ that we want to explicitly rebuild in the current task group,
     80 even if they existed in previous task groups. We also allow for specifying a list of
     81 ``do_not_optimize`` labels, which would be more verbose and specific than
     82 specifying kinds to rebuild.
     83 
     84 Release promotion action mechanics
     85 ----------------------------------
     86 
     87 There are a number of inputs defined in the `release promotion action`_. Among these are the ``previous_graph_ids``, which is an ordered list of taskGroupIds of the task groups that we want to build our task group, off of. In the :ref:`snowman model`, these define the already-built portions of the snowman.
     88 
     89 The action downloads the ``parameters.yml`` from the initial ``previous_graph_id``, which matches the decision- or action- taskId. (See :ref:`taskid vs taskgroupid`.) This is most likely the decision task of the revision to promote, which is generally the same revision the release promotion action is run against.
     90 
     91 .. note:: If the parameters have been changed since the build happened, *and* we explicitly want the new parameters for the release promotion action task, the first ``previous_graph_id`` should be the new revision's decision task. Then the build and other previous action task group IDs can follow, so we're still replacing the task labels with the task IDs from the original revision.
     92 
     93 The action then downloads the various ``label-to-taskid.json`` artifacts from each previous task group, and builds an ``existing_tasks`` parameter of which labels to replace with which task IDs. Each successive update to this dictionary overwrites existing keys with new task IDs, so the rightmost task group with a given label takes precedence. Any labels that match the ``do_not_optimize`` list or that belong to tasks in the ``rebuild_kinds`` list are excluded from the ``existing_tasks`` parameter.
     94 
     95 Once all that happens, and we've gotten our configuration from the original parameters and our action config and inputs, we run the decision task function with our custom parameters. The `optimization`_ phase replaces any ``existing_tasks`` with the task IDs we've built from the previous task groups.
     96 
     97 Release Promotion Flavors
     98 -------------------------
     99 
    100 For the most part, release promotion flavors match the pattern ``phase_product``,
    101 e.g. ``promote_firefox``, ``push_devedition``, or ``ship_firefox``.
    102 
    103 We've added ``_rc`` suffix flavors, to deal with special RC behavior around rolling out updates using a different rate or channel.
    104 
    105 We are planning on adding ``_partners`` suffix flavors, to allow for creating partner repacks off-cycle.
    106 
    107 The various flavors are defined in the `release promotion action`_.
    108 
    109 Triggering the release promotion action via Treeherder
    110 ------------------------------------------------------
    111 
    112 Currently, we're able to trigger this action via `Treeherder`_; we sometimes use this method for testing purposes. This is powerful, because we can modify the inputs directly, but is less production friendly, because it requires us to enter the inputs manually. At some point we may disable the ability to trigger the action via Treeherder.
    113 
    114 This requires being signed in with the right scopes. On `Release Promotion Projects`_, there's a dropdown in the top right of a given revision. Choose ``Custom Push Action``, then ``Release Promotion``. The inputs are specifiable as raw yaml on the left hand column.
    115 
    116 Release promotion action taskId and taskGroupId
    117 -----------------------------------------------
    118 
    119 The ``taskGroupId`` of a release promotion action task will be the same as the ``taskId`` of the decision task.
    120 
    121 The ``taskGroupId`` of a release promotion *task group* will be the same as the ``taskId`` of the release promotion action task.
    122 
    123 So:
    124 
    125 * for a given push, the decision taskId ``D`` will create the taskGroupId ``D``
    126 * we create a release promotion action task with the taskId ``A``. The ``A`` task will be part of the ``D`` task group, but will spawn a task group with the taskGroupId ``A``.
    127 
    128 Another way of looking at it:
    129 
    130 * If you're looking at a task ``t1`` in the action taskGroup, ``t1``'s taskGroupId is the action task's taskId. (In the above example, this would be ``A``.)
    131 * Then if you look at the action task's taskGroupId, that's the original decision task's taskId. (In the above example, this would be ``D``.)
    132 
    133 Testing and developing the release promotion action
    134 ---------------------------------------------------
    135 
    136 To test the release promotion, action, we can use ``./mach taskgraph test-action-callback`` to debug.
    137 
    138 The full command for a ``promote_firefox`` test might look like::
    139 
    140    ./mach taskgraph test-action-callback \
    141        --task-group-id LR-xH1ViTTi2jrI-N1Mf2A \
    142        --input /src/gecko/params/promote_firefox.yml \
    143        -p /src/gecko/params/maple-promote-firefox.yml \
    144        release_promotion_action > ../promote.json
    145 
    146 The input file (in the above example, that would be ``/src/gecko/params/promote_firefox.yml``), contains the action inputs. The input schema is defined in the `release promotion action`_. Previous example inputs are embedded in previous promotion task group action task definitions (``task.extra.action.input``).
    147 
    148 The ``parameters.yml`` file is downloadable from a previous decision or action task.
    149 
    150 .. _release promotion: release-promotion.html
    151 .. _optimization: optimization.html
    152 .. _kinds: kinds.html
    153 .. _release promotion action: https://searchfox.org/mozilla-central/source/taskcluster/gecko_taskgraph/actions/release_promotion.py
    154 .. _Treeherder: https://treeherder.mozilla.org
    155 .. _Release Promotion Projects: https://searchfox.org/mozilla-central/search?q=RELEASE_PROMOTION_PROJECTS&path=taskcluster/gecko_taskgraph/util/attributes.py
    156 .. _releasewarrior docs: https://github.com/mozilla-releng/releasewarrior-2.0/blob/master/docs/release-promotion/desktop/howto.md#how
    157 .. _trigger_action.py: https://searchfox.org/build-central/source/tools/buildfarm/release/trigger_action.py#118
    158 .. _.taskcluster.yml: https://searchfox.org/mozilla-central/source/.taskcluster.yml