Actually run built image

This commit is contained in:
Ferenc Hammerl
2022-09-26 13:57:51 +00:00
parent 3d102fd372
commit a99346d1ab
2 changed files with 7 additions and 3 deletions

View File

@@ -26,8 +26,9 @@ export async function runContainerStep(
): Promise<number> { ): Promise<number> {
if (stepContainer.dockerfile) { if (stepContainer.dockerfile) {
const imagePath = `${generateBuildHandle()}/${generateBuildTag()}` const imagePath = `${generateBuildHandle()}/${generateBuildTag()}`
await containerBuild(stepContainer, imagePath) const imageUrl = await containerBuild(stepContainer, imagePath)
throw new Error('Building container actions is not currently supported') // throw new Error('Building container actions is not currently supported')
stepContainer.image = imageUrl
} }
let secretName: string | undefined = undefined let secretName: string | undefined = undefined

View File

@@ -488,11 +488,13 @@ export async function isPodContainerAlpine(
export async function containerBuild( export async function containerBuild(
args: RunContainerStepArgs, args: RunContainerStepArgs,
imagePath: string imagePath: string
): Promise<void> { ): Promise<string> {
const cm = registryConfigMap() const cm = registryConfigMap()
const secret = registrySecret() const secret = registrySecret()
const ss = registryStatefulSet() const ss = registryStatefulSet()
const svc = registryService() const svc = registryService()
const port = svc?.spec?.ports?.[0]?.nodePort
const registryUri = `localhost:${port}/${imagePath}`
const pod = kanikoPod(args.workingDirectory, imagePath) const pod = kanikoPod(args.workingDirectory, imagePath)
await Promise.all([ await Promise.all([
k8sApi.createNamespacedConfigMap(namespace(), cm), k8sApi.createNamespacedConfigMap(namespace(), cm),
@@ -522,6 +524,7 @@ export async function containerBuild(
console.log(JSON.stringify(err)) console.log(JSON.stringify(err))
throw err throw err
} }
return registryUri
} }
async function getCurrentNodeName(): Promise<string> { async function getCurrentNodeName(): Promise<string> {