Move compress step into builder
parent
1ce8526057
commit
3a39995b22
|
|
@ -78,6 +78,7 @@ function runCli() {
|
|||
yield model_1.CloudRunner.run(buildParameter, baseImage.toString());
|
||||
});
|
||||
}
|
||||
model_1.Input.githubEnabled = false;
|
||||
const program = new commander_ts_1.Command();
|
||||
program.version('0.0.1');
|
||||
const properties = Object.getOwnPropertyNames(model_1.Input);
|
||||
|
|
@ -95,7 +96,6 @@ program.parse(process.argv);
|
|||
const options = program.opts();
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Entrypoint: ${options.mode}`);
|
||||
model_1.Input.githubEnabled = false;
|
||||
switch (options.mode) {
|
||||
case 'cli':
|
||||
runCli();
|
||||
|
|
@ -2472,56 +2472,8 @@ class BuildStep {
|
|||
chmod -R +x "/entrypoint.sh"
|
||||
chmod -R +x "/steps"
|
||||
/entrypoint.sh
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "${cloud_runner_state_1.CloudRunnerState.buildPathFull}"
|
||||
${process.env.DEBUG ? '' : '#'}ls -lh "/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}"
|
||||
`,
|
||||
], `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}`, `/${cloud_runner_state_1.CloudRunnerState.projectPathFull}`, environmentVariables, secrets);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.BuildStep = BuildStep;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 6400:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
||||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
||||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.CompressionStep = void 0;
|
||||
const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
||||
const cloud_runner_state_1 = __webpack_require__(70912);
|
||||
class CompressionStep {
|
||||
run(cloudRunnerStepState) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
yield CompressionStep.CompressionStep(cloudRunnerStepState.environment, cloudRunnerStepState.secrets);
|
||||
});
|
||||
}
|
||||
static CompressionStep(environmentVariables, secrets) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
cloud_runner_logger_1.default.logLine('Starting step 3/4 build compression');
|
||||
// Cleanup
|
||||
yield cloud_runner_state_1.CloudRunnerState.CloudRunnerProviderPlatform.runBuildTask(cloud_runner_state_1.CloudRunnerState.buildGuid, 'alpine', [
|
||||
`
|
||||
apk update -q
|
||||
apk add zip tree -q
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "$repoPathFull"
|
||||
${process.env.DEBUG ? '' : '#'}ls -lh "$repoPathFull"
|
||||
cd "$libraryFolderFull/.."
|
||||
zip -r "lib-$BUILDID.zip" "./Library"
|
||||
mv "lib-$BUILDID.zip" "/$cacheFolderFull/lib"
|
||||
|
|
@ -2529,29 +2481,12 @@ class CompressionStep {
|
|||
ls -lh "$repoPathFull"
|
||||
zip -r "build-$BUILDID.zip" "./${cloud_runner_state_1.CloudRunnerState.buildParams.buildPath}"
|
||||
mv "build-$BUILDID.zip" "/$cacheFolderFull/build-$BUILDID.zip"
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "/$cacheFolderFull"
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "/$cacheFolderFull/.."
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "$repoPathFull"
|
||||
${process.env.DEBUG ? '' : '#'}ls -lh "$repoPathFull"
|
||||
`,
|
||||
], `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}`, `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}`, [
|
||||
...environmentVariables,
|
||||
...[
|
||||
{
|
||||
name: 'cacheFolderFull',
|
||||
value: cloud_runner_state_1.CloudRunnerState.cacheFolderFull,
|
||||
},
|
||||
],
|
||||
], secrets);
|
||||
cloud_runner_logger_1.default.log('compression step complete');
|
||||
}
|
||||
catch (error) {
|
||||
throw error;
|
||||
}
|
||||
], `/${cloud_runner_state_1.CloudRunnerState.buildVolumeFolder}`, `/${cloud_runner_state_1.CloudRunnerState.projectPathFull}`, environmentVariables, secrets);
|
||||
});
|
||||
}
|
||||
}
|
||||
exports.CompressionStep = CompressionStep;
|
||||
exports.BuildStep = BuildStep;
|
||||
|
||||
|
||||
/***/ }),
|
||||
|
|
@ -2640,7 +2575,6 @@ const cloud_runner_logger_1 = __importDefault(__webpack_require__(22855));
|
|||
const cloud_runner_state_1 = __webpack_require__(70912);
|
||||
const cloud_runner_step_state_1 = __webpack_require__(64854);
|
||||
const build_step_1 = __webpack_require__(91491);
|
||||
const compression_step_1 = __webpack_require__(6400);
|
||||
const download_repository_step_1 = __webpack_require__(12929);
|
||||
const custom_workflow_1 = __webpack_require__(3786);
|
||||
class BuildAutomationWorkflow {
|
||||
|
|
@ -2666,8 +2600,6 @@ class BuildAutomationWorkflow {
|
|||
cloud_runner_logger_1.default.logWithTime('Pre build step(s) time');
|
||||
yield new build_step_1.BuildStep().run(new cloud_runner_step_state_1.CloudRunnerStepState(baseImage, cloud_runner_state_1.CloudRunnerState.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
|
||||
cloud_runner_logger_1.default.logWithTime('Build time');
|
||||
yield new compression_step_1.CompressionStep().run(new cloud_runner_step_state_1.CloudRunnerStepState('alpine', cloud_runner_state_1.CloudRunnerState.readBuildEnvironmentVariables(), cloud_runner_state_1.CloudRunnerState.defaultSecrets));
|
||||
cloud_runner_logger_1.default.logWithTime('Compression time');
|
||||
if (cloud_runner_state_1.CloudRunnerState.buildParams.postBuildSteps !== '') {
|
||||
yield custom_workflow_1.CustomWorkflow.runCustomJob(cloud_runner_state_1.CloudRunnerState.buildParams.postBuildSteps);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -40,7 +40,7 @@ async function runCli() {
|
|||
const baseImage = new ImageTag(buildParameter);
|
||||
await CloudRunner.run(buildParameter, baseImage.toString());
|
||||
}
|
||||
|
||||
Input.githubEnabled = false;
|
||||
const program = new Command();
|
||||
program.version('0.0.1');
|
||||
const properties = Object.getOwnPropertyNames(Input);
|
||||
|
|
@ -60,7 +60,6 @@ const options = program.opts();
|
|||
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`Entrypoint: ${options.mode}`);
|
||||
Input.githubEnabled = false;
|
||||
|
||||
switch (options.mode) {
|
||||
case 'cli':
|
||||
|
|
|
|||
|
|
@ -32,8 +32,15 @@ export class BuildStep implements StepInterface {
|
|||
chmod -R +x "/entrypoint.sh"
|
||||
chmod -R +x "/steps"
|
||||
/entrypoint.sh
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "${CloudRunnerState.buildPathFull}"
|
||||
${process.env.DEBUG ? '' : '#'}ls -lh "/${CloudRunnerState.buildVolumeFolder}"
|
||||
apk update -q
|
||||
apk add zip tree -q
|
||||
cd "$libraryFolderFull/.."
|
||||
zip -r "lib-$BUILDID.zip" "./Library"
|
||||
mv "lib-$BUILDID.zip" "/$cacheFolderFull/lib"
|
||||
cd "$repoPathFull"
|
||||
ls -lh "$repoPathFull"
|
||||
zip -r "build-$BUILDID.zip" "./${CloudRunnerState.buildParams.buildPath}"
|
||||
mv "build-$BUILDID.zip" "/$cacheFolderFull/build-$BUILDID.zip"
|
||||
`,
|
||||
],
|
||||
`/${CloudRunnerState.buildVolumeFolder}`,
|
||||
|
|
|
|||
|
|
@ -1,60 +0,0 @@
|
|||
import CloudRunnerEnvironmentVariable from '../services/cloud-runner-environment-variable';
|
||||
import CloudRunnerLogger from '../services/cloud-runner-logger';
|
||||
import CloudRunnerSecret from '../services/cloud-runner-secret';
|
||||
import { CloudRunnerState } from '../state/cloud-runner-state';
|
||||
import { CloudRunnerStepState } from '../state/cloud-runner-step-state';
|
||||
import { StepInterface } from './step-interface';
|
||||
|
||||
export class CompressionStep implements StepInterface {
|
||||
async run(cloudRunnerStepState: CloudRunnerStepState) {
|
||||
await CompressionStep.CompressionStep(cloudRunnerStepState.environment, cloudRunnerStepState.secrets);
|
||||
}
|
||||
|
||||
private static async CompressionStep(
|
||||
environmentVariables: CloudRunnerEnvironmentVariable[],
|
||||
secrets: CloudRunnerSecret[],
|
||||
) {
|
||||
try {
|
||||
CloudRunnerLogger.logLine('Starting step 3/4 build compression');
|
||||
// Cleanup
|
||||
await CloudRunnerState.CloudRunnerProviderPlatform.runBuildTask(
|
||||
CloudRunnerState.buildGuid,
|
||||
'alpine',
|
||||
[
|
||||
`
|
||||
apk update -q
|
||||
apk add zip tree -q
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "$repoPathFull"
|
||||
${process.env.DEBUG ? '' : '#'}ls -lh "$repoPathFull"
|
||||
cd "$libraryFolderFull/.."
|
||||
zip -r "lib-$BUILDID.zip" "./Library"
|
||||
mv "lib-$BUILDID.zip" "/$cacheFolderFull/lib"
|
||||
cd "$repoPathFull"
|
||||
ls -lh "$repoPathFull"
|
||||
zip -r "build-$BUILDID.zip" "./${CloudRunnerState.buildParams.buildPath}"
|
||||
mv "build-$BUILDID.zip" "/$cacheFolderFull/build-$BUILDID.zip"
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "/$cacheFolderFull"
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "/$cacheFolderFull/.."
|
||||
${process.env.DEBUG ? '' : '#'}tree -L 4 "$repoPathFull"
|
||||
${process.env.DEBUG ? '' : '#'}ls -lh "$repoPathFull"
|
||||
`,
|
||||
],
|
||||
`/${CloudRunnerState.buildVolumeFolder}`,
|
||||
`/${CloudRunnerState.buildVolumeFolder}`,
|
||||
[
|
||||
...environmentVariables,
|
||||
...[
|
||||
{
|
||||
name: 'cacheFolderFull',
|
||||
value: CloudRunnerState.cacheFolderFull,
|
||||
},
|
||||
],
|
||||
],
|
||||
secrets,
|
||||
);
|
||||
CloudRunnerLogger.log('compression step complete');
|
||||
} catch (error) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -2,7 +2,6 @@ import CloudRunnerLogger from '../services/cloud-runner-logger';
|
|||
import { CloudRunnerState } from '../state/cloud-runner-state';
|
||||
import { CloudRunnerStepState } from '../state/cloud-runner-step-state';
|
||||
import { BuildStep } from '../steps/build-step';
|
||||
import { CompressionStep } from '../steps/compression-step';
|
||||
import { DownloadRepositoryStep } from '../steps/download-repository-step';
|
||||
import { CustomWorkflow } from './custom-workflow';
|
||||
import { WorkflowInterface } from './workflow-interface';
|
||||
|
|
@ -42,15 +41,6 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
|||
);
|
||||
CloudRunnerLogger.logWithTime('Build time');
|
||||
|
||||
await new CompressionStep().run(
|
||||
new CloudRunnerStepState(
|
||||
'alpine',
|
||||
CloudRunnerState.readBuildEnvironmentVariables(),
|
||||
CloudRunnerState.defaultSecrets,
|
||||
),
|
||||
);
|
||||
CloudRunnerLogger.logWithTime('Compression time');
|
||||
|
||||
if (CloudRunnerState.buildParams.postBuildSteps !== '') {
|
||||
await CustomWorkflow.runCustomJob(CloudRunnerState.buildParams.postBuildSteps);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue