gecko-dev/taskcluster/ci
Gregory Szorc 2f189264b9 Bug 1460777 - Taskgraph tasks for retrieving remote content; r=dustin,glandium
Currently, many tasks fetch content from the Internets. A problem with
that is fetching from the Internets is unreliable: servers may have
outages or be slow; content may disappear or change out from under us.

The unreliability of 3rd party services poses a risk to Firefox CI.
If services aren't available, we could potentially not run some CI tasks.
In the worst case, we might not be able to release Firefox. That would
be bad. In fact, as I write this, gmplib.org has been unavailable for
~24 hours and Firefox CI is unable to retrieve the GMP source code.
As a result, building GCC toolchains is failing.

A solution to this is to make tasks more hermetic by depending on
fewer network services (which by definition aren't reliable over time
and therefore introduce instability).

This commit attempts to mitigate some external service dependencies
by introducing the *fetch* task kind.

The primary goal of the *fetch* kind is to obtain remote content and
re-expose it as a task artifact. By making external content available
as a cached task artifact, we allow dependent tasks to consume this
content without touching the service originally providing that
content, thus eliminating a run-time dependency and making tasks more
hermetic and reproducible over time.

We introduce a single "fetch-url" "using" flavor to define tasks that
fetch single URLs and then re-expose that URL as an artifact. Powering
this is a new, minimal "fetch" Docker image that contains a
"fetch-content" Python script that does the work for us.

We have added tasks to fetch source archives used to build the GCC
toolchains.

Fetching remote content and re-exposing it as an artifact is not
very useful by itself: the value is in having tasks use those
artifacts.

We introduce a taskgraph transform that allows tasks to define an
array of "fetches." Each entry corresponds to the name of a "fetch"
task kind. When present, the corresponding "fetch" task is added as a
dependency. And the task ID and artifact path from that "fetch" task
is added to the MOZ_FETCHES environment variable of the task depending
on it. Our "fetch-content" script has a "task-artifacts"
sub-command that tasks can execute to perform retrieval of all
artifacts listed in MOZ_FETCHES.

To prove all of this works, the code for fetching dependencies when
building GCC toolchains has been updated to use `fetch-content`. The
now-unused legacy code has been deleted.

This commit improves the reliability and efficiency of GCC toolchain
tasks. Dependencies now all come from task artifacts and should always
be available in the common case. In addition, `fetch-content` downloads
and extracts files concurrently. This makes it faster than the serial
application which we were previously using.

There are some things I don't like about this commit.

First, a new Docker image and Python script for downloading URLs feels
a bit heavyweight. The Docker image is definitely overkill as things
stand. I can eventually justify it because I want to implement support
for fetching and repackaging VCS repositories and for caching Debian
packages. These will require more packages than what I'm comfortable
installing on the base Debian image, therefore justifying a dedicated
image.

The `fetch-content static-url` sub-command could definitely be
implemented as a shell script. But Python is readily available and
is more pleasant to maintain than shell, so I wrote it in Python.

`fetch-content task-artifacts` is more advanced and writing it in
Python is more justified, IMO. FWIW, the script is Python 3 only,
which conveniently gives us access to `concurrent.futures`, which
facilitates concurrent download.

`fetch-content` also duplicates functionality found elsewhere.
generic-worker's task payload supports a "mounts" feature which
facilitates downloading remote content, including from a task
artifact. However, this feature doesn't exist on docker-worker.
So we have to implement downloading inside the task rather than
at the worker level. I concede that if all workers had generic-worker's
"mounts" feature and supported concurrent download, `fetch-content`
wouldn't need to exist.

`fetch-content` also duplicates functionality of
`mach artifact toolchain`. I probably could have used
`mach artifact toolchain` instead of writing
`fetch-content task-artifacts`. However, I didn't want to introduce
the requirement of a VCS checkout. `mach artifact toolchain` has its
origins in providing a feature to the build system. And "fetching
artifacts from tasks" is a more generic feature than that. I think
it should be implemented as a generic feature and not something that is
"toolchain" specific.

I think the best place for a generic "fetch content" feature is in
the worker, where content can be defined in the task payload. But as
explained above, that feature isn't universally available. The next
best place is probably run-task. run-task already performs generic,
very-early task preparation steps, such as performing a VCS checkout.
I would like to fold `fetch-content` into run-task and make it all
driven by environment variables. But run-task is currently Python 2
and achieving concurrency would involve a bit of programming (or
adding package dependencies). I may very well port run-task to Python
3 and then fold fetch-content into it. Or maybe we leave
`fetch-content` as a standalone script.

MozReview-Commit-ID: AGuTcwNcNJR

--HG--
extra : rebase_source : 4918b8c3bac53d63665006802054038bfbca0314
2018-06-06 09:37:38 -07:00
..
addon Bug 1455570 - Build and publish TPS add-on; r=dustin,ted 2018-04-23 14:32:05 +01:00
artifact-build Bug 1465659 - Move perfherder extra options from mozharness to taskcluster. r=nalexander 2018-05-31 13:02:38 +09:00
balrog Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
beetmover Backed out changeset a63caceffcee (bug 1403548) for liniting failure on builds/worker/checkouts/gecko/taskcluster/taskgraph/transforms/beetmover_repackage.py. CLOSED TREE 2018-04-26 00:07:21 +03:00
beetmover-checksums Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
beetmover-l10n bug 1423081 - add desktop release beetmover support. r=callek 2017-12-05 19:18:43 -08:00
beetmover-repackage Backed out changeset a63caceffcee (bug 1403548) for liniting failure on builds/worker/checkouts/gecko/taskcluster/taskgraph/transforms/beetmover_repackage.py. CLOSED TREE 2018-04-26 00:07:21 +03:00
beetmover-source Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
build Bug 1457482 Add an LTO Build Target r=glandium 2018-05-30 12:27:25 -05:00
build-signing Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
checksums-signing Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
diffoscope Bug 1427312 - Add mechanism to create tasks to compare Firefox builds. r=dustin 2017-12-28 12:14:34 +09:00
docker-image Bug 1460777 - Taskgraph tasks for retrieving remote content; r=dustin,glandium 2018-06-06 09:37:38 -07:00
fetch Bug 1460777 - Taskgraph tasks for retrieving remote content; r=dustin,glandium 2018-06-06 09:37:38 -07:00
google-play-strings Bug 1459181 - Fetch version-specific "whatsnew" on mozilla-release only r=sfraser 2018-05-04 15:56:19 +02:00
hazard Bug 1465659 - Move perfherder extra options from mozharness to taskcluster. r=nalexander 2018-05-31 13:02:38 +09:00
l10n Bug 1466222 - Do on-change for mobile_l10n.py too. r=me 2018-06-05 08:58:29 -04:00
nightly-l10n Bug 1466222 - Don't define submit-to-balrog action nor inherit from BalrogMixin, balrog-props.json is now dead. r=catlee 2018-06-01 23:29:25 -04:00
nightly-l10n-signing Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
packages Bug 1466746 - Debian packages for python-zstandard; r=glandium 2018-06-04 23:10:59 -07:00
partials Backed out changeset a63caceffcee (bug 1403548) for liniting failure on builds/worker/checkouts/gecko/taskcluster/taskgraph/transforms/beetmover_repackage.py. CLOSED TREE 2018-04-26 00:07:21 +03:00
partials-signing bug 1423081 - add release partials support. r=callek 2017-12-05 19:08:06 -08:00
post-balrog-dummy bug 990689: don't wait for all platforms to finish before running update verify. r=aki 2018-03-27 11:01:54 -04:00
post-beetmover-checksums-dummy Bug 1446815 - cleanup in naming beetmover source checksums for consistency. r=tomprince 2018-05-03 19:51:20 +03:00
post-beetmover-dummy Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
post-langpack-dummy Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
push-apk Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-balrog-scheduling Bug 1456234: [release] Use -release platforms for top-level balrog tasks; r=aki 2018-05-09 07:26:24 -07:00
release-balrog-submit-toplevel Bug 1456234: [release] Use -release platforms for top-level balrog tasks; r=aki 2018-05-09 07:26:24 -07:00
release-beetmover-push-to-release Bug 1456234: [release] Rename beetmover-cdns to release-beetmover-push-to-release; r=aki 2018-05-04 09:37:46 -06:00
release-beetmover-signed-langpacks Bug 1453033 - Do not define shipping-product explicitly, let it be inhereted. r=aki 2018-05-02 13:59:58 -04:00
release-beetmover-source-checksums Bug 1446815 - cleanup in naming beetmover source checksums for consistency. r=tomprince 2018-05-03 19:51:20 +03:00
release-binary-transparency Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-bouncer-aliases Bug 1456234: [release-promotion] Show bouncer worker tasks on treeherder; r=aki 2018-06-01 04:27:16 +00:00
release-bouncer-check 487c3 Bug 1456234: [release] Use -release platforms for bouncer tasks; r=aki 2018-05-15 13:09:12 -06:00
release-bouncer-sub Bug 1456234: [release-promotion] Show bouncer worker tasks on treeherder; r=aki 2018-06-01 04:27:16 +00:00
release-eme-free-repack bug 1457034 - generate release_partner_config in release_promotion r=nthomas 2018-04-25 15:16:49 -07:00
release-eme-free-repack-beetmover Bug 1457010 - gpg sign partner repacks, r=aki 2018-04-26 10:52:03 +12:00
release-eme-free-repack-repackage Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-eme-free-repack-repackage-signing Bug 1457010 - gpg sign partner repacks, r=aki 2018-04-26 10:52:03 +12:00
release-eme-free-repack-signing bug 1456620 - chunk mac partner signing. r=nthomas 2018-04-23 17:12:43 -07:00
release-final-verify Bug 1456234: [release] Use release platforms for final-verify; r=aki 2018-05-11 14:38:45 -07:00
release-generate-checksums Bug 1456234: [release] Use release platforms in generate-checksums tasks; r=aki 2018-04-20 15:25:18 -06:00
release-generate-checksums-beetmover Bug 1453273,1453255,1453253 - add esr60 fixes in automation. r=aki CLOSED TREE 2018-04-26 01:29:09 +03:00
release-generate-checksums-signing Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-mark-as-shipped Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-notify-promote No bug: [release-promotion] Make promote notification depend on generating checksums; r=mtabara 2018-05-31 23:57:53 +00:00
release-notify-push Bug 1461784: [release] Fix release notification on try; r=aki 2018-05-14 19:22:45 -06:00
release-notify-ship Bug 1461784: [release] Fix release notification on try; r=aki 2018-05-14 19:22:45 -06:00
release-partner-repack bug 1457034 - generate release_partner_config in release_promotion r=nthomas 2018-04-25 15:16:49 -07:00
release-partner-repack-beetmover Bug 1457010 - gpg sign partner repacks, r=aki 2018-04-26 10:52:03 +12:00
release-partner-repack-chunking-dummy Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-partner-repack-repackage Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-partner-repack-repackage-signing Bug 1457010 - gpg sign partner repacks, r=aki 2018-04-26 10:52:03 +12:00
release-partner-repack-signing bug 1456620 - chunk mac partner signing. r=nthomas 2018-04-23 17:12:43 -07:00
release-secondary-balrog-scheduling Bug 1458854 Disable release_eta for rc on beta channel r=bhearsum 2018-05-09 09:40:55 +01:00
release-secondary-balrog-submit-toplevel Bug 1421062: [release] Update secondary balrog tasks to get scopes based on project; r=aki 2018-05-04 12:33:58 -06:00
release-secondary-final-verify Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-secondary-notify-ship Bug 1461784: [release] Fix release notification on try; r=aki 2018-05-14 19:22:45 -06:00
release-secondary-update-verify Bug 1456234: [release] Change update-verify platforms to match the corresponding build platforms; r=aki 2018-05-05 14:38:23 -06:00
release-secondary-update-verify-config Bug 1464523: [release] Pass branch prefix to secondary update-verify config generation; r=me CLOSED TREE 2018-05-29 10:01:03 -06:00
release-sign-and-push-langpacks Merge mozilla-central to inbound. a=merge CLOSED TREE 2018-05-04 21:07:31 +03:00
release-snap-push Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-snap-repackage Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
release-source Bug 1456234: Fix yamllint errors; rs=bustage-fix CLOSED TREE 2018-05-02 11:31:40 -06:00
release-source-checksums-signing Bug 1446815 - add source shas in release checksums. r=aki a=release 2018-04-30 19:05:35 +03:00
release-source-signing Bug 1456234: [release] Use release platforms for source; r=aki 2018-04-26 21:24:58 -06:00
release-update-verify Bug 1462120 - Update verify fixes for ESR60 branch, r=bhearsum DONTBUILD 2018-05-30 11:29:09 +12:00
release-update-verify-config Bug 1464523: [release] Simplify resolve_keyed_by logic in update-verify-config; r=bhearsum 2018-06-04 17:49:23 +00:00
release-version-bump Bug 1464530: [release] Add -dev workertype for version-bump; r=Callek 2018-05-22 16:25:03 -06:00
repackage Backed out changeset a63caceffcee (bug 1403548) for liniting failure on builds/worker/checkouts/gecko/taskcluster/taskgraph/transforms/beetmover_repackage.py. CLOSED TREE 2018-04-26 00:07:21 +03:00
repackage-l10n Bug 1459116 - Disable job failed/exception notifications, r=rail 2018-05-04 17:24:49 +12:00
repackage-signing Bug 1286092 - Do repackage-signing on-change for on-change l10n. r=aki 2018-05-22 09:42:19 -04:00
repo-update Bug 1436369 Run blocklist updates on mozilla-beta r=jlorenzo 2018-06-01 14:13:44 +01:00
searchfox Bug 1466689 - Perform macOS builds on gecko-{L}-b-linux worker type; r=dustin,mshal 2018-06-04 14:00:20 -07:00
source-test Bug 1466660 - Remove use-artifact directory from run-task workers after task has finished r=jmaher 2018-06-04 16:36:28 -04:00
spidermonkey Bug 1465659 - Move perfherder extra options from mozharness to taskcluster. r=nalexander 2018-05-31 13:02:38 +09:00
static-analysis Bug 1465659 - Move perfherder extra options from mozharness to taskcluster. r=nalexander 2018-05-31 13:02:38 +09:00
static-analysis-autotest Bug 1465659 - Move perfherder extra options from mozharness to taskcluster. r=nalexander 2018-05-31 13:02:38 +09:00
test Bug 1411358 - Increase Android/debug xpcshell max-run-time; r=me,a=test-only 2018-06-01 13:11:21 -06:00
toolchain Bug 1460777 - Taskgraph tasks for retrieving remote content; r=dustin,glandium 2018-06-06 09:37:38 -07:00
upload-generated-sources Bug 1446241: Set run-on-projects for upload-generated-sources and upload-symbols r=aki 2018-03-19 14:15:52 -04:00
upload-symbols bug 1460243 - don't try to upload symbols for asan-reporter nightlies. r=Callek,tomprince 2018-05-09 10:54:04 -04:00
valgrind Bug 1465659 - Move perfherder extra options from mozharness to taskcluster. r=nalexander 2018-05-31 13:02:38 +09:00
config.yml Merge mozilla inbound to central a=merge 2018-05-31 01:05:10 +03:00