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

feat(prepare-c-flag): add noAnchestors option to config #9

Merged
merged 1 commit into from
Feb 6, 2024
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
6 changes: 6 additions & 0 deletions packages/sfp-cli/resources/schemas/pooldefinition.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,12 @@
"type": "boolean",
"default":false
},
"noAnchestors": {
"title": "Disable second-generation managed package (2GP) ancestors in the scratch org.",
"description": "Don't include second-generation managed package (2GP) ancestors in the scratch org when set to true",
"type": "boolean",
"default":false
},
"fetchArtifacts": {
"title": "Fetch Artifacts using below mechanism",
"description": "Fetch artifacts from artifact registry using below mechanism",
Expand Down
11 changes: 7 additions & 4 deletions packages/sfp-cli/src/core/scratchorg/ScratchOrgOperator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { ScratchOrgRequest } from '@salesforce/core';
import { COLOR_KEY_MESSAGE } from '@flxblio/sfp-logger';
import getFormattedTime from '../utils/GetFormattedTime';
import SFPStatsSender from '../stats/SFPStatsSender';
import { PoolConfig } from './pool/PoolConfig';
const retry = require('async-retry');

export default class ScratchOrgOperator {
Expand All @@ -16,7 +17,8 @@ export default class ScratchOrgOperator {
alias: string,
config_file_path: string,
expiry: number,
waitTime: number = 6
waitTime: number = 6,
poolConfig: Partial<PoolConfig>
): Promise<ScratchOrg> {
SFPLogger.log('Parameters: ' + alias + ' ' + config_file_path + ' ' + expiry + ' ', LoggerLevel.TRACE);

Expand All @@ -26,7 +28,8 @@ export default class ScratchOrgOperator {
alias,
config_file_path,
Duration.days(expiry),
Duration.minutes(waitTime)
Duration.minutes(waitTime),
poolConfig
);
SFPLogger.log(JSON.stringify(scatchOrgResult), LoggerLevel.TRACE);

Expand Down Expand Up @@ -81,11 +84,11 @@ export default class ScratchOrgOperator {
);
}

private async requestAScratchOrg(alias: string, definitionFile: string, expireIn: Duration, waitTime: Duration) {
private async requestAScratchOrg(alias: string, definitionFile: string, expireIn: Duration, waitTime: Duration, poolConfig: Partial<PoolConfig>) {
const createCommandOptions: ScratchOrgRequest = {
durationDays: expireIn.days,
nonamespace: false,
noancestors: false,
noancestors: poolConfig.noAnchestors || false,
wait: waitTime,
retry: 3,
definitionfile: definitionFile,
Expand Down
3 changes: 1 addition & 2 deletions packages/sfp-cli/src/core/scratchorg/pool/PoolConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,5 @@ export interface PoolConfig {
scratchOrgs?: ScratchOrg[];
failedToCreate?: number;
maxRetryCount?:number;


noAnchestors?:boolean;
}
4 changes: 2 additions & 2 deletions packages/sfp-cli/src/core/scratchorg/pool/PoolCreateImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export default class PoolCreateImpl extends PoolBaseImpl {
}
return ok(this.pool);


}

private async computeAllocation(): Promise<number> {
Expand Down Expand Up @@ -198,7 +198,7 @@ export default class PoolCreateImpl extends PoolBaseImpl {
const startTime = Date.now();
for (let i = 1; i <= pool.to_allocate; i++) {
const scratchOrgPromise: Promise<ScratchOrg> = scratchOrgCreationLimiter.schedule(() =>
scratchOrgOperator.create(`SO` + i, this.pool.configFilePath, this.pool.expiry, this.pool.waitTime)
scratchOrgOperator.create(`SO` + i, this.pool.configFilePath, this.pool.expiry, this.pool.waitTime, this.pool)
);
scratchOrgPromises.push(scratchOrgPromise);
}
Expand Down
Loading