Easy diff with production and one click deploy

Issue #906 resolved
Matej Pinter created an issue

Hi Scott,

not sure if this is already available in IDEA or in plugin, but I cannot find full functionality. What I would like to have: when I work on sandbox, I often need to make small deploys to production or other partial sandbox for testing. For that I have to currently download code I want to change iwth migration tool and diff it with current code inside webstorm/IDEA. Is it possible to add option for sandbox orgs inside webstorm/IDEA to connect "project" with production/partial org(s) and to easily make diff with that other orgs? Also would be nice to use diff to move changes to this orgs and deploy with one-click?

Would this be possible? Would save us a lot of time, specially when just modifying lightning components and other org settings like fields, labels, objects,...

Also we are using ant scripts for migration tool and as far as I know IDEA/webstorm already support running ant scripts, would that do any help here?

Keep up the good work :)

Comments (5)

  1. Scott Wells repo owner

    Matej, first off, it's very nice to hear from you today! It's been quite a while. As for the request, while it's not one-click, you can use IC to perform a pretty easy diff against production and also to deploy to production, albeit with caveats.

    To diff against production make sure that your local project contains the metadata that you'd like to have in production, and make sure that you've configured an IC connection against your production org. The production org connection should not be configured for any project, though, as you want to carefully control when changes are made to that org. Likely obvious, but worth stating explicitly to minimize the chance of an "oops". Then start a Retrieve Metadata action and select either Project or Module for Contents and the production org connection for Connection. Click Retrieve for Merge and the production org metadata will be downloaded according to your project's configured metadata subscription into a temporary directory and opened for comparison against the local project metadata. You can easily see the delta between current production (left-hand side) and desired production (right-hand side). By default JetBrains' internal directory/file diff tools will be used. I personally find that configuring a third-party comparison tool like Beyond Compare, Araxis Merge, etc., provides much more control over how you visualize the differences.

    You can similarly deploy to production by using the Deploy All Metadata action and configuring the resulting Connection and Contents as described above. I wouldn't recommend using Deploy Modified Metadata against a different connection from the one configured for the project/module because that can confuse IC in terms of the last modified timestamp relationships between the local metadata files and the org metadata due to multiple orgs' timestamps being used. However, if you want to be very selective about what subset of metadata is deployed to the production org, you can change Contents to Custom and select the exact items you want to deploy into the production org. That selection is retained across deployments, but note that the connection will revert to the project's configured connection each time, again to prevent you from accidentally switching to the production org as the working org.

    As for other main caveat, there are limitations on what types of metadata changes that the Metadata API will allow you to deploy directly into production, and IC can't overcome those constraints.

    So it's not one-click, but it's pretty close.

    As for the alternative you mention, you can absolutely take your existing ant scripts and pull them into the IDE for integrated execution. You can even bind those to shortcut keys if you want. That may be a more controlled/better way to manage the deployment from within the IDE as it will be much more repeatable. I think you'll likely still find the ability to retrieve and diff production metadata against the local project useful to see the before and after of a push to production.

    I hope this helps. Let me know if anything I've said doesn't make sense, doesn't work the way I've described, or just leads to additional questions/thoughts.

  2. Matej Pinter reporter

    Ok, so if I understand correctly:

    1. right click on project - > configure application - > create new conenction to priduction org
    2. alt + shift + cmd + y -> select production connection at top -> retrieve for merge
    3. after download I get diff of current sandbox and production.
    4. move changes to left side (what I want to change on production) (or right side?) - now this code on hard drive will be modified production code?
    5. open deploy all metadata -> select production connection -> deploy
    6. again alt+shift+cmd+y -> change connection back to sandbox, retrieve and overwrite all production changes that were previously downloaded from production connection? I'm little confused how to get then back to old sandbox code. :) On paper it looks so easy.
  3. Scott Wells repo owner

    Ah, one important qualification. When the directory diff is displayed, you can really only move things left-to-right to effect changes. The left-hand side is a temporary directory with the server metadata and IC doesn't pick up any changes you make there and deploy them back to the server. The idea is that you compare the server to local, make sure that local looks how you want, and then deploy local to the server to update it. Then if you want to retrieve again you can verify that the server looks as intended/expected.

    Hopefully that helps, but let me know if not.

  4. Scott Wells repo owner

    Issue tracker grooming. The Compare With Server action should take care of the bulk of this, after which you only need to perform a deployoment. It's not one click, but it should be very few to accomomplish the goal.

  5. Log in to comment