in src/vsts/buildAndReleaseTask/task.js [89:127]
var onCacheMiss = function (hash, options) {
runExecCommand(options);
if (options.uploadCacheOnMiss) {
var files = getFileList(options.outputPath, options.outputFiles, options.outputIgnore);
if (!files || files.length == 0) {
console.log("No output files found - skipping cache update");
return;
}
var tarFile = hash + ".tgz";
var tarPath = path.join(options.outputPath, tarFile);
// the tar library doesn't like paths that start with @ - need to add ./ to the start
files = files.map(function (value) { return value.startsWith('@') ? './' + value : value });
console.log("Creating tarball " + tarPath);
var tarOptions = {
sync: true,
file: tarPath,
strict: true,
gzip: true,
portable: true,
noMtime: true,
cwd: options.outputPath
}
tar.create(tarOptions, files);
uploadCache(tarPath, tarFile, options.storageAccount, options.storageContainer, options.storageKey)
.then(function () {
fs.unlinkSync(tarPath);
})
.catch(function (err) {
console.warn("Uploading of cache failed. This may happen when attempting to upload in parallel.")
console.warn(err);
});
}
}