UNPKG

@jin7942/ray

Version:

Lightweight CI/CD deployment tool powered by Docker and Git

53 lines (52 loc) 1.63 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.runRayPipeline = runRayPipeline; exports.runAllPipelines = runAllPipelines; const logger_1 = require("./utils/logger"); const progress_1 = require("./utils/progress"); const index_1 = require("./core/index"); /** * Runs the full CI/CD pipeline for a single project. * Internally converts Config into StepContext and executes all stages. * * @param config - The project configuration object */ async function runRayPipeline(config) { const ctx = (0, index_1.createContext)(config); const bar = new progress_1.ProgressBar(4); try { bar.step('Cloning repository...'); await (0, index_1.gitCloneRepo)(ctx); // bar.step('Building project...'); // await buildProject(ctx); bar.step('Building Docker image...'); await (0, index_1.dockerBuildImage)(ctx); bar.step('Deploying container...'); await (0, index_1.dockerDeployContainer)(ctx); bar.step('Deployment completed.'); } catch (e) { // bar.fail('Deployment failed.'); if (e instanceof Error) { logger_1.logger.error(e); } else { logger_1.logger.error(String(e)); } } } /** * Runs the full pipeline for multiple projects sequentially. * * @param configs - Array of project configurations */ async function runAllPipelines(configs) { for (const config of configs) { try { await runRayPipeline(config); } catch (err) { console.error(`[FAIL] ${config.name}`); } } }