Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improvement(pipelines), make a clear separation between build and snap pipelines #7789

Merged
merged 2 commits into from
Aug 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion scopes/component/isolator/isolator.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,9 @@ export class IsolatorMain {
let installLongProcessLogger: LongProcessLogger | undefined;
// Only show the log message in case we are going to install something
if (capsuleList && capsuleList.length && !opts.context?.aspects) {
installLongProcessLogger = this.logger.createLongProcessLogger('install packages in capsules');
installLongProcessLogger = this.logger.createLongProcessLogger(
`install packages in ${capsuleList.length} capsules`
);
}
if (installOptions.useNesting) {
await Promise.all(
Expand Down
2 changes: 1 addition & 1 deletion scopes/pipelines/builder/build.cmd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ specify the task-name (e.g. "TypescriptCompiler") or the task-aspect-id (e.g. te
`no components found to build. use "--unmodified" flag to build all components or specify the ids to build, otherwise, only new and modified components will be built`
);
}
this.logger.consoleSuccess(`found ${components.length} components to build`);

const envsExecutionResults = await this.builder.build(
components,
{
Expand Down
9 changes: 6 additions & 3 deletions scopes/pipelines/builder/builder.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { EnvsAspect, EnvsMain } from '@teambit/envs';
import { GraphqlAspect, GraphqlMain } from '@teambit/graphql';
import { Slot, SlotRegistry } from '@teambit/harmony';
import GlobalConfigAspect, { GlobalConfigMain } from '@teambit/global-config';
import { LoggerAspect, LoggerMain } from '@teambit/logger';
import { Logger, LoggerAspect, LoggerMain } from '@teambit/logger';
import AspectAspect from '@teambit/aspect';
import { ScopeAspect, ScopeMain } from '@teambit/scope';
import { Workspace, WorkspaceAspect } from '@teambit/workspace';
Expand Down Expand Up @@ -74,7 +74,8 @@ export class BuilderMain {
private globalConfig: GlobalConfigMain,
private buildTaskSlot: TaskSlot,
private tagTaskSlot: TaskSlot,
private snapTaskSlot: TaskSlot
private snapTaskSlot: TaskSlot,
private logger: Logger
) {}

private async storeArtifacts(tasksResults: TaskResults[]) {
Expand Down Expand Up @@ -309,6 +310,7 @@ export class BuilderMain {
capsulesBaseDir,
...(builderOptions || {}),
};
this.logger.consoleTitle(`Total ${components.length} components to build`);
const buildResult = await envs.runOnce(this.buildService, builderServiceOptions);
return buildResult;
}
Expand Down Expand Up @@ -456,7 +458,8 @@ export class BuilderMain {
globalConfig,
buildTaskSlot,
tagTaskSlot,
snapTaskSlot
snapTaskSlot,
logger
);
builder.registerBuildTasks([new BundleUiTask(ui, logger)]);
component.registerRoute([new BuilderRoute(builder, scope, logger)]);
Expand Down
11 changes: 6 additions & 5 deletions scopes/pipelines/builder/builder.service.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { CFG_CAPSULES_BUILD_COMPONENTS_BASE_DIR } from '@teambit/legacy/dist/constants';
import { EnvService, ExecutionContext, EnvDefinition, Env, EnvContext, ServiceTransformationMap } from '@teambit/envs';
import React from 'react';
import chalk from 'chalk';
import { uniq } from 'lodash';
import { ScopeMain } from '@teambit/scope';
import pMapSeries from 'p-map-series';
Expand Down Expand Up @@ -101,8 +102,8 @@ export class BuilderService implements EnvService<BuildServiceResults, string> {
);
tasksQueue.validate();
this.logger.info(`going to run tasks in the following order:\n${tasksQueue.toString()}`);
const envsStr = envs.map((env) => env.id).join(', ');
const title = `Running ${this.displayPipeName} pipeline using ${envs.length} environment(s) (${envsStr}), total ${tasksQueue.length} tasks`;
this.logger.console('\n'); // this is to make is clear separation between the various pipelines (build/snap/tag)
const title = `Running ${this.displayPipeName} pipeline using ${envs.length} environment(s), total ${tasksQueue.length} tasks`;
const longProcessLogger = this.logger.createLongProcessLogger(title, undefined, 'title');
const envsBuildContext: EnvsBuildContext = {};
const capsulesBaseDir = this.getComponentsCapsulesBaseDir();
Expand All @@ -124,9 +125,9 @@ export class BuilderService implements EnvService<BuildServiceResults, string> {
);
const capsuleNetwork = await this.isolator.isolateComponents(componentIds, isolateOptions);
capsuleNetwork._originalSeeders = originalSeedersOfThisEnv;
this.logger.console(
`generated graph for env "${executionContext.id}", originalSeedersOfThisEnv: ${originalSeedersOfThisEnv.length}, graphOfThisEnv: ${capsuleNetwork.seedersCapsules.length}, graph total: ${capsuleNetwork.graphCapsules.length}`
);
const msg = `building ${originalSeedersOfThisEnv.length} components of env "${executionContext.id}"`;
const extraDetails = `original seeders of this env: ${originalSeedersOfThisEnv.length}, graph of this env: ${capsuleNetwork.seedersCapsules.length}, graph total (include other envs): ${capsuleNetwork.graphCapsules.length}`;
this.logger.console(`${msg}. ${chalk.dim(extraDetails)}`);
const buildContext = Object.assign(executionContext, {
capsuleNetwork,
previousTasksResults: [],
Expand Down