SFDX: Deploy metadata option on source folders

Issue #1595 resolved
Justin Julicher created an issue

When creating scratch orgs I sometimes get a problem where sfdx won’t recognize that I have undeployed files locally so any push commands will fail.

Even using the IC Deploy All Metadata would fail.

I finally got around by running:

 sfdx force:source:deploy -p force-app/main/default/<Source Dir> -u <USERNAME>

Would it be possible to add this as a quick action on sfdx source directories?

Comments (7)

  1. Justin Julicher reporter

    Hi Scott, thanks I had been trying to do this on the objects folder but I continually got a ‘Label’ must not be empty when trying to deploy it.

    When I executed the command from the command line above it would deploy correctly, but when I tried deploying by clicking the ‘objects’ folder I got the following issue (even though the label was populated).

    59957]   INFO - r.ForceComSfdxMetadataDeployer - Deployment status = FAILED 
    ...
    2020-04-28 14:52:02,252 [ 159990]   WARN - openapi.wm.impl.ToolWindowImpl - ToolWindow icons should be 13x13. Please fix ToolWindow (ID:  Illuminated Cloud) or icon jar:file:/home/justin/.local/share/JetBrains/WebStorm2020.1/IlluminatedCloud2/lib/IlluminatedCloud.jar!/images/IlluminatedCloudLogo_16x16.png 
    2020-04-28 14:52:02,270 [ 160008]   WARN - r.ForceComSfdxMetadataDeployer -   Found ERROR for ApexClass classes/TestTimelineHelperUtils.cls: An unexpected error occurred. Please include this ErrorId if you contact support: 1902388212-8298 (-450987857) 
    2020-04-28 14:52:02,271 [ 160009]   INFO - r.ForceComSfdxMetadataDeployer -   Reporting error for /home/justin/WebstormProjects/cortex-rules/force-app/main/default/classes/TestTimelineHelperUtils.cls 
    2020-04-28 14:52:02,271 [ 160009]   WARN - r.ForceComSfdxMetadataDeployer -   Found ERROR for CustomObject objects/Action__mdt/Action__mdt.object-meta.xml: Must specify a non-empty label for the CustomObject 
    2020-04-28 14:52:02,272 [ 160010]   INFO - r.ForceComSfdxMetadataDeployer -   Reporting error for /home/justin/WebstormProjects/cortex-rules/force-app/main/default/objects/Action__mdt/Action__mdt.object-meta.xml 
    2020-04-28 14:52:02,272 [ 160010]   WARN - r.ForceComSfdxMetadataDeployer -   Found ERROR for CustomObject objects/Process__mdt/Process__mdt.object-meta.xml: Must specify a non-empty label for the CustomObject 
    2020-04-28 14:52:02,272 [ 160010]   INFO - r.ForceComSfdxMetadataDeployer -   Reporting error for /home/justin/WebstormProjects/cortex-rules/force-app/main/default/objects/Process__mdt/Process__mdt.object-meta.xml 
    2020-04-28 14:52:02,272 [ 160010]   WARN - r.ForceComSfdxMetadataDeployer -   Found ERROR for CustomObject objects/Rule__mdt/Rule__mdt.object-meta.xml: Must specify a non-empty label for the CustomObject 
    2020-04-28 14:52:02,272 [ 160010]   INFO - r.ForceComSfdxMetadataDeployer -   Reporting error for /home/justin/WebstormProjects/cortex-rules/force-app/main/default/objects/Rule__mdt/Rule__mdt.object-meta.xml 
    

    When I grabbed a screenshot of the IDE IC output I had to restart so I tried it again and now it seems to be working properly - although I had tried multiple times before after a full reboot of my laptop and it kept repeating this error.

    The main reason I wanted this is because when I keep trying to init a new scratch org sfdx isn’t picking up all the files and i have to do a manual deploy whicih was giving me the errors above using IC but I finally resolved it using the above command line.

    Do you know of any way to force the sfdx push command to push all metadata?

    thanks

  2. Scott Wells repo owner

    Justin, regarding the original error, I'd need to see a debug log of the deployment activity to see what might be going on. Also, can you verify that you were doing this on the latest build? I did fix an issue with deployment of certain types of custom field metadata in a source format project in 2.1.1.8 that could have been contributing, and perhaps the reason things worked after the restart is that you also updated?

    To my knowledge there's no way to tell force:source:push to deploy all metadata. You can manually remove the /path/to/project/.sfdx/orgs/<scratch-org-username> directory and it will try to deploy everything again on the next push, but it will still be an all-or-nothing deployment so any failures will cause a full rollback.

  3. Scott Wells repo owner

    Thanks for the logs. Can you reproduce this one more time and then also attach the temporary package.xml file that was used for the deployment? You can find it based on the following log entry:

    2020-04-30 08:08:27,787 [82367689]  DEBUG - r.ForceComSfdxMetadataDeployer - Created temporary package.xml file '/tmp/cortex_rules-rules-package.xml'. 
    

    It may not be at the exact same path when you do this again, so please consult the log and then attach the specific log.

  4. Log in to comment