forcedotcom / devops-center-feedback

61 stars 2 forks source link

Unable to promote WI content due to unsupported metadata type #249

Closed fprovot closed 1 year ago

fprovot commented 1 year ago

Describe the bug DEVOPS Promotion successfull, but missing metadata in the target org

To Reproduce Steps to reproduce the behavior:

  1. On a dev sandbox, create (or update) an opportunity sharing rule on criteria
  2. create a Work Item containing it
  3. promote the work item
  4. verify the target sandbox -> rule not created/updated while the promotion succeeded.

Expected behavior Sharing rule created or updated.

Analyse done

DEVOPS, to promote the WI, creates a package.xml file using sfdx commands. If there is a sharing rule in the list, it uses the subtype of the sharing type like "SharingCriteriaRule:Opportunity.PKG_SAL_ALL_ALL_RW_for_Parking_Users" which creates in the package.xml this content :

    <types>
        <members>Opportunity.PKG_SAL_ALL_ALL_RW_for_Parking_Users</members>
        <name>SharingCriteriaRule</name>
    </types>

_( command to create the package is visible in the sf_devopsAsync_Operation_Resultc table:
sfdx force:source:manifest:create --manifesttype=package -m "SharingCriteriaRule:Opportunity.PKG_SAL_ALL_ALL_RW_for_Parking_Users" )_

To debug, I created a package.xml file using this command, trying to deploy manualy the branch content to my sandbox. But then when deploying with this in vscode using sfdx command "deploy", the result is

An object 'Opportunity.PKG_SAL_ALL_ALL_RW_for_Parking_Users' of type SharingCriteriaRule was named in package.xml, but was not found in zipped directory

After a lot of tests, the solution I found is to use SharingRules keywork instead of SharingCriteriaRule AND to deploy all and not only one named rule.

sfdx force:source:manifest:create --manifesttype=package -m "SharingRules:*"

which generated this in package.xml

    <types>
        <members>*</members>
        <name>SharingRules</name>
    </types>

Then the update works on the sandbox.

So there is an issue with the promotion of sharing rules.

sfdx version sfdx-cli/7.182.1 win32-x64 node-v18.12.1

geomuck commented 1 year ago

Thank you for the detailed analysis @fprovot ! We'll create an Investigation and then probably a work item to try and address this in a future release.

andresrivas-sf commented 1 year ago

hey @fprovot,

I am trying to replicate this case, so I am following these steps:

From my Dev Env

This created me the following /path/to/my-package/sharingRules/Opportunity.sharingRules-meta.xml file with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<SharingRules xmlns="http://soap.sforce.com/2006/04/metadata">
    <sharingCriteriaRules>
        <fullName>my_sharing_rule</fullName>
        <accessLevel>Read</accessLevel>
        <label>my sharing rule</label>
        <sharedTo>
            <allInternalUsers></allInternalUsers>
        </sharedTo>
        <criteriaItems>
            <field>IsClosed</field>
            <operation>equals</operation>
            <value>True</value>
        </criteriaItems>
        <includeRecordsOwnedByAll>true</includeRecordsOwnedByAll>
    </sharingCriteriaRules>
</SharingRules>

From DevOps Center

From the Pipeline

From the Target Stage Environment

so I don't see any problem. Could you tell me specifically the steps you followed to try to replicate it?

fprovot commented 1 year ago

Hi Andres, So I have done a complete new test as you did, and, as on your side, the promotion succeeded and the sharing rule has been deployed in the target org ! I will try to investigate to find out what happened, if I have still enough information.

In the meantime I apologize for the time consumed on this if it indeed not a bug. I'll keep you informed. Best regards Frederic

andresrivas-sf commented 1 year ago

hi Frederic,

Absolutely no problem, I'm glad to have helped you.

we are going to close this issue, but if you have problems again feel free to post here again or create a new one with the details.

Regards, Andrés

fprovot commented 1 year ago

Finaly all I can say for sure is that sfdx force:source:deploy --manifest=package.xml doesn't work (for me) with object of type SharingCriteriaRule, with error

"An object 'Opportunity.TEST_OPP_SHARING_RULE' of type SharingCriteriaRule was named in package.xml, but was not found in zipped directory"

Package.xml used :

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>Opportunity.TEST_OPP_SHARING_RULE</members>
        <name>SharingCriteriaRule</name>
    </types>
    <version>56.0</version>
</Package>

I think this is not an issue for you and your team, but regarding the CLI. Can you transmit it to the correct team? Thanks

andresrivas-sf commented 1 year ago

hey @fprovot,

I opened this issue W-12386328 to the team owner