mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-17 18:26:44 +00:00
Mount volume with ahrdcoded path
This commit is contained in:
3278
package-lock.json
generated
3278
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
7160
packages/docker/package-lock.json
generated
7160
packages/docker/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
3128
packages/hooklib/package-lock.json
generated
3128
packages/hooklib/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
6861
packages/k8s/package-lock.json
generated
6861
packages/k8s/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -114,7 +114,7 @@ function createPodSpec(
|
||||
}
|
||||
|
||||
function generateBuildTag(): string {
|
||||
return `${generateRandomString()}:${uuidv4().substring(0, 6)}`
|
||||
return `${generateRandomString()}:${generateRandomString(6)}`
|
||||
}
|
||||
|
||||
function generateBuildHandle(): string {
|
||||
@@ -123,7 +123,7 @@ function generateBuildHandle(): string {
|
||||
|
||||
function generateRandomString(length = 10): string {
|
||||
let v = ''
|
||||
const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
|
||||
const chars = 'abcdefghijklmnopqrstuvwxyz'
|
||||
for (let i = 0; i < length; i++) {
|
||||
v += chars.charAt(Math.floor(Math.random() * length))
|
||||
}
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import * as k8s from '@kubernetes/client-node'
|
||||
import { getVolumeClaimName } from '../hooks/constants'
|
||||
import { POD_VOLUME_NAME } from '.'
|
||||
|
||||
const REGISTRY_CONFIG_MAP_YAML = `
|
||||
storage:
|
||||
@@ -188,6 +190,14 @@ export function kanikoPod(
|
||||
c.image = 'gcr.io/kaniko-project/executor:latest'
|
||||
c.name = 'kaniko'
|
||||
c.imagePullPolicy = 'Always'
|
||||
c.volumeMounts = [
|
||||
{
|
||||
name: POD_VOLUME_NAME,
|
||||
mountPath: '/mnt/kan',
|
||||
subPath: "_actions/fhammerl/container-actions-demo/main/docker-built-from-file",
|
||||
readOnly: true
|
||||
}
|
||||
]
|
||||
c.env = [
|
||||
{
|
||||
name: 'GIT_TOKEN',
|
||||
@@ -196,13 +206,18 @@ export function kanikoPod(
|
||||
]
|
||||
c.args = [
|
||||
'--dockerfile=Dockerfile',
|
||||
`--context=${workingDirectory}`,
|
||||
`--context=dir:///mnt/kan`,
|
||||
`--destination=docker-registry.default.svc.cluster.local:5000/${imagePath}`
|
||||
]
|
||||
spec.containers = [c]
|
||||
spec.dnsPolicy = 'ClusterFirst'
|
||||
spec.restartPolicy = 'Never'
|
||||
pod.spec = spec
|
||||
|
||||
const claimName:string = getVolumeClaimName()
|
||||
pod.spec.volumes = [
|
||||
{
|
||||
name: POD_VOLUME_NAME,
|
||||
persistentVolumeClaim: { claimName },
|
||||
}]
|
||||
return pod
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user