@catladder/pipeline
Version:
Panter workflow for cloud CI/CD and DevOps
64 lines (63 loc) • 2.45 kB
JavaScript
;
var __assign = this && this.__assign || function () {
__assign = Object.assign || function (t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var __read = this && this.__read || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o),
r,
ar = [],
e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
} catch (error) {
e = {
error: error
};
} finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
} finally {
if (e) throw e.error;
}
}
return ar;
};
var __spreadArray = this && this.__spreadArray || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getAllCacheConfigsFromConfig = void 0;
var index_1 = require("../../utils/index");
var transformLegacyJobCache_1 = require("./transformLegacyJobCache");
var getAllCacheConfigsFromConfig = function (context, configWithCache) {
return __spreadArray(__spreadArray(__spreadArray([], __read("jobCache" in configWithCache ? (0, transformLegacyJobCache_1.transformLegacyJobCache)(configWithCache.jobCache) : []), false), __read((0, index_1.ensureArray)(configWithCache.cache)), false), __read(context.type === "workspace" ?
// also add cache configs of the components of that workspace
// FIXNME: this only works currently for the build config
// we would probably need to introduce a path to the right config property (build-->test or so)
context.components.flatMap(function (componentContext) {
var _a;
return componentContext.build.type !== "disabled" ? (_a = (0, index_1.ensureArray)(componentContext.build.config.cache).map(function (c) {
return __assign(__assign({}, c), {
baseDir: componentContext.build.dir
});
})) !== null && _a !== void 0 ? _a : [] : [];
}) : []), false);
};
exports.getAllCacheConfigsFromConfig = getAllCacheConfigsFromConfig;