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

54-Skip deployment when deployment artifacts filter result is empty #64

Merged
merged 2 commits into from
May 27, 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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ packages/apexlink/coverage
packages/sfp-cli/oclif.manifest.json
packages/apexlink/tests/resources/core-crm/apexlink.json
packages/apexlink/tests/resources/feature-mgmt/apexlink.json
.nx
.nx
.idea/
21 changes: 16 additions & 5 deletions packages/sfp-cli/src/impl/deploy/DeployImpl.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import ArtifactFetcher, { Artifact } from '../../core/artifacts/ArtifactFetcher';
import SFPLogger, { COLOR_ERROR, COLOR_SUCCESS, FileLogger, Logger, LoggerLevel } from '@flxbl-io/sfp-logger';
import SFPLogger, { COLOR_ERROR, COLOR_SUCCESS, Logger, LoggerLevel } from '@flxbl-io/sfp-logger';
import { Stage } from '../Stage';
import ProjectConfig from '../../core/project/ProjectConfig';
import semver = require('semver');
Expand All @@ -25,7 +25,6 @@ import convertBuildNumDotDelimToHyphen from '../../core/utils/VersionNumberConve
import ReleaseConfigLoader from '../release/ReleaseConfigLoader';
import { Align, getMarkdownTable } from 'markdown-table-ts';
import FileOutputHandler from '../../outputs/FileOutputHandler';
import { ValidateProps } from '../validate/ValidateImpl';

const Table = require('cli-table');
const retry = require('async-retry');
Expand Down Expand Up @@ -81,7 +80,7 @@ export default class DeployImpl {
public async exec(): Promise<DeploymentResult> {
let deployed: PackageInfo[] = [];
let failed: PackageInfo[] = [];
let queue: SfpPackage[];
let queue: SfpPackage[] = [];
let packagesToPackageInfo: { [p: string]: PackageInfo };
try {
//Create Org
Expand All @@ -108,6 +107,18 @@ export default class DeployImpl {
this.props.logger
);

if (sfpPackages.length <= 0 && (this.props.releaseConfigPath || this.props.filterByProvidedArtifacts)) {
SFPLogger.log(`Skipping deployment, no artifacts found based on filters defined in ${this.props.releaseConfigPath ? ' release config' : '--artifacts parameter'}`,LoggerLevel.INFO, this.props.logger);
return {
scheduled: 0,
deployed: deployed,
failed: failed,
queue: queue,
packagesToPackageInfo: null,
error: null,
};
}

//Grab the latest projectConfig from Packages
let sfpPackageInquirer: SfpPackageInquirer = new SfpPackageInquirer(sfpPackages, this.props.logger);
let sfdxProjectConfig = sfpPackageInquirer.getLatestProjectConfig();
Expand All @@ -124,6 +135,7 @@ export default class DeployImpl {

queue = this.getPackagesToDeploy(sfdxProjectConfig, packagesToPackageInfo);


SFPLogger.log('queue:' + JSON.stringify(queue), LoggerLevel.TRACE, this.props.logger);

if (this.props.skipIfPackageInstalled) {
Expand Down Expand Up @@ -874,8 +886,7 @@ export default class DeployImpl {
else return true;
});

if (packagesToDeploy.length === 0) throw new Error(`No artifacts from project config to be deployed`);
else return packagesToDeploy;
return packagesToDeploy;
}
}

Expand Down
Loading