mirror of
https://github.com/actions/runner-container-hooks.git
synced 2025-12-19 03:16:44 +00:00
moved from random string generation to uuidv4()
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as k8s from '@kubernetes/client-node'
|
import * as k8s from '@kubernetes/client-node'
|
||||||
|
import { v4 as uuidv4 } from 'uuid'
|
||||||
import { RunContainerStepArgs } from 'hooklib'
|
import { RunContainerStepArgs } from 'hooklib'
|
||||||
import {
|
import {
|
||||||
createJob,
|
createJob,
|
||||||
@@ -113,18 +114,9 @@ function createPodSpec(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generateBuildTag(): string {
|
function generateBuildTag(): string {
|
||||||
return `${generateRandomString()}:${generateRandomString(6)}`
|
return `${uuidv4()}:${uuidv4()}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateBuildHandle(): string {
|
function generateBuildHandle(): string {
|
||||||
return generateRandomString()
|
return uuidv4()
|
||||||
}
|
|
||||||
|
|
||||||
function generateRandomString(length = 10): string {
|
|
||||||
let v = ''
|
|
||||||
const chars = 'abcdefghijklmnopqrstuvwxyz'
|
|
||||||
for (let i = 0; i < length; i++) {
|
|
||||||
v += chars.charAt(Math.floor(Math.random() * length))
|
|
||||||
}
|
|
||||||
return v
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user