fixing cache folder
parent
ca2b0a6ce0
commit
ea8f808985
|
|
@ -34,7 +34,6 @@ jobs:
|
||||||
matrix:
|
matrix:
|
||||||
targetPlatform:
|
targetPlatform:
|
||||||
- StandaloneLinux64
|
- StandaloneLinux64
|
||||||
- StandaloneWindows64
|
|
||||||
steps:
|
steps:
|
||||||
###########################
|
###########################
|
||||||
# Checkout #
|
# Checkout #
|
||||||
|
|
|
||||||
|
|
@ -2679,20 +2679,20 @@ class CloudRunnerLogger {
|
||||||
return Date.now();
|
return Date.now();
|
||||||
}
|
}
|
||||||
static InitHook() {
|
static InitHook() {
|
||||||
|
var _a, _b, _c, _d, _e;
|
||||||
if (process.env.INIT_HOOK === undefined || !__1.Input.cloudRunnerTests) {
|
if (process.env.INIT_HOOK === undefined || !__1.Input.cloudRunnerTests) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CloudRunnerLogger.log(`STARTING INIT HOOK ${process.env.INIT_HOOK}`);
|
CloudRunnerLogger.log(`STARTING INIT HOOK ${process.env.INIT_HOOK}`);
|
||||||
CloudRunnerLogger.child = child_process_1.exec(process.env.INIT_HOOK, (error, stdout, stderr) => {
|
CloudRunnerLogger.child = child_process_1.spawn(process.env.INIT_HOOK);
|
||||||
if (error) {
|
(_b = (_a = CloudRunnerLogger.child) === null || _a === void 0 ? void 0 : _a.stdout) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
|
||||||
CloudRunnerLogger.error(`[GCP-LOGGER][ERROR]${error}`);
|
CloudRunnerLogger.log(`[GCP-LOGGER]${data}`);
|
||||||
return;
|
});
|
||||||
}
|
(_d = (_c = CloudRunnerLogger.child) === null || _c === void 0 ? void 0 : _c.stderr) === null || _d === void 0 ? void 0 : _d.on('data', (data) => {
|
||||||
if (stderr) {
|
CloudRunnerLogger.logWarning(`[GCP-LOGGER][DIAGNOSTIC]${data}`);
|
||||||
CloudRunnerLogger.logWarning(`[GCP-LOGGER][DIAGNOSTIC]${stderr}`);
|
});
|
||||||
return;
|
(_e = CloudRunnerLogger.child) === null || _e === void 0 ? void 0 : _e.on('error', (data) => {
|
||||||
}
|
CloudRunnerLogger.error(`[GCP-LOGGER][ERROR]${data}`);
|
||||||
CloudRunnerLogger.log(`[GCP-LOGGER]${stdout}`);
|
|
||||||
});
|
});
|
||||||
CloudRunnerLogger.child.on('close', function (code) {
|
CloudRunnerLogger.child.on('close', function (code) {
|
||||||
CloudRunnerLogger.log(`[GCP-LOGGER][Exit code ${code}]`);
|
CloudRunnerLogger.log(`[GCP-LOGGER][Exit code ${code}]`);
|
||||||
|
|
@ -3230,6 +3230,7 @@ const cloud_runner_step_state_1 = __webpack_require__(64854);
|
||||||
const custom_workflow_1 = __webpack_require__(3786);
|
const custom_workflow_1 = __webpack_require__(3786);
|
||||||
const build_automation_workflow_1 = __webpack_require__(94655);
|
const build_automation_workflow_1 = __webpack_require__(94655);
|
||||||
const task_parameter_serializer_1 = __webpack_require__(35346);
|
const task_parameter_serializer_1 = __webpack_require__(35346);
|
||||||
|
const setup_step_1 = __webpack_require__(58923);
|
||||||
class WorkflowCompositionRoot {
|
class WorkflowCompositionRoot {
|
||||||
run(cloudRunnerStepState) {
|
run(cloudRunnerStepState) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
|
|
@ -3244,7 +3245,10 @@ class WorkflowCompositionRoot {
|
||||||
static runJob(baseImage) {
|
static runJob(baseImage) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
if (cloud_runner_state_1.CloudRunnerState.buildParams.customJob !== '') {
|
if (cloud_runner_state_1.CloudRunnerState.buildParams.customJob === `setup`) {
|
||||||
|
return yield new setup_step_1.SetupStep().run(new cloud_runner_step_state_1.CloudRunnerStepState(baseImage, task_parameter_serializer_1.TaskParameterSerializer.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
|
||||||
|
}
|
||||||
|
else if (cloud_runner_state_1.CloudRunnerState.buildParams.customJob !== '') {
|
||||||
return yield custom_workflow_1.CustomWorkflow.runCustomJob(cloud_runner_state_1.CloudRunnerState.buildParams.customJob);
|
return yield custom_workflow_1.CustomWorkflow.runCustomJob(cloud_runner_state_1.CloudRunnerState.buildParams.customJob);
|
||||||
}
|
}
|
||||||
return yield new build_automation_workflow_1.BuildAutomationWorkflow().run(new cloud_runner_step_state_1.CloudRunnerStepState(baseImage, task_parameter_serializer_1.TaskParameterSerializer.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
|
return yield new build_automation_workflow_1.BuildAutomationWorkflow().run(new cloud_runner_step_state_1.CloudRunnerStepState(baseImage, task_parameter_serializer_1.TaskParameterSerializer.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -11,21 +11,21 @@ describe('Cloud Runner', () => {
|
||||||
describe('Cloud Runner', () => {
|
describe('Cloud Runner', () => {
|
||||||
const testSecretName = 'testSecretName';
|
const testSecretName = 'testSecretName';
|
||||||
const testSecretValue = 'testSecretValue';
|
const testSecretValue = 'testSecretValue';
|
||||||
Input.cliOptions = {
|
|
||||||
versioning: 'None',
|
|
||||||
projectPath: 'test-project',
|
|
||||||
unityVersion: UnityVersioning.read('test-project'),
|
|
||||||
customJob: `
|
|
||||||
- name: 'step 1'
|
|
||||||
image: 'alpine'
|
|
||||||
commands: 'printenv'
|
|
||||||
secrets:
|
|
||||||
- name: '${testSecretName}'
|
|
||||||
value: '${testSecretValue}'
|
|
||||||
`,
|
|
||||||
};
|
|
||||||
if (Input.cloudRunnerTests) {
|
if (Input.cloudRunnerTests) {
|
||||||
it('All build parameters sent to cloud runner as env vars', async () => {
|
it('All build parameters sent to cloud runner as env vars', async () => {
|
||||||
|
Input.cliOptions = {
|
||||||
|
versioning: 'None',
|
||||||
|
projectPath: 'test-project',
|
||||||
|
unityVersion: UnityVersioning.read('test-project'),
|
||||||
|
customJob: `
|
||||||
|
- name: 'step 1'
|
||||||
|
image: 'alpine'
|
||||||
|
commands: 'printenv'
|
||||||
|
secrets:
|
||||||
|
- name: '${testSecretName}'
|
||||||
|
value: '${testSecretValue}'
|
||||||
|
`,
|
||||||
|
};
|
||||||
Input.githubInputEnabled = false;
|
Input.githubInputEnabled = false;
|
||||||
const buildParameter = await BuildParameters.create();
|
const buildParameter = await BuildParameters.create();
|
||||||
const baseImage = new ImageTag(buildParameter);
|
const baseImage = new ImageTag(buildParameter);
|
||||||
|
|
@ -46,5 +46,52 @@ describe('Cloud Runner', () => {
|
||||||
}
|
}
|
||||||
Input.githubInputEnabled = true;
|
Input.githubInputEnabled = true;
|
||||||
}, 1000000);
|
}, 1000000);
|
||||||
|
it('Caches Library and LFS', async () => {
|
||||||
|
Input.githubInputEnabled = false;
|
||||||
|
Input.cliOptions = {
|
||||||
|
versioning: 'None',
|
||||||
|
projectPath: 'test-project',
|
||||||
|
unityVersion: UnityVersioning.read('test-project'),
|
||||||
|
customJob: `
|
||||||
|
- name: 'step 1'
|
||||||
|
image: 'alpine'
|
||||||
|
commands: '
|
||||||
|
cd 0-windows64-13xi
|
||||||
|
ls'
|
||||||
|
secrets:
|
||||||
|
- name: '${testSecretName}'
|
||||||
|
value: '${testSecretValue}'
|
||||||
|
`,
|
||||||
|
};
|
||||||
|
let buildParameter = await BuildParameters.create();
|
||||||
|
let baseImage = new ImageTag(buildParameter);
|
||||||
|
await CloudRunner.run(buildParameter, baseImage.toString());
|
||||||
|
Input.cliOptions = {
|
||||||
|
versioning: 'None',
|
||||||
|
projectPath: 'test-project',
|
||||||
|
unityVersion: UnityVersioning.read('test-project'),
|
||||||
|
customJob: `setup`,
|
||||||
|
};
|
||||||
|
buildParameter = await BuildParameters.create();
|
||||||
|
baseImage = new ImageTag(buildParameter);
|
||||||
|
await CloudRunner.run(buildParameter, baseImage.toString());
|
||||||
|
Input.cliOptions = {
|
||||||
|
versioning: 'None',
|
||||||
|
projectPath: 'test-project',
|
||||||
|
unityVersion: UnityVersioning.read('test-project'),
|
||||||
|
customJob: `
|
||||||
|
- name: 'step 1'
|
||||||
|
image: 'alpine'
|
||||||
|
commands: 'ls'
|
||||||
|
secrets:
|
||||||
|
- name: '${testSecretName}'
|
||||||
|
value: '${testSecretValue}'
|
||||||
|
`,
|
||||||
|
};
|
||||||
|
buildParameter = await BuildParameters.create();
|
||||||
|
baseImage = new ImageTag(buildParameter);
|
||||||
|
await CloudRunner.run(buildParameter, baseImage.toString());
|
||||||
|
Input.githubInputEnabled = true;
|
||||||
|
}, 1000000);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import { ChildProcess, exec } from 'child_process';
|
import { ChildProcess, spawn } from 'child_process';
|
||||||
import { Input } from '../..';
|
import { Input } from '../..';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|
||||||
|
|
@ -65,17 +65,20 @@ class CloudRunnerLogger {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CloudRunnerLogger.log(`STARTING INIT HOOK ${process.env.INIT_HOOK}`);
|
CloudRunnerLogger.log(`STARTING INIT HOOK ${process.env.INIT_HOOK}`);
|
||||||
CloudRunnerLogger.child = exec(process.env.INIT_HOOK, (error: any, stdout: string, stderr: any) => {
|
CloudRunnerLogger.child = spawn(process.env.INIT_HOOK);
|
||||||
if (error) {
|
|
||||||
CloudRunnerLogger.error(`[GCP-LOGGER][ERROR]${error}`);
|
CloudRunnerLogger.child?.stdout?.on('data', (data) => {
|
||||||
return;
|
CloudRunnerLogger.log(`[GCP-LOGGER]${data}`);
|
||||||
}
|
|
||||||
if (stderr) {
|
|
||||||
CloudRunnerLogger.logWarning(`[GCP-LOGGER][DIAGNOSTIC]${stderr}`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
CloudRunnerLogger.log(`[GCP-LOGGER]${stdout}`);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
CloudRunnerLogger.child?.stderr?.on('data', (data) => {
|
||||||
|
CloudRunnerLogger.logWarning(`[GCP-LOGGER][DIAGNOSTIC]${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
CloudRunnerLogger.child?.on('error', (data) => {
|
||||||
|
CloudRunnerLogger.error(`[GCP-LOGGER][ERROR]${data}`);
|
||||||
|
});
|
||||||
|
|
||||||
CloudRunnerLogger.child.on('close', function (code) {
|
CloudRunnerLogger.child.on('close', function (code) {
|
||||||
CloudRunnerLogger.log(`[GCP-LOGGER][Exit code ${code}]`);
|
CloudRunnerLogger.log(`[GCP-LOGGER][Exit code ${code}]`);
|
||||||
if (code !== 0) {
|
if (code !== 0) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import { CustomWorkflow } from './custom-workflow';
|
||||||
import { WorkflowInterface } from './workflow-interface';
|
import { WorkflowInterface } from './workflow-interface';
|
||||||
import { BuildAutomationWorkflow } from './build-automation-workflow';
|
import { BuildAutomationWorkflow } from './build-automation-workflow';
|
||||||
import { TaskParameterSerializer } from '../services/task-parameter-serializer';
|
import { TaskParameterSerializer } from '../services/task-parameter-serializer';
|
||||||
|
import { SetupStep } from '../steps/setup-step';
|
||||||
|
|
||||||
export class WorkflowCompositionRoot implements WorkflowInterface {
|
export class WorkflowCompositionRoot implements WorkflowInterface {
|
||||||
async run(cloudRunnerStepState: CloudRunnerStepState) {
|
async run(cloudRunnerStepState: CloudRunnerStepState) {
|
||||||
|
|
@ -16,7 +17,15 @@ export class WorkflowCompositionRoot implements WorkflowInterface {
|
||||||
|
|
||||||
private static async runJob(baseImage: any) {
|
private static async runJob(baseImage: any) {
|
||||||
try {
|
try {
|
||||||
if (CloudRunnerState.buildParams.customJob !== '') {
|
if (CloudRunnerState.buildParams.customJob === `setup`) {
|
||||||
|
return await new SetupStep().run(
|
||||||
|
new CloudRunnerStepState(
|
||||||
|
baseImage,
|
||||||
|
TaskParameterSerializer.readBuildEnvironmentVariables(),
|
||||||
|
CloudRunnerState.defaultSecrets,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else if (CloudRunnerState.buildParams.customJob !== '') {
|
||||||
return await CustomWorkflow.runCustomJob(CloudRunnerState.buildParams.customJob);
|
return await CustomWorkflow.runCustomJob(CloudRunnerState.buildParams.customJob);
|
||||||
}
|
}
|
||||||
return await new BuildAutomationWorkflow().run(
|
return await new BuildAutomationWorkflow().run(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue