Skip to content
This repository was archived by the owner on Jan 5, 2019. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/artifacts.js
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,13 @@ var replyWithArtifact = async function(taskId, runId, name, req, res) {
var bucket = artifact.details.bucket;

if (bucket === this.publicBucket.bucket) {
let skipCacheHeader = (req.headers['x-taskcluster-skip-cache'] || '').toLowerCase();
if (!region) {
debug('artifact from CDN for ip: %s', req.headers['x-forwarded-for']);
url = this.publicBucket.createGetUrl(prefix);
} else if (skipCacheHeader === 'true' || skipCacheHeader === '1') {
// Skip cache and go to cloud-front
url = this.publicBucket.createGetUrl(prefix);
} else if (this.artifactRegion === region) {
url = this.publicBucket.createGetUrl(prefix, true);
} else {
Expand Down Expand Up @@ -446,6 +450,13 @@ api.declare({
'stored externally. Either way, the response may not be JSON. So API',
'client users might want to generate a signed URL for this end-point and',
'use that URL with a normal HTTP client.',
'',
'**Caching**, artifacts may be cached in data centers closer to the',
'workers in-order to reduce bandwidth costs. This can lead to longer',
'response times. Caching can be skipped by setting the header',
'`x-taskcluster-skip-cache: true`, this should only be used for resources',
'where request volume is known to be low, and caching not useful.',
'(This feature may be disabled in the future, use is sparingly!)',
].join('\n'),
}, async function(req, res) {
var taskId = req.params.taskId;
Expand Down