From 533d932b4c02fd5bfbe651cda69a77b9fa20c9ce Mon Sep 17 00:00:00 2001 From: azlam-abdulsalam Date: Tue, 13 Feb 2024 10:36:13 +1100 Subject: [PATCH] fix(release): use releaseconfig name to seperate out changelog creation rather than all Use an indirection using release config instead of all artifacts to generate changelog --- .../sfp-cli/src/impl/artifacts/FetchImpl.ts | 9 ++++++ .../sfp-cli/src/impl/release/ReleaseImpl.ts | 30 ++++++++++++++----- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/packages/sfp-cli/src/impl/artifacts/FetchImpl.ts b/packages/sfp-cli/src/impl/artifacts/FetchImpl.ts index 2e77eed9d..c6ec486ee 100644 --- a/packages/sfp-cli/src/impl/artifacts/FetchImpl.ts +++ b/packages/sfp-cli/src/impl/artifacts/FetchImpl.ts @@ -40,10 +40,19 @@ export default class FetchImpl { for (const releaseDefinition of releaseDefinitions) { //Each release will be downloaded to specific subfolder inside the provided artifact directory //As each release is a collection of artifacts + let revisedArtifactDirectory = path.join( this.artifactDirectory, releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-') ); + if(releaseDefinition.releaseConfigName) + { + revisedArtifactDirectory = path.join( + this.artifactDirectory, + releaseDefinition.releaseConfigName.replace(/[/\\?%*:|"<>]/g, '-'), + releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-') + ); + } rimraf.sync(revisedArtifactDirectory); fs.mkdirpSync(revisedArtifactDirectory); diff --git a/packages/sfp-cli/src/impl/release/ReleaseImpl.ts b/packages/sfp-cli/src/impl/release/ReleaseImpl.ts index 076fb8552..0d2f49bd7 100644 --- a/packages/sfp-cli/src/impl/release/ReleaseImpl.ts +++ b/packages/sfp-cli/src/impl/release/ReleaseImpl.ts @@ -43,7 +43,11 @@ type DeploymentStatus = { result: DeploymentResult; }; + export default class ReleaseImpl { + + + constructor(private props: ReleaseProps, private logger?: Logger) {} public async exec(): Promise { @@ -118,7 +122,7 @@ export default class ReleaseImpl { try { let changelogImpl: ChangelogImpl = new ChangelogImpl( this.logger, - 'artifacts', + this.getArtifactDirectory(releaseDefinition), releaseName, workitemFilters, limit, @@ -235,15 +239,10 @@ export default class ReleaseImpl { this.displayReleaseInfo(releaseDefinition, this.props); - //Each release will be downloaded to specific subfolder inside the provided artifact directory - //As each release is a collection of artifacts - let revisedArtifactDirectory = path.join( - 'artifacts', - releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-') - ); + let deployProps: DeployProps = { targetUsername: this.props.targetOrg, - artifactDir: revisedArtifactDirectory, + artifactDir: this.getArtifactDirectory(releaseDefinition), waitTime: this.props.waitTime, tags: this.props.tags, isTestsToBeTriggered: false, @@ -407,6 +406,21 @@ export default class ReleaseImpl { SFPLogger.printHeaderLine('', COLOR_HEADER, LoggerLevel.INFO); } + + private getArtifactDirectory(releaseDefinition: ReleaseDefinition) { + let revisedArtifactDirectory = path.join( + 'artifacts', + releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-') + ); + if (releaseDefinition.releaseConfigName) { + revisedArtifactDirectory = path.join( + 'artifacts', + releaseDefinition.releaseConfigName.replace(/[/\\?%*:|"<>]/g, '-'), + releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-') + ); + } + return revisedArtifactDirectory; + } } interface InstallDependenciesResult {