mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 06:00:06 +02:00
feat(portal-api): properly expose branches
This commit is contained in:
parent
fdb24ebc13
commit
4d8f6a1d4f
@ -1455,13 +1455,15 @@ class Data extends EventEmitter {
|
|||||||
|
|
||||||
console.log(`-> Service ${Util.inspect(query)} found ${Util.inspect(service)}`);
|
console.log(`-> Service ${Util.inspect(query)} found ${Util.inspect(service)}`);
|
||||||
|
|
||||||
|
const branches = service.branches.map((branch) => {
|
||||||
|
return Object.assign({}, branch, {
|
||||||
|
instances: this._instancesFilter(branch.instances)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
return cb(null, Transform.fromService({
|
return cb(null, Transform.fromService({
|
||||||
service,
|
service,
|
||||||
branches: service.branches.map((service) => {
|
branches,
|
||||||
return Object.assign({}, service, {
|
|
||||||
instances: this._instancesFilter(service.instances)
|
|
||||||
});
|
|
||||||
}),
|
|
||||||
instances: this._instancesFilter(service.instance_ids)
|
instances: this._instancesFilter(service.instance_ids)
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
@ -1517,7 +1519,17 @@ class Data extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return cb(null, services.map((service) => {
|
return cb(null, services.map((service) => {
|
||||||
return Transform.fromService({ service, instances: this._instancesFilter(service.instance_ids) });
|
const branches = service.branches.map((branch) => {
|
||||||
|
return Object.assign({}, branch, {
|
||||||
|
instances: this._instancesFilter(branch.instances)
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return Transform.fromService({
|
||||||
|
service,
|
||||||
|
branches,
|
||||||
|
instances: this._instancesFilter(service.instance_ids)
|
||||||
|
});
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ exports.toDeploymentGroup = function (clientDeploymentGroup) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
exports.fromService = function ({ service, instances, packages }) {
|
exports.fromService = function ({ service, instances, branches, packages }) {
|
||||||
return {
|
return {
|
||||||
id: service.id,
|
id: service.id,
|
||||||
hash: service.version_hash,
|
hash: service.version_hash,
|
||||||
@ -72,7 +72,7 @@ exports.fromService = function ({ service, instances, packages }) {
|
|||||||
slug: service.slug,
|
slug: service.slug,
|
||||||
instances,
|
instances,
|
||||||
connections: service.service_dependency_ids,
|
connections: service.service_dependency_ids,
|
||||||
branches: service.branches,
|
branches: branches,
|
||||||
config: service.config ? service.config : undefined,
|
config: service.config ? service.config : undefined,
|
||||||
status: service.status,
|
status: service.status,
|
||||||
hasPlan: service.has_plan
|
hasPlan: service.has_plan
|
||||||
|
@ -342,7 +342,8 @@ module.exports = class ContainerPilotWatcher extends Events {
|
|||||||
return serviceId;
|
return serviceId;
|
||||||
}, null);
|
}, null);
|
||||||
})
|
})
|
||||||
.filter(Boolean);
|
.filter(Boolean)
|
||||||
|
.filter((serviceId) => service.id !== serviceId);
|
||||||
}
|
}
|
||||||
|
|
||||||
_resolveInstanceHealth ({ name }, instance) {
|
_resolveInstanceHealth ({ name }, instance) {
|
||||||
@ -377,6 +378,10 @@ module.exports = class ContainerPilotWatcher extends Events {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_resolveServiceBranches ({ name, slug, instances }) {
|
_resolveServiceBranches ({ name, slug, instances }) {
|
||||||
|
if (instances.length <= 1) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
const deviantJobNames = Uniq(Flatten(instances.map(({ jobs }) => {
|
const deviantJobNames = Uniq(Flatten(instances.map(({ jobs }) => {
|
||||||
return Flatten(jobs.filter((jobName) => {
|
return Flatten(jobs.filter((jobName) => {
|
||||||
return new RegExp(`${name}-.*`).test(jobName);
|
return new RegExp(`${name}-.*`).test(jobName);
|
||||||
|
Loading…
Reference in New Issue
Block a user