mirror of
https://github.com/balena-io/balena-cli.git
synced 2025-01-18 02:39:49 +00:00
push, build: Improve error handling (identify which service failed)
Change-type: patch
This commit is contained in:
parent
d2fabcaf30
commit
c7bbbc4159
@ -1063,18 +1063,21 @@ async function performResolution(
|
||||
if (!buildTask.buildStream) {
|
||||
continue;
|
||||
}
|
||||
// Consume each task.buildStream in order to trigger the
|
||||
// resolution events that define fields like:
|
||||
// task.dockerfile, task.dockerfilePath,
|
||||
// task.projectType, task.resolved
|
||||
// This mimics what is currently done in `resin-builder`.
|
||||
const clonedStream: Pack = await cloneTarStream(
|
||||
buildTask.buildStream,
|
||||
);
|
||||
buildTask.buildStream = clonedStream;
|
||||
if (!buildTask.external && !buildTask.resolved) {
|
||||
let error: Error | undefined;
|
||||
try {
|
||||
// Consume each task.buildStream in order to trigger the
|
||||
// resolution events that define fields like:
|
||||
// task.dockerfile, task.dockerfilePath,
|
||||
// task.projectType, task.resolved
|
||||
// This mimics what is currently done in `resin-builder`.
|
||||
buildTask.buildStream = await cloneTarStream(buildTask.buildStream);
|
||||
} catch (e) {
|
||||
error = e;
|
||||
}
|
||||
if (error || (!buildTask.external && !buildTask.resolved)) {
|
||||
const cause = error ? `${error}\n` : '';
|
||||
throw new ExpectedError(
|
||||
`Project type for service "${buildTask.serviceName}" could not be determined. Missing a Dockerfile?`,
|
||||
`${cause}Project type for service "${buildTask.serviceName}" could not be determined. Missing a Dockerfile?`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user