Skip to content

Commit

Permalink
fix: local-docker build failure when deploymentRegistry is enabled (#…
Browse files Browse the repository at this point in the history
…4835)

* chore: more informative error logging on `ENOENT`

* chore: remove old todo-comment

* fix(build): fix `cwd` when checking build status in deployment registry

The action's build directory might not exist on the first build status check.
The underlying docker command does not use the action's build directory in any context.
The `cwd` for the `docker` command has been changed to the garden project root dir.
  • Loading branch information
vvagaytsev authored Jul 14, 2023
1 parent 4098995 commit 135ea04
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 2 deletions.
1 change: 0 additions & 1 deletion core/src/build-staging/build-staging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ export class BuildStaging {
this.createdPaths.clear()
}

// TODO: ensure build path elsewhere?
getBuildPath(config: BuildActionConfig<string, any> | ModuleConfig): string {
// We don't stage the build for local exec modules, so the module path is effectively the build path.
if (config.kind === "Module" && config.type === "exec" && config["local"] === true) {
Expand Down
2 changes: 1 addition & 1 deletion core/src/plugins/kubernetes/container/build/local.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const getLocalBuildStatus: BuildStatusHandler = async (params) => {
if (deploymentRegistry) {
const args = await getManifestInspectArgs(outputs.deploymentImageId, deploymentRegistry)
const res = await containerHelpers.dockerCli({
cwd: action.getBuildPath(),
cwd: ctx.projectRoot,
args,
log,
ctx,
Expand Down
1 change: 1 addition & 0 deletions core/src/util/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ export function spawn(cmd: string, args: string[], opts: SpawnOpts = {}) {
let msg = `An error occurred while trying to run '${cmd}' (${err.message}).`
if ((<any>err).code === "ENOENT") {
msg = `${msg} Please make sure '${cmd}' is installed and in the $PATH.`
cwd && (msg = `${msg} Please make sure '${cwd}' exists and is a valid directory path.`)
}
_reject(new RuntimeError({ message: msg, detail: { cmd, args, opts, result, err } }))
})
Expand Down

0 comments on commit 135ea04

Please sign in to comment.