GCP-secret run, cache key
parent
73149fb464
commit
e4490cd3ca
21
action.yml
21
action.yml
|
|
@ -154,15 +154,18 @@ inputs:
|
||||||
default: '5Gi'
|
default: '5Gi'
|
||||||
required: false
|
required: false
|
||||||
description: 'Amount of disc space to assign the Kubernetes Persistent Volume'
|
description: 'Amount of disc space to assign the Kubernetes Persistent Volume'
|
||||||
# To Do - enables resilience
|
cacheKey:
|
||||||
# checkDependencyHealthOverride:
|
default: 'branch'
|
||||||
# default: ''
|
required: false
|
||||||
# required: false
|
description: 'Cache key to indicate bucket for cache'
|
||||||
# description: 'Use to specify a way to check depdency services health to enable resilient self-starting jobs'
|
checkDependencyHealthOverride:
|
||||||
# startDependenciesOverride:
|
default: ''
|
||||||
# default: ''
|
required: false
|
||||||
# required: false
|
description: 'Use to specify a way to check depdency services health to enable resilient self-starting jobs'
|
||||||
# description: 'Use to specify a way to start depdency services health to enable resilient self-starting jobs'
|
startDependenciesOverride:
|
||||||
|
default: ''
|
||||||
|
required: false
|
||||||
|
description: 'Use to specify a way to start depdency services health to enable resilient self-starting jobs'
|
||||||
outputs:
|
outputs:
|
||||||
volume:
|
volume:
|
||||||
description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes'
|
description: 'The Persistent Volume (PV) where the build artifacts have been stored by Kubernetes'
|
||||||
|
|
|
||||||
|
|
@ -328,6 +328,9 @@ class BuildParameters {
|
||||||
readInputOverrideCommand: input_1.default.readInputOverrideCommand(),
|
readInputOverrideCommand: input_1.default.readInputOverrideCommand(),
|
||||||
readInputFromOverrideList: input_1.default.readInputFromOverrideList(),
|
readInputFromOverrideList: input_1.default.readInputFromOverrideList(),
|
||||||
kubeStorageClass: input_1.default.kubeStorageClass,
|
kubeStorageClass: input_1.default.kubeStorageClass,
|
||||||
|
checkDependencyHealthOverride: input_1.default.checkDependencyHealthOverride,
|
||||||
|
startDependenciesOverride: input_1.default.startDependenciesOverride,
|
||||||
|
cacheKey: input_1.default.cacheKey,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -2994,7 +2997,7 @@ class CloudRunnerState {
|
||||||
return path_1.default.join(`/`, CloudRunnerState.buildVolumeFolder, CloudRunnerState.buildParams.buildGuid);
|
return path_1.default.join(`/`, CloudRunnerState.buildVolumeFolder, CloudRunnerState.buildParams.buildGuid);
|
||||||
}
|
}
|
||||||
static get cacheFolderFull() {
|
static get cacheFolderFull() {
|
||||||
return path_1.default.join('/', CloudRunnerState.buildVolumeFolder, CloudRunnerState.cacheFolder, CloudRunnerState.branchName);
|
return path_1.default.join('/', CloudRunnerState.buildVolumeFolder, CloudRunnerState.cacheFolder, CloudRunnerState.cacheKey);
|
||||||
}
|
}
|
||||||
static setup(buildParameters) {
|
static setup(buildParameters) {
|
||||||
CloudRunnerState.buildParams = buildParameters;
|
CloudRunnerState.buildParams = buildParameters;
|
||||||
|
|
@ -3002,6 +3005,9 @@ class CloudRunnerState {
|
||||||
static get branchName() {
|
static get branchName() {
|
||||||
return CloudRunnerState.buildParams.branch;
|
return CloudRunnerState.buildParams.branch;
|
||||||
}
|
}
|
||||||
|
static get cacheKey() {
|
||||||
|
return CloudRunnerState.buildParams.cacheKey || CloudRunnerState.buildParams.branch;
|
||||||
|
}
|
||||||
static get builderPathFull() {
|
static get builderPathFull() {
|
||||||
return path_1.default.join(CloudRunnerState.buildPathFull, `builder`);
|
return path_1.default.join(CloudRunnerState.buildPathFull, `builder`);
|
||||||
}
|
}
|
||||||
|
|
@ -4240,6 +4246,9 @@ class Input {
|
||||||
static get startDependenciesOverride() {
|
static get startDependenciesOverride() {
|
||||||
return Input.getInput('startDependenciesOverride') || '';
|
return Input.getInput('startDependenciesOverride') || '';
|
||||||
}
|
}
|
||||||
|
static get cacheKey() {
|
||||||
|
return Input.getInput('cacheKey') || '';
|
||||||
|
}
|
||||||
static ToEnvVarFormat(input) {
|
static ToEnvVarFormat(input) {
|
||||||
return input
|
return input
|
||||||
.replace(/([A-Z])/g, ' $1')
|
.replace(/([A-Z])/g, ' $1')
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -13,6 +13,7 @@
|
||||||
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
"format": "prettier --write \"src/**/*.{js,ts}\"",
|
||||||
"prepare": "husky install",
|
"prepare": "husky install",
|
||||||
"cli": "yarn ts-node src/index.ts -m cli",
|
"cli": "yarn ts-node src/index.ts -m cli",
|
||||||
|
"gcp-secrets-cli": "cross-env readInputOverrideCommand=\"gcloud secrets versions access 0 --secret=\"{0}\"\" yarn ts-node src/index.ts -m cli",
|
||||||
"cli-aws": "cross-env cloudRunnerCluster=aws yarn run test-cli",
|
"cli-aws": "cross-env cloudRunnerCluster=aws yarn run test-cli",
|
||||||
"cli-k8s": "cross-env cloudRunnerCluster=k8s yarn run test-cli",
|
"cli-k8s": "cross-env cloudRunnerCluster=k8s yarn run test-cli",
|
||||||
"test-cli": "cross-env cloudRunnerTests=true yarn ts-node src/index.ts -m cli --projectPath test-project",
|
"test-cli": "cross-env cloudRunnerTests=true yarn ts-node src/index.ts -m cli --projectPath test-project",
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,9 @@ class BuildParameters {
|
||||||
public cachePullOverrideCommand!: string;
|
public cachePullOverrideCommand!: string;
|
||||||
public readInputFromOverrideList!: string;
|
public readInputFromOverrideList!: string;
|
||||||
public readInputOverrideCommand!: string;
|
public readInputOverrideCommand!: string;
|
||||||
|
public checkDependencyHealthOverride!: string;
|
||||||
|
public startDependenciesOverride!: string;
|
||||||
|
public cacheKey!: string;
|
||||||
|
|
||||||
public postBuildSteps!: string;
|
public postBuildSteps!: string;
|
||||||
public preBuildSteps!: string;
|
public preBuildSteps!: string;
|
||||||
|
|
@ -135,6 +138,9 @@ class BuildParameters {
|
||||||
readInputOverrideCommand: Input.readInputOverrideCommand(),
|
readInputOverrideCommand: Input.readInputOverrideCommand(),
|
||||||
readInputFromOverrideList: Input.readInputFromOverrideList(),
|
readInputFromOverrideList: Input.readInputFromOverrideList(),
|
||||||
kubeStorageClass: Input.kubeStorageClass,
|
kubeStorageClass: Input.kubeStorageClass,
|
||||||
|
checkDependencyHealthOverride: Input.checkDependencyHealthOverride,
|
||||||
|
startDependenciesOverride: Input.startDependenciesOverride,
|
||||||
|
cacheKey: Input.cacheKey,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,14 @@ import { CloudRunnerStatics } from './cloud-runner-statics';
|
||||||
import { TaskParameterSerializer } from './services/task-parameter-serializer';
|
import { TaskParameterSerializer } from './services/task-parameter-serializer';
|
||||||
import UnityVersioning from '../unity-versioning';
|
import UnityVersioning from '../unity-versioning';
|
||||||
|
|
||||||
|
function guid() {
|
||||||
|
return Math.trunc((1 + Math.random()) * 0x10000)
|
||||||
|
.toString(16)
|
||||||
|
.slice(1);
|
||||||
|
}
|
||||||
|
function guidGenerator() {
|
||||||
|
return `${guid() + guid()}-${guid()}-${guid()}-${guid()}-${guid()}${guid()}${guid()}`;
|
||||||
|
}
|
||||||
describe('Cloud Runner', () => {
|
describe('Cloud Runner', () => {
|
||||||
it('responds', () => {});
|
it('responds', () => {});
|
||||||
});
|
});
|
||||||
|
|
@ -55,6 +63,7 @@ describe('Cloud Runner', () => {
|
||||||
versioning: 'None',
|
versioning: 'None',
|
||||||
projectPath: 'test-project',
|
projectPath: 'test-project',
|
||||||
unityVersion: UnityVersioning.read('test-project'),
|
unityVersion: UnityVersioning.read('test-project'),
|
||||||
|
cacheKey: `test-case-${guidGenerator()}`,
|
||||||
};
|
};
|
||||||
Input.githubInputEnabled = false;
|
Input.githubInputEnabled = false;
|
||||||
const buildParameter = await BuildParameters.create();
|
const buildParameter = await BuildParameters.create();
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,7 @@ export class CloudRunnerState {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static get cacheFolderFull(): string {
|
public static get cacheFolderFull(): string {
|
||||||
return path.join(
|
return path.join('/', CloudRunnerState.buildVolumeFolder, CloudRunnerState.cacheFolder, CloudRunnerState.cacheKey);
|
||||||
'/',
|
|
||||||
CloudRunnerState.buildVolumeFolder,
|
|
||||||
CloudRunnerState.cacheFolder,
|
|
||||||
CloudRunnerState.branchName,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static setup(buildParameters: BuildParameters) {
|
static setup(buildParameters: BuildParameters) {
|
||||||
|
|
@ -31,6 +26,10 @@ export class CloudRunnerState {
|
||||||
public static get branchName(): string {
|
public static get branchName(): string {
|
||||||
return CloudRunnerState.buildParams.branch;
|
return CloudRunnerState.buildParams.branch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static get cacheKey(): string {
|
||||||
|
return CloudRunnerState.buildParams.cacheKey || CloudRunnerState.buildParams.branch;
|
||||||
|
}
|
||||||
public static get builderPathFull(): string {
|
public static get builderPathFull(): string {
|
||||||
return path.join(CloudRunnerState.buildPathFull, `builder`);
|
return path.join(CloudRunnerState.buildPathFull, `builder`);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -287,6 +287,10 @@ class Input {
|
||||||
return Input.getInput('startDependenciesOverride') || '';
|
return Input.getInput('startDependenciesOverride') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get cacheKey(): string {
|
||||||
|
return Input.getInput('cacheKey') || '';
|
||||||
|
}
|
||||||
|
|
||||||
public static ToEnvVarFormat(input: string) {
|
public static ToEnvVarFormat(input: string) {
|
||||||
return input
|
return input
|
||||||
.replace(/([A-Z])/g, ' $1')
|
.replace(/([A-Z])/g, ' $1')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue