DX project with multiple source roots does not deploy via UI the same as from the sfdx cli

Issue #2122 resolved
Jeff May created an issue

I am not even sure this is a problem you want to do something about but wanted to log it in case anyone else sees the same behavior.

I have a DX project with multiple source roots defined.

using sfdx cli: sfdx force:source:deploy --sourcepath root1 -u orgAlias works as expected and deploys all the components from the source root.

If I select the source root in the project tree and use IC->Deploy All Metadata, then select ‘context’, the correct items are shown as selected, but the deploy does not fully succeed.

There are 2 things that “might” be of interest:

  1. the toast shows the deploy was partial, but the IC panel for problems is empty. There is no information. The deployment is actually partially successful.
  2. it appears that page layouts (/layouts) are what gets hung up – but I haven’t been able to track down something more specific.

This is not a big deal, since using the cli was my ‘go to’ anyway and I just decided to try the UI ‘contextual deploy’ to see if it happened to work (it would not be the first time I think “no way IC handles that” only to find out Scott is way ahead of me thinking about useful features.)

Comments (8)

  1. Scott Wells repo owner

    Jeff, that sounds like a bug to me. I'd be curious to see a debug log for such a deployment to see what CLI command IC2 is running (should be against a temporary/generated subset package.xml file for just the selected contents) and what response it's getting from the CLI for that deployment.

  2. Jeff May reporter

    Attaching an abbreviated log (to protect the innocent). But here is what I learned:

    1. The UI builds a temp package.xml and runs:

    sfdx force:source:deploy -u test-s1x25hrcigzo@example.com -o -g -x /tmp/package-JMAY-package.xml -w 0 --json

    vs my manual CLI command:

    sfdx force:source:deploy --sourcepath root1 -u orgAlias

    2. The logs showed why the layouts are not deployed (valid reason), but it highlights a different symptom. Bear with me: I have the same layout in multiple source roots so I can have a ‘base’, then have a subsequent sourceRoot to add an incremental ‘extension’ The error on deployment from ‘base’ is referencing layout elements that exist only in the ‘extension’ sourceRoot. So, it appears that deploy using a generated package.xml at the project level either uses the ‘last found’ component of the specified name, or a random one. Instead of using the component in the sourceRoot where the deploy is being generated from.

  3. Scott Wells repo owner

    Well, the issue in the attached log is that it has created an empty package.xml file for the deployment:

    2022-06-02 13:34:36,143 [3899386]   FINE - #c.i.i.b.ForceComSfdxMetadataUtil - Created temporary package.xml file for selective deployment/retrieval:
    <?xml version="1.0" encoding="UTF-8"?>
    <Package xmlns="http://soap.sforce.com/2006/04/metadata">
        <version>54.0</version>
    </Package>
    

    Here's what I would have expected to see:

    2022-06-02 13:07:32,052 [1074461]   FINE - #c.i.i.b.ForceComBuilder - Processing 1 build selections for file 'C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/force-app/main/default/applications/Issue367.app-meta.xml' in module 'df17-with-manifest'.
    2022-06-02 13:07:32,052 [1074461]   FINE - #c.i.i.b.ForceComBuilder -   There is only one build selection. Trying to determine if it's for the parent or a single child.
    2022-06-02 13:07:32,052 [1074461]   FINE - #c.i.i.b.ForceComBuilder -     The build selection's metadata type is CustomApplication.
    2022-06-02 13:07:32,052 [1074461]   FINE - #c.i.i.b.ForceComBuilder -     Adding the entire document for this file.
    ...
    2022-06-02 13:07:32,069 [1074478]   FINE - #c.i.i.b.ForceComBuilder - Asked to build the following files for buildEventType=SAVE, bulkDeploy=true, forceDeploy=true: {file://C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/force-app/main/default/aura/MyNewAuraComponent, ...}.
    2022-06-02 13:07:37,997 [1080406]   FINE - #c.i.i.b.ForceComBuilder - Checking to see if C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/force-app/main/default/aura/MyNewAuraComponent is part of a static resource bundle in a separate source root.
    2022-06-02 13:07:37,997 [1080406]   FINE - #c.i.i.b.ForceComBuilder - Checking to see if C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/force-app/main/default/aura/MyNewAuraComponent is part of a Lightning bundle.
    2022-06-02 13:07:37,997 [1080406]   FINE - #c.i.i.b.ForceComBuilder -   It is. Adding all bundle contents for deployment.
    2022-06-02 13:07:37,997 [1080406]   FINE - #c.i.i.b.ForceComBuilder -   Adding file C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/force-app/main/default/aura/MyNewAuraComponent/MyNewAuraComponent.cmp.
    2022-06-02 13:07:37,997 [1080406]   FINE - #c.i.i.b.ForceComBuilder -   Adding file C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/force-app/main/default/aura/MyNewAuraComponent/MyNewAuraComponent.css.
    ...
    2022-06-02 13:07:38,013 [1080422]   FINE - #c.i.i.b.ForceComBuilder - This is for a source format module. Determining whether the metadata can be deployed via the native metadata API deployer.
    2022-06-02 13:07:38,013 [1080422]   FINE - #c.i.i.b.ForceComBuilder -   Build selection 'CustomApplication[Issue367]' cannot be deployed via the API. The CLI will be used.
    2022-06-02 13:07:38,013 [1080422]   FINE - #c.i.i.b.ForceComBuilder - Using sfdx force:source:deploy to deploy the requested files.
    2022-06-02 13:07:38,013 [1080422]   FINE - #c.i.i.b.ForceComSfdxMetadataDeployer - Clearing build failures for all files requested for deployment.
    2022-06-02 13:07:38,028 [1080437]   FINE - #c.i.i.b.ForceComSfdxMetadataDeployer - Deploying df17-with-manifest to demo
    2022-06-02 13:07:38,028 [1080437]   FINE - #c.i.i.b.ForceComSfdxMetadataDeployer - Using the Salesforce CLI to deploy the following files for module df17-with-manifest: { MyNewAuraComponent, shouldDeployOnSave, ... }.
    2022-06-02 13:07:38,043 [1080452]   INFO - #c.i.i.b.ForceComSfdxMetadataDeployer - Populating deployment directory C:/Users/Scott/AppData/Local/Temp/df17_with_manifest-demo-deploy4.
    2022-06-02 13:07:38,053 [1080462]   INFO - #c.i.i.u.IlluminatedCloudFileUtil -   Copied C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/sfdx-project.json => C:/Users/Scott/AppData/Local/Temp/df17_with_manifest-demo-deploy4/sfdx-project.json.
    2022-06-02 13:07:38,071 [1080480]   INFO - #c.i.i.u.IlluminatedCloudFileUtil -   Copied C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/manifest/package.xml => C:/Users/Scott/AppData/Local/Temp/df17_with_manifest-demo-deploy4/manifest/package.xml.
    2022-06-02 13:07:38,071 [1080480]   INFO - #c.i.i.u.IlluminatedCloudFileUtil -   Copied C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/force-app => C:/Users/Scott/AppData/Local/Temp/df17_with_manifest-demo-deploy4/force-app.
    2022-06-02 13:07:38,087 [1080496]   INFO - #c.i.i.u.IlluminatedCloudFileUtil -   Copied C:/Users/Scott/dev/projects/IlluminatedCloudTestProjects/df17-with-manifest/force-app/main/default/aura/MyNewAuraComponent => C:/Users/Scott/AppData/Local/Temp/df17_with_manifest-demo-deploy4/force-app/main/default/aura/MyNewAuraComponent.
    ...
    2022-06-02 13:07:38,302 [1080711]   FINE - #c.i.i.b.ForceComSfdxMetadataDeployer - Deploying df17-with-manifest to demo
    2022-06-02 13:07:38,302 [1080711]   FINE - #c.i.i.b.ForceComSfdxMetadataDeployer - Using sfdx force:source:deploy to deploy the following files for module 'df17-with-manifest' to connection 'demo': { MyNewAuraComponent, shouldDeployOnSave, ... }.
    2022-06-02 13:07:38,302 [1080711]   INFO - #c.i.i.b.ForceComSfdxMetadataDeployer - Package.xml file found at C:/Users/Scott/AppData/Local/Temp/df17_with_manifest-demo-deploy4/manifest/package.xml
    2022-06-02 13:07:38,302 [1080711]   FINE - #c.i.i.b.ForceComSfdxMetadataDeployer - Attempting to create a temporary package.xml file for selective deployment.
    2022-06-02 13:07:38,327 [1080736]   FINE - #c.i.i.b.ForceComSfdxMetadataUtil - Created temporary package.xml file for selective deployment/retrieval:
    <?xml version="1.0" encoding="UTF-8"?>
    <Package xmlns="http://soap.sforce.com/2006/04/metadata">
        <types>
            <members>FileList</members>
            <members>TypeAheadField</members>
            ...
            <name>ApexComponent</name>
        </types>
        <types>
            <members>expenseList</members>
            <members>expenseTracker</members>
            ...
            <name>AuraDefinitionBundle</name>
        </types>
        <types>
            <members>Shopping</members>
            ...
            <name>CustomApplication</name>
        </types>
        <version>53.0</version>
    </Package>
    

    Is there more of that log above the portion you provided? Feel free to email it to me if you'd prefer that over attaching it here.

    Also, is the subset of metadata that you selected for contextual deployment under a configured source root? If you're not sure how to answer that, please either attach or email your project's .iml file and let me know the project-relative path of the root directory you've selected for deployment.

  4. Jeff May reporter

    sorry, Scott – the package.xml was accurate and complete. I removed the entries since they were all client-sensitive names.

    Yes, the source roots are configured, and a default is set (which is different from the root I was deploying and also different from the root where the layout component was actually located to be deployed.

  5. Scott Wells repo owner

    Okay. Then what I'd need to see is the response from the force:org:deploy command that IC2 executed to understand why that valid package.xml-based deployment didn't result in the expected behavior. Again, feel free to email rather than attach if that portion of the log contains sensitive info.

  6. Scott Wells repo owner

    Issue tracker grooming. If this is still an issue, please feel free to reopen, ideally with a concrete reproduction scenario.

  7. Log in to comment