Skip to content

Commit

Permalink
Merge pull request #1762 from Accenture/bug/1761-validation-scripts-n…
Browse files Browse the repository at this point in the history
…ot-executed-correctly-for-deploy

bug/1761 fix validation rules for deploy and ensure they work on a clone
  • Loading branch information
JoernBerkefeld authored Oct 1, 2024
2 parents 6698388 + 233f45f commit 7542295
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion @types/lib/metadataTypes/Journey.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 1 addition & 5 deletions lib/metadataTypes/DataExtension.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,8 @@ class DataExtension extends MetadataType {
let filteredByPreDeploy = 0;
for (const metadataKey in metadataMap) {
try {
await this.validation('deploy', metadataMap[metadataKey], deployDir);
metadataMap[metadataKey] = await this.preDeployTasks(metadataMap[metadataKey]);
metadataMap[metadataKey] = await this.validation(
'deploy',
metadataMap[metadataKey],
deployDir
);
} catch (ex) {
// output error & remove from deploy list
Util.logger.error(
Expand Down
14 changes: 3 additions & 11 deletions lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -730,16 +730,11 @@ class MetadataType {
// preDeployTasks parsing
let deployableMetadata;
try {
await this.validation('deploy', metadataMap[metadataKey], deployDir);
deployableMetadata = await this.preDeployTasks(
metadataMap[metadataKey],
deployDir
);

deployableMetadata = await this.validation(
'deploy',
deployableMetadata,
deployDir
);
} catch (ex) {
// do this in case something went wrong during pre-deploy steps to ensure the total counter is correct
hasError = true;
Expand Down Expand Up @@ -1969,11 +1964,7 @@ class MetadataType {
filterCounter++;
continue;
}
results[originalKey] = await this.validation(
'retrieve',
results[originalKey],
retrieveDir
);
await this.validation('retrieve', results[originalKey], retrieveDir);

savedResults[originalKey] = await this.saveToDisk(
results,
Expand Down Expand Up @@ -2800,6 +2791,7 @@ class MetadataType {
* @returns {Promise.<MetadataTypeItem | CodeExtractItem>} Promise of a single metadata item
*/
static async validation(method, item, targetDir) {
item = structuredClone(item);
if (!this.properties.options?.validation?.[method]) {
return item;
}
Expand Down

0 comments on commit 7542295

Please sign in to comment.