mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-18 19:06:44 +00:00
managed to execute docker hub push and execute that image
This commit is contained in:
@@ -24,7 +24,8 @@ import {
|
||||
localRegistryPort,
|
||||
remoteRegistryHost,
|
||||
remoteRegistryHandle,
|
||||
remoteRegistrySecretName
|
||||
remoteRegistrySecretName,
|
||||
isLocalRegistrySet
|
||||
} from './settings'
|
||||
|
||||
export * from './settings'
|
||||
@@ -486,14 +487,19 @@ export async function containerBuild(
|
||||
let kanikoRegistry = ''
|
||||
let pullRegistry = ''
|
||||
let secretName: string | undefined = undefined
|
||||
if (localRegistryHost()) {
|
||||
if (isLocalRegistrySet()) {
|
||||
const host = `${localRegistryHost()}.${namespace()}.svc.cluster.local`
|
||||
const port = localRegistryPort()
|
||||
const uri = `${generateBuildHandle()}/${generateBuildImage()}`
|
||||
kanikoRegistry = `${host}:${port}/${uri}`
|
||||
pullRegistry = `localhost:${localRegistryNodePort()}/${uri}`
|
||||
} else {
|
||||
kanikoRegistry = `${remoteRegistryHost()}/${remoteRegistryHandle()}/${generateBuildImage()}`
|
||||
const uri = `${remoteRegistryHandle()}/${generateBuildImage()}`
|
||||
if (remoteRegistryHost()) {
|
||||
kanikoRegistry = `${remoteRegistryHost()}/${uri}`
|
||||
} else {
|
||||
kanikoRegistry = uri
|
||||
}
|
||||
pullRegistry = kanikoRegistry
|
||||
secretName = remoteRegistrySecretName()
|
||||
}
|
||||
|
||||
@@ -22,6 +22,11 @@ export function namespace(): string {
|
||||
return context.namespace
|
||||
}
|
||||
|
||||
export function isLocalRegistrySet(): boolean {
|
||||
const name = 'ACTIONS_RUNNER_CONTAINER_HOOKS_LOCAL_REGISTRY_HOST'
|
||||
return !!process.env[name]
|
||||
}
|
||||
|
||||
export function localRegistryHost(): string {
|
||||
const name = 'ACTIONS_RUNNER_CONTAINER_HOOKS_LOCAL_REGISTRY_HOST'
|
||||
if (process.env[name]) {
|
||||
@@ -48,10 +53,7 @@ export function localRegistryNodePort(): number {
|
||||
|
||||
export function remoteRegistryHost(): string {
|
||||
const name = 'ACTIONS_RUNNER_CONTAINER_HOOKS_REMOTE_REGISTRY_HOST'
|
||||
if (process.env[name]) {
|
||||
return process.env[name]
|
||||
}
|
||||
throw new Error(`environment variable ${name} is not set`)
|
||||
return process.env[name] || ''
|
||||
}
|
||||
|
||||
export function remoteRegistryHandle(): string {
|
||||
|
||||
Reference in New Issue
Block a user