Fix/health check error (#2731)

* fix: No error's with an error code

* fix dns query

* await resolv.conf copy

* use tty in subcontainer exec if parent is tty

* Fix: Home=root for inject services

* fix: Add the action inject too

---------

Co-authored-by: Aiden McClelland <me@drbonez.dev>
This commit is contained in:
Jade
2024-08-30 00:29:27 -06:00
committed by GitHub
parent ed1bc6c215
commit 66b018a355
7 changed files with 78 additions and 15 deletions

View File

@@ -173,10 +173,16 @@ export class MainLoop {
subcontainer,
}
)
const env: Record<string, string> = actionProcedure.inject
? {
HOME: "/root",
}
: {}
const executed = await container.exec(
[actionProcedure.entrypoint, ...actionProcedure.args],
{ input: JSON.stringify(timeChanged) },
{ input: JSON.stringify(timeChanged), env },
)
if (executed.exitCode === 0) {
await effects.setHealth({
id: healthId,
@@ -227,6 +233,18 @@ export class MainLoop {
})
return
}
if (executed.exitCode && executed.exitCode > 0) {
await effects.setHealth({
id: healthId,
name: value.name,
result: "failure",
message:
executed.stderr.toString() ||
executed.stdout.toString() ||
`Program exited with code ${executed.exitCode}:`,
})
return
}
await effects.setHealth({
id: healthId,
name: value.name,

View File

@@ -750,6 +750,12 @@ export class SystemForEmbassy implements System {
const subcontainer = actionProcedure.inject
? this.currentRunning?.mainSubContainerHandle
: undefined
const env: Record<string, string> = actionProcedure.inject
? {
HOME: "/root",
}
: {}
const container = await DockerProcedureContainer.of(
effects,
this.manifest.id,
@@ -769,6 +775,7 @@ export class SystemForEmbassy implements System {
JSON.stringify(formData),
],
timeoutMs,
{ env },
)
).stdout.toString(),
),