Skip to content

Commit

Permalink
fix(k8s): fix handling of missing sh when copying artifacts from pods
Browse files Browse the repository at this point in the history
  • Loading branch information
edvald committed Feb 19, 2020
1 parent cb987e2 commit d0698b4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions garden-service/src/plugins/kubernetes/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export async function runAndCopy({
description = `Container module '${module.name}'`
}

const errorMetadata = { moduleName: module.name, description, args, artifacts }
const errorMetadata: any = { moduleName: module.name, description, args, artifacts }

if (getArtifacts) {
if (!command) {
Expand Down Expand Up @@ -177,7 +177,10 @@ export async function runAndCopy({
stderr,
})

if (state === "unhealthy") {
errorMetadata.pod = pod
errorMetadata.state = state

if (state !== "ready") {
// Specifically look for error indicating `sh` is missing, and report with helpful message.
const containerStatus = pod!.status.containerStatuses![0]

Expand All @@ -189,13 +192,11 @@ export async function runAndCopy({
be installed in the image.`,
errorMetadata
)
} else {
throw new RuntimeError(`Failed to start Pod ${runner.podName}`, errorMetadata)
}
}

if (state !== "ready") {
throw new RuntimeError(`Failed to start Pod ${runner.podName}`, errorMetadata)
}

try {
await runner.exec({
command: ["sh", "-c", "tar --help"],
Expand Down

0 comments on commit d0698b4

Please sign in to comment.