move github checks within build workflow
parent
c6bdec539c
commit
83fb0b89da
|
|
@ -985,7 +985,6 @@ const local_1 = __importDefault(__nccwpck_require__(66575));
|
|||
const docker_1 = __importDefault(__nccwpck_require__(42802));
|
||||
const github_1 = __importDefault(__nccwpck_require__(83654));
|
||||
const shared_workspace_locking_1 = __importDefault(__nccwpck_require__(87562));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
class CloudRunner {
|
||||
static setup(buildParameters) {
|
||||
cloud_runner_logger_1.default.setup();
|
||||
|
|
@ -1031,9 +1030,6 @@ class CloudRunner {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
CloudRunner.setup(buildParameters);
|
||||
try {
|
||||
if (cloud_runner_options_1.default.githubChecksEnabled) {
|
||||
yield github_1.default.createGitHubCheck(cloud_runner_options_1.default.githubOwner, cloud_runner_options_1.default.githubRepoName, buildParameters.gitPrivateToken, 'test-check-name', buildParameters.gitSha, 'A check test', buildParameters.buildGuid);
|
||||
}
|
||||
if (buildParameters.retainWorkspace) {
|
||||
CloudRunner.lockedWorkspace = `${CloudRunner.retainedWorkspacePrefix}-${CloudRunner.buildParameters.buildGuid}`;
|
||||
const result = yield shared_workspace_locking_1.default.GetOrCreateLockedWorkspace(CloudRunner.lockedWorkspace, CloudRunner.buildParameters.buildGuid, CloudRunner.buildParameters);
|
||||
|
|
@ -3346,11 +3342,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||
const cloud_runner_logger_1 = __importDefault(__nccwpck_require__(22855));
|
||||
class KubernetesPods {
|
||||
static IsPodRunning(podName, namespace, kubeClient) {
|
||||
var _a, _b, _c;
|
||||
var _a, _b, _c, _d;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const pods = (yield kubeClient.listNamespacedPod(namespace)).body.items.filter((x) => { var _a; return podName === ((_a = x.metadata) === null || _a === void 0 ? void 0 : _a.name); });
|
||||
const running = pods.length > 0 && (((_a = pods[0].status) === null || _a === void 0 ? void 0 : _a.phase) === `Running` || ((_b = pods[0].status) === null || _b === void 0 ? void 0 : _b.phase) === `Pending`);
|
||||
const phase = ((_c = pods[0].status) === null || _c === void 0 ? void 0 : _c.phase) || 'undefined status';
|
||||
const phase = ((_d = (_c = pods[0]) === null || _c === void 0 ? void 0 : _c.status) === null || _d === void 0 ? void 0 : _d.phase) || 'undefined status';
|
||||
cloud_runner_logger_1.default.log(`Getting pod status: ${phase}`);
|
||||
return running;
|
||||
});
|
||||
|
|
@ -5723,6 +5719,7 @@ const path_1 = __importDefault(__nccwpck_require__(71017));
|
|||
const cloud_runner_1 = __importDefault(__nccwpck_require__(79144));
|
||||
const cloud_runner_options_1 = __importDefault(__nccwpck_require__(96552));
|
||||
const cloud_runner_custom_steps_1 = __nccwpck_require__(96455);
|
||||
const github_1 = __importDefault(__nccwpck_require__(83654));
|
||||
class BuildAutomationWorkflow {
|
||||
run(cloudRunnerStepState) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
|
|
@ -5738,6 +5735,9 @@ class BuildAutomationWorkflow {
|
|||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// TODO accept post and pre build steps as yaml files in the repo
|
||||
try {
|
||||
if (cloud_runner_options_1.default.githubChecksEnabled) {
|
||||
yield github_1.default.createGitHubCheck(cloud_runner_options_1.default.githubOwner, cloud_runner_options_1.default.githubRepoName, cloud_runner_1.default.buildParameters.gitPrivateToken, 'test-check-name', cloud_runner_1.default.buildParameters.gitSha, 'A check test', cloud_runner_1.default.buildParameters.buildGuid);
|
||||
}
|
||||
cloud_runner_logger_1.default.log(`Cloud Runner is running standard build automation`);
|
||||
let output = '';
|
||||
output += yield cloud_runner_custom_steps_1.CloudRunnerCustomSteps.RunPreBuildSteps(cloudRunnerStepState);
|
||||
|
|
@ -5754,9 +5754,15 @@ class BuildAutomationWorkflow {
|
|||
output += yield cloud_runner_custom_steps_1.CloudRunnerCustomSteps.RunPostBuildSteps(cloudRunnerStepState);
|
||||
cloud_runner_logger_1.default.logWithTime('Configurable post build step(s) time');
|
||||
cloud_runner_logger_1.default.log(`Cloud Runner finished running standard build automation`);
|
||||
if (cloud_runner_options_1.default.githubChecksEnabled) {
|
||||
yield github_1.default.updateGitHubCheck(cloud_runner_options_1.default.githubOwner, cloud_runner_options_1.default.githubRepoName, cloud_runner_1.default.buildParameters.gitPrivateToken, 'test-check-name', cloud_runner_1.default.buildParameters.gitSha, 'A check test', cloud_runner_1.default.buildParameters.buildGuid, '');
|
||||
}
|
||||
return output;
|
||||
}
|
||||
catch (error) {
|
||||
if (cloud_runner_options_1.default.githubChecksEnabled) {
|
||||
yield github_1.default.updateGitHubCheck(cloud_runner_options_1.default.githubOwner, cloud_runner_options_1.default.githubRepoName, cloud_runner_1.default.buildParameters.gitPrivateToken, 'test-check-name', cloud_runner_1.default.buildParameters.gitSha, 'A check test', cloud_runner_1.default.buildParameters.buildGuid, '');
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -15,7 +15,6 @@ import LocalCloudRunner from './providers/local';
|
|||
import LocalDockerCloudRunner from './providers/docker';
|
||||
import GitHub from '../github';
|
||||
import SharedWorkspaceLocking from './services/shared-workspace-locking';
|
||||
import CloudRunnerOptions from './cloud-runner-options';
|
||||
|
||||
class CloudRunner {
|
||||
public static Provider: ProviderInterface;
|
||||
|
|
@ -69,17 +68,6 @@ class CloudRunner {
|
|||
static async run(buildParameters: BuildParameters, baseImage: string) {
|
||||
CloudRunner.setup(buildParameters);
|
||||
try {
|
||||
if (CloudRunnerOptions.githubChecksEnabled) {
|
||||
await GitHub.createGitHubCheck(
|
||||
CloudRunnerOptions.githubOwner,
|
||||
CloudRunnerOptions.githubRepoName,
|
||||
buildParameters.gitPrivateToken,
|
||||
'test-check-name',
|
||||
buildParameters.gitSha,
|
||||
'A check test',
|
||||
buildParameters.buildGuid,
|
||||
);
|
||||
}
|
||||
if (buildParameters.retainWorkspace) {
|
||||
CloudRunner.lockedWorkspace = `${CloudRunner.retainedWorkspacePrefix}-${CloudRunner.buildParameters.buildGuid}`;
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ class KubernetesPods {
|
|||
public static async IsPodRunning(podName: string, namespace: string, kubeClient: CoreV1Api) {
|
||||
const pods = (await kubeClient.listNamespacedPod(namespace)).body.items.filter((x) => podName === x.metadata?.name);
|
||||
const running = pods.length > 0 && (pods[0].status?.phase === `Running` || pods[0].status?.phase === `Pending`);
|
||||
const phase = pods[0].status?.phase || 'undefined status';
|
||||
const phase = pods[0]?.status?.phase || 'undefined status';
|
||||
CloudRunnerLogger.log(`Getting pod status: ${phase}`);
|
||||
|
||||
return running;
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import path from 'path';
|
|||
import CloudRunner from '../cloud-runner';
|
||||
import CloudRunnerOptions from '../cloud-runner-options';
|
||||
import { CloudRunnerCustomSteps } from '../services/cloud-runner-custom-steps';
|
||||
import GitHub from '../../github';
|
||||
|
||||
export class BuildAutomationWorkflow implements WorkflowInterface {
|
||||
async run(cloudRunnerStepState: CloudRunnerStepState) {
|
||||
|
|
@ -21,6 +22,17 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
|||
private static async standardBuildAutomation(baseImage: any, cloudRunnerStepState: CloudRunnerStepState) {
|
||||
// TODO accept post and pre build steps as yaml files in the repo
|
||||
try {
|
||||
if (CloudRunnerOptions.githubChecksEnabled) {
|
||||
await GitHub.createGitHubCheck(
|
||||
CloudRunnerOptions.githubOwner,
|
||||
CloudRunnerOptions.githubRepoName,
|
||||
CloudRunner.buildParameters.gitPrivateToken,
|
||||
'test-check-name',
|
||||
CloudRunner.buildParameters.gitSha,
|
||||
'A check test',
|
||||
CloudRunner.buildParameters.buildGuid,
|
||||
);
|
||||
}
|
||||
CloudRunnerLogger.log(`Cloud Runner is running standard build automation`);
|
||||
|
||||
let output = '';
|
||||
|
|
@ -49,9 +61,33 @@ export class BuildAutomationWorkflow implements WorkflowInterface {
|
|||
CloudRunnerLogger.logWithTime('Configurable post build step(s) time');
|
||||
|
||||
CloudRunnerLogger.log(`Cloud Runner finished running standard build automation`);
|
||||
if (CloudRunnerOptions.githubChecksEnabled) {
|
||||
await GitHub.updateGitHubCheck(
|
||||
CloudRunnerOptions.githubOwner,
|
||||
CloudRunnerOptions.githubRepoName,
|
||||
CloudRunner.buildParameters.gitPrivateToken,
|
||||
'test-check-name',
|
||||
CloudRunner.buildParameters.gitSha,
|
||||
'A check test',
|
||||
CloudRunner.buildParameters.buildGuid,
|
||||
'',
|
||||
);
|
||||
}
|
||||
|
||||
return output;
|
||||
} catch (error) {
|
||||
if (CloudRunnerOptions.githubChecksEnabled) {
|
||||
await GitHub.updateGitHubCheck(
|
||||
CloudRunnerOptions.githubOwner,
|
||||
CloudRunnerOptions.githubRepoName,
|
||||
CloudRunner.buildParameters.gitPrivateToken,
|
||||
'test-check-name',
|
||||
CloudRunner.buildParameters.gitSha,
|
||||
'A check test',
|
||||
CloudRunner.buildParameters.buildGuid,
|
||||
'',
|
||||
);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue