mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-17 18:26:44 +00:00
Actually run built image
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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> {
|
||||||
|
|||||||
Reference in New Issue
Block a user