sfmc-devtools icon indicating copy to clipboard operation
sfmc-devtools copied to clipboard

[FEATURE] block deployment if metadata was changed on target compared to current git version / CSCLSROZ-172

Open JoernBerkefeld opened this issue 2 years ago • 0 comments

limit to deploy only


Uwe: PM Is that the right way to go? In Salesforce classic, we do not do this. We allow deployments (and overwriting changes done manually in the BUs) because that will replace the manual changes with those in Git.

I understand the idea here, but the solution should be to restrict write access directly to the BU...

Can we clarify this please?


Uwe: Ok, after todays discussion I would suggest the following:

we build a compareBUWithBranch command in catalyst., which retrieves all BUs into a temporary folder compares the result with import * as dirCompare from 'dir-compare'; ...

    const options = { compareSize: false,
                      ignoreLineEnding: true };
    const result: dirCompare.Result = dirCompare.compareSync(rootPath, outputPath, options);

    let resultText: string = "";
    const diffs: number = result.differences - result.right - result.left;
    const summary: string = messages.getMessage('comparePathes_diff_summary', [result.right,
                                                                               result.left,
                                                                               diffs]);
    resultText += summary;
    resultText += "\n";

    result.diffSet.forEach(dif => {
        if ( ( "equal" !== dif.state) && (("file" === dif.type1) || ("file" === dif.type2)) ){
            if ( 0 < resultText.length ) {
                resultText += "\n";
            }
            const relativePath: string = (null != dif.name1) ? path.join(dif.relativePath, dif.name1) : path.join(dif.relativePath, dif.name2);
            const changeText: string =  ("missing" === dif.type1) ? "added in org" : ("missing" === dif.type2) ? "removed in org" : "changed in org";
            resultText += messages.getMessage('comparePathes_diff_detail', [relativePath,
                                                                     changeText]);
        }
    });
    fs.writeFileSync(toFile, resultText, {encoding: "utf8"});

Uwe: Retrieving in a temporary folder has the advantage that comparing works well for developers. If the retrieve result would be the normal repository retrieve folder, it must be deleted, and Git history must be used to get differences. But the developer would normaly like to avoid his retrieve folder as it might contain changes.

JoernBerkefeld avatar Jul 30 '21 13:07 JoernBerkefeld