From a1c9c67c038c8366f23e1a14dc4ba1357e511075 Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Fri, 28 May 2021 13:51:48 +0000 Subject: [PATCH] fix(k8s): ensure project namespace exists ahead of kaniko build --- core/src/plugins/kubernetes/container/build/kaniko.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/plugins/kubernetes/container/build/kaniko.ts b/core/src/plugins/kubernetes/container/build/kaniko.ts index 4ca80d417d..61b51fa4b7 100644 --- a/core/src/plugins/kubernetes/container/build/kaniko.ts +++ b/core/src/plugins/kubernetes/container/build/kaniko.ts @@ -23,7 +23,7 @@ import { KubernetesProvider, KubernetesPluginContext, DEFAULT_KANIKO_IMAGE } fro import { BuildError, ConfigurationError } from "../../../../exceptions" import { PodRunner } from "../../run" import { Writable } from "stream" -import { getNamespaceStatus, getSystemNamespace } from "../../namespace" +import { ensureNamespace, getNamespaceStatus, getSystemNamespace } from "../../namespace" import { dedent } from "../../../../util/string" import { RunResult } from "../../../../types/plugin/base" import { PluginContext } from "../../../../plugin-context" @@ -151,6 +151,8 @@ export const kanikoBuild: BuildHandler = async (params) => { authSecret = secretRes.authSecret } + await ensureNamespace(api, { name: kanikoNamespace }, log) + // Execute the build const args = [ "--context",