Skip to content
This repository was archived by the owner on Mar 18, 2024. It is now read-only.

Commit c55b367

Browse files
author
azlam-abdulsalam
committed
feat(validate): ⚗️ add installDeps to validate in fast feedback mode
This is an experimental addition to check whether installDeps make sense to be reintroduced to fast feedback. If this flag is activated, the external dependencies get installed
1 parent 0df8d78 commit c55b367

File tree

6 files changed

+41
-2
lines changed

6 files changed

+41
-2
lines changed

packages/sfpowerscripts-cli/messages/validate.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"disableArtifactUpdateFlagDescription": "Do not update information about deployed artifacts to the org",
2020
"fastfeedbackFlagDescription": "Enable validation in fast feedback mode, In fast feedback mode, validation will only do selective deployment of and selective tests",
2121
"orgInfoFlagDescription": "Display info about the org that is used for validation",
22+
"installDepsFlagDescription":"Install dependencies during fast feedback",
2223
"disableSourcePackageOverride": "Disables overriding unlocked package installation as source package installation during validate",
2324
"disableParallelTestingFlagDescription": "Disable test execution in parallel, this will execute apex tests in serial"
2425

packages/sfpowerscripts-cli/messages/validateAgainstOrg.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@
1111
"devhubAliasFlagDescription": "Provide the alias of the devhub previously authenticated, used for installing or updating dependency in individual/thorough modes",
1212
"disableSourcePackageOverride": "Disables overriding unlocked package installation as source package installation during validate",
1313
"disableParallelTestingFlagDescription": "Disable test execution in parallel, this will execute apex tests in serial",
14+
"installDepsFlagDescription":"Install dependencies during fast feedback",
1415
"orgInfoFlagDescription": "Display info about the org that is used for validation"
1516
}

packages/sfpowerscripts-cli/src/commands/orchestrator/validate.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export default class Validate extends SfpowerscriptsCommand {
3636
required: true,
3737
options: ['individual', 'fastfeedback', 'thorough', 'ff-release-config', 'thorough-release-config'],
3838
}),
39+
installdeps: flags.boolean({
40+
description: messages.getMessage('installDepsFlagDescription'),
41+
default: false,
42+
}),
3943
releaseconfig: flags.string({
4044
description: messages.getMessage('configFileFlagDescription'),
4145
}),
@@ -174,7 +178,8 @@ export default class Validate extends SfpowerscriptsCommand {
174178
disableArtifactCommit: this.flags.disableartifactupdate,
175179
orgInfo: this.flags.orginfo,
176180
disableSourcePackageOverride : this.flags.disablesourcepkgoverride,
177-
disableParallelTestExecution: this.flags.disableparalleltesting
181+
disableParallelTestExecution: this.flags.disableparalleltesting,
182+
installExternalDependencies: this.flags.installdeps,
178183
};
179184

180185
setReleaseConfigForReleaseBasedModes(this.flags.releaseconfig,validateProps);

packages/sfpowerscripts-cli/src/commands/orchestrator/validateAgainstOrg.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ export default class ValidateAgainstOrg extends SfpowerscriptsCommand {
5555
description: messages.getMessage('orgInfoFlagDescription'),
5656
default: false,
5757
}),
58+
installdeps: flags.boolean({
59+
description: messages.getMessage('installDepsFlagDescription'),
60+
default: false,
61+
}),
5862
devhubalias: flags.string({
5963
char: 'v',
6064
description: messages.getMessage('devhubAliasFlagDescription')
@@ -142,6 +146,7 @@ export default class ValidateAgainstOrg extends SfpowerscriptsCommand {
142146
disableSourcePackageOverride: this.flags.disablesourcepkgoverride,
143147
disableParallelTestExecution: this.flags.disableparalleltesting,
144148
orgInfo: this.flags.orginfo,
149+
installExternalDependencies: this.flags.installdeps,
145150
};
146151

147152

packages/sfpowerscripts-cli/src/impl/release/ReleaseConfig.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import ProjectConfig from '@dxatscale/sfpowerscripts.core/lib/project/ProjectCon
33
import Ajv, { _ } from 'ajv';
44
import ReleaseDefinitionGeneratorConfigSchema from './ReleaseDefinitionGeneratorConfigSchema';
55
import lodash = require('lodash');
6-
import yaml from 'js-yaml';
6+
const yaml = require('js-yaml');
77
import { Logger } from '@dxatscale/sfp-logger';
88
const path = require('path');
99

packages/sfpowerscripts-cli/src/impl/validate/ValidateImpl.ts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ export enum ValidationMode {
7676
}
7777

7878
export interface ValidateProps {
79+
installExternalDependencies?: boolean;
7980
validateAgainst: ValidateAgainst;
8081
validationMode: ValidationMode;
8182
releaseConfigPath?: string;
@@ -715,6 +716,19 @@ export default class ValidateImpl implements PostDeployHook, PreDeployHook {
715716
deployedPackages,
716717
);
717718
}
719+
else if (this.props.validationMode == ValidationMode.FASTFEEDBACK_LIMITED_BY_RELEASE_CONFIG
720+
|| this.props.validationMode == ValidationMode.FAST_FEEDBACK) {
721+
if(this.props.installExternalDependencies)
722+
await this.installPackageDependencies(
723+
ProjectConfig.cleanupMPDFromProjectDirectory(
724+
null,
725+
sfpPackage.package_name,
726+
),
727+
this.orgAsSFPOrg,
728+
sfpPackage,
729+
deployedPackages,
730+
);
731+
}
718732
break;
719733
case ValidateAgainst.PROVIDED_ORG:
720734
if (this.props.validationMode == ValidationMode.INDIVIDUAL) {
@@ -736,6 +750,19 @@ export default class ValidateImpl implements PostDeployHook, PreDeployHook {
736750
LoggerLevel.INFO,
737751
);
738752
}
753+
else if (this.props.validationMode == ValidationMode.FASTFEEDBACK_LIMITED_BY_RELEASE_CONFIG
754+
|| this.props.validationMode == ValidationMode.FAST_FEEDBACK) {
755+
if(this.props.installExternalDependencies)
756+
await this.installPackageDependencies(
757+
ProjectConfig.cleanupMPDFromProjectDirectory(
758+
null,
759+
sfpPackage.package_name,
760+
),
761+
this.orgAsSFPOrg,
762+
sfpPackage,
763+
deployedPackages,
764+
);
765+
}
739766
}
740767

741768
return { isToFailDeployment: false };

0 commit comments

Comments
 (0)