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

Commit

Permalink
fix(promote): skip packages which are already promoted
Browse files Browse the repository at this point in the history
  • Loading branch information
azlam-abdulsalam committed May 25, 2022
1 parent 420fd8f commit f96fb88
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions packages/sfpowerscripts-cli/src/impl/deploy/DeployImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,11 @@ export default class DeployImpl {
packagesToPackageInfo,
this.props.baselineOrg
);
SFPLogger.log('filtered queue:' + JSON.stringify(filteredDeploymentQueue), LoggerLevel.TRACE, this.props.packageLogger);
SFPLogger.log(
'filtered queue:' + JSON.stringify(filteredDeploymentQueue),
LoggerLevel.TRACE,
this.props.packageLogger
);
this.printArtifactVersionsWhenSkipped(queue, packagesToPackageInfo, isBaselinOrgModeActivated);
queue = filteredDeploymentQueue;
} else {
Expand Down Expand Up @@ -158,7 +162,12 @@ export default class DeployImpl {
let packageInstallationResult: PackageInstallationResult = await retry(
async (bail, count) => {
try {
await this.promotePackagesBeforeInstallation(packageInfo.sourceDirectory, sfpPackage);
try {
await this.promotePackagesBeforeInstallation(packageInfo.sourceDirectory, sfpPackage);
} catch (error) {
//skip packages already promoted
SFPLogger.log(`Package already prmomoted .. skipping`);
}

this.displayRetryHeader(this.props.isRetryOnFailure, count);

Expand Down Expand Up @@ -423,15 +432,17 @@ export default class DeployImpl {
packagesToPackageInfo: { [p: string]: PackageInfo },
targetUsername: string
): Promise<any[]> {

let targetOrg = await SFPOrg.create({ aliasOrUsername: targetUsername });

const clonedQueue = _.clone(queue);

for (let i = queue.length - 1; i >= 0; i--) {
let packageInfo = packagesToPackageInfo[clonedQueue[i].packageName];
let sfpPackage: SfpPackage = packageInfo.sfpPackage;
let pkgDescriptor = ProjectConfig.getPackageDescriptorFromConfig(clonedQueue[i].packageName, packageManifest);
let pkgDescriptor = ProjectConfig.getPackageDescriptorFromConfig(
clonedQueue[i].packageName,
packageManifest
);
let packageInstalledInTheOrg = await targetOrg.isArtifactInstalledInOrg(
this.props.packageLogger,
sfpPackage
Expand Down Expand Up @@ -582,7 +593,9 @@ export default class DeployImpl {
{
currentStage: this.props.currentStage,
},
sfpPackage.packageType == PackageType.Unlocked && installationOptions.isInstallingForValidation ? PackageType.Source:undefined //Override to source
sfpPackage.packageType == PackageType.Unlocked && installationOptions.isInstallingForValidation
? PackageType.Source
: undefined //Override to source
);
}

Expand Down

0 comments on commit f96fb88

Please sign in to comment.