gecko-dev/taskcluster/docs
Gregory Szorc 02d1cf283b Bug 1391789 - Improve cache coherence via run-task integration; r=dustin
Today, cache names are mostly static and are brittle as a result.

In theory, when a backwards incompatible change is performed on
something that touches a cache, the cache name needs to be changed
to ensure tasks running the old code don't see cached data from the
new task. (Alternatively, all code is forward compatible, but that is
hard to implement in practice.)

For many things, the process works as planned. However, not everyone
knows that cache names need changed. And, it isn't always obvious
that some things require fresh caches. When mistakes are made, tasks
break intermittently due to cache wonkiness.

One area where we get into trouble is with UID and GID mismatch.
Task A will use a Docker image where our standard "worker" user/group
is UID/GID 1000:1000. Then Task B will use UID/GID 500:500. (This is
common when mixing Debian and RedHel based distros.) If they use the
same cache, then Task B needs to chown/chmod all files in the cache
or there could be a permissions problem. This is exactly why
run-task recursively chowns certain paths before dropping root
privileges.

Permissions setting in run-task solves permissions problems. But
it doesn't solve content incompatibility problems. For that, you
need to change cache names, not use caches, or blow away content
when incompatibilities are detected.

This commit starts the process of adding a little bit more coherence
to our caching story.

There are two main features in this commit:

1) Cache names tied to run-task content
2) Cache validation in run-task

Taskgraph now detects when a task is using caches with run-task. When
caches and run-task are both being used, the cache name is adjusted to
contain a hash of run-task's content. When run-task changes, the cache
name changes. So, changing run-task ensures that all caches from that point
forward are "clean." This frees run-task and any functionality related
to run-task (such as maintaining version control checkouts) from
having to maintain backwards or forwards compatibility with any other
version of run-task. This does mean that any changes to run-task
effectively wipe out caches. But changes to run-task tend to be
seldom, so this should be acceptable.

The second part of this change is code in run-task to record per-cache
properties and validate whether a populated cache is appropriate for
use. To enable this, taskgraph passes a list of cache paths via an
environment variable. For each cache path, run-task looks for a
well-defined file containing a list of "requirements." Right now,
that list is simply a version string. But other features will be
worked into it. If the cache is empty, we simply write out a new
requirements file and are done. If the file exists, we compare
requirements and fail fast if there is a mismatch. If the cache
has content but not this special file, then we abort (because this
should never happen).

The "requirements" validation isn't very useful now because the only
entry comes from run-task's source code and modifying run-task will
change the hash and cause a new cache to be used. The implementation
at this point is more demonstrating the concept than doing anything
terribly useful with it.

MozReview-Commit-ID: HtpXIc7OD1k

--HG--
extra : rebase_source : 2424696b1fde59f20152617a6ebb2afe14b94678
2017-08-18 14:07:03 -07:00
..
actions.rst Bug 1390938: only use one top-level heading; r=bstack 2017-08-16 16:26:58 +00:00
attributes.rst Bug 1386149 - Allow build jobs to use toolchain aliases instead of toolchain job names. r=dustin 2017-07-27 18:02:38 +09:00
caches.rst Bug 1391789 - Improve cache coherence via run-task integration; r=dustin 2017-08-18 14:07:03 -07:00
cron.rst Bug 1380391 - Index decision tasks under pushlog_id r=dustin 2017-07-12 10:56:02 -07:00
docker-images.rst Backed out changeset fe7303de56be (bug 1302763) for failing webdriver tests on Linux x64 debug (geckodriver.manifest fetch failed). r=backout 2016-12-19 21:15:07 +01:00
how-tos.rst Bug 1387135 - Add ability to apply templates to task definitions via try_task_config.json, r=dustin 2017-08-15 11:36:29 -04:00
index.rst Bug 1349662: remove leftover document link; DONTBUILD r=jonasfj 2017-03-27 18:54:54 +00:00
kinds.rst bug 1259832 - add a post-build task to upload generated source files. r=dustin 2017-08-09 14:32:05 -04:00
loading.rst Bug 1333255: always transform tasks; r=jonasfj 2017-03-09 16:40:33 -05:00
optimization.rst Bug 1359942: rename optimization to skip-unless-changed; r=glandium 2017-05-23 10:22:53 -04:00
parameters.rst Bug 1387135 - Add ability to apply templates to task definitions via try_task_config.json, r=dustin 2017-08-15 11:36:29 -04:00
reference.rst Bug 1307571: move reference docs to a sub-TOC; r=mshal 2016-10-04 19:59:05 +00:00
taskgraph.rst Bug 1387044 Update taskgraph how-to with mention of 'gron' r=dustin DONTBUILD 2017-08-03 14:30:59 +01:00
transforms.rst Bug 1325701 - test transform should produce a job description, not a task description; r=dustin 2017-01-18 16:55:53 +05:30
yaml-templates.rst Bug 1307571: dissuade use of templates; r=Callek 2016-10-04 21:05:43 +00:00