Closed Bug 1495732 Opened 6 years ago Closed 5 years ago

Feature request: inline source for mounts?

Categories

(Taskcluster :: Workers, enhancement)

enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: SimonSapin, Assigned: mraethel)

References

Details

# Background

The Servo repository contains a copy of web-platform-tests which has many files, and creating many files on Windows is slow. This made "git checkout" take about a minute, even though (for now) we’re not running those tests on Windows and don’t need them to build compile.

Using git’s "sparse checkouts" [1] fix this, but they involve creating a configuration file in a very specific format: Unix newlines, UTF-8 (or ASCII), no BOM. Creating this in a batch script turns out to be surprisingly difficult. Environment variables from the task payload’s `env` key are truncated at the first newline, because they are made available to the task by generating a `set NAME=VALUE` batch script. Escaping newlines in a batch variable requires an jumping through an number of hoops [2].

I ended up doing base64-encoding in the decision task, and (ab)using the `certutil` tool for base64-decoding [3].

generic-worker has the ability to "mount" arbitrary files into the task’s directory, but the file needs to be available at an HTTP URL or as a task artifact.

[1] https://git-scm.com/docs/git-read-tree#_sparse_checkout
[2] https://stackoverflow.com/a/5642300/1162888
[3] https://stackoverflow.com/a/16946681/1162888


# Proposal

For at least single-file mounts, add two options for the `content` key in addition to URL Content and Artifact Content:

* Text content: object of { "text": "<string>" }, the UTF-8 encoding of the string is written to the file
* Base64 content: object of { "base64": "<string>" } the base64 decoding of the string is written to the file
By writing this I realize that my decision task could produce and artifact, which could be used as a mount content. Still, for very short files inline content would be nicer.

To avoid making task definitions too big there could be a size limit on inline mount content (a few kilobytes?) with a suggestion to use an artifact for larger files.
See Also: → 1495760
Assignee: nobody → mraethel
Max is taking a look at this in https://github.com/taskcluster/generic-worker/pull/129.

Many thanks Max!
Severity: normal → enhancement

Hi Simon,

This has been released in generic-worker 11.1.0. Please note there is also a generic-worker 12.0.0 now too, if you are looking to upgrade.

Let us know if you find any issues with the feature.

Many thanks!
Pete

Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(simon.sapin)
Resolution: --- → FIXED

Thanks! I’ll try this next time we’re touching the Windows AMI.

Flags: needinfo?(simon.sapin)
Component: Generic-Worker → Workers

It looks like this is not yet documented on https://docs.taskcluster.net/docs/reference/workers/generic-worker/docs/payload. What source is this page generated from?

Flags: needinfo?(pmoore)

(In reply to Simon Sapin (:SimonSapin) from comment #6)

It looks like this is not yet documented on https://docs.taskcluster.net/docs/reference/workers/generic-worker/docs/payload. What source is this page generated from?

Created bug 1531491 to track this. Thanks for raising!

Flags: needinfo?(pmoore)
You need to log in before you can comment on or make changes to this bug.