Bootstrap method for DX scratch orgs

Issue #1603 new
Aidan Harding created an issue

When I start working on a scratch org in a DX project, I’d like to be able to push a button in Illuminated Cloud, and then forget about it until I get a notification later telling me that the scratch org and IDE are ready to go.

To me, this would mean starting the process by picking a scratch org definition file and then the rest being fully automated until a desktop notification tells me it’s done. In that time, I’d like to be able to use other IDE windows to work on something else.

My current process for this is to use the IDE, shell scripts, and manual steps to do the following:

  1. Create a scratch org and set it in the IDE module config
  2. Set the default dev hub and default username in DX
  3. Use a DX plugin to install all the dependency packages (I use https://github.com/ImJohnMDaniel/sfdx-toolbox-package-utils many others are available)
  4. Push the local source
  5. Rebuild the OST
  6. Maybe run some Apex script to do extra initialisation
  7. Maybe run sfdx force:data:tree:import to create some data
  8. Maybe run force:apex:test:run

Some specific problems with this:

  1. I can’t fully automate the IDE steps
  2. Illuminated Cloud wants to build the OST after I first create the scratch org, which I almost never want to do (I know, I can cancel it)
  3. Reloading the project after building the OST throws up an interrupting dialog when I’m doing something else. If I miss confirming that dialog, then project isn’t going to be ready for me when I come back
  4. When I get to the indexing operation later on, this stops all IDE windows from working

Essentially, I’d like to view the whole thing as a background operation that can run uninterrupted until it’s done, or let me know if a step failed. I’m not sure if all of that is possible with IntelliJ (e.g. not having indexing interrupt all windows) but even solving most of the above would be a big step forwards.

Comments (7)

  1. Scott Wells repo owner

    This seems closely related to #1475--or at least a subset of it is. That enhancement request asks for the ability to execute a user-identified post-scratch org creation script which would take care of steps 6-8. I also have existing enhancement requests for step 2 so that you can specify the default dev hub from IC and also, for a given project, when you select a scratch org as the connection, IC would automatically set that as the default scratch org for that project.

    I'll likely knock those existing items out as they're more broadly-applicable, then we can return to the other aspects of this workflow and see how things look.

  2. Aidan Harding reporter

    Thanks Scott.

    The overriding notion for me is to have some sort of guide-rail in the UI which helps someone who is familiar with DX but not necessarily muddied with all the scripty details.

    So a feature like running post-scratch org scripts would be great, but having that connected to a specific piece of UI which takes you through what you might want to do in a top-down fashion (I want to work on a package, here are the steps I might want to take) rather than bottom-up (I’ve got a bunch of features in the IC, which one can I leverage to work on my package) would add lots of value, IMO.

  3. Scott Wells repo owner

    Makes sense, Aidan. I'll chew on this a bit and when I come up with some ideas, I'll share them here for discussion. It may be a few weeks before I'm able to turn back to this as I have a pretty lengthy backlog of items right now.

  4. Aidan Harding reporter

    Hey Scott,

    Still wishing for this one!

    I had a recent thought on it… Would it be possible to expose some of the plugin functionality to IntelliJ’s CLI? I don’t know if that’s possible. But, a CLI exists: https://www.jetbrains.com/help/idea/working-with-the-ide-features-from-command-line.html

    I already have a terminal script to prep the scratch org and that works fairly reliably. If I could also configure my IC project and generate an OST, then I could have an entirely headless process to get my local project ready to run.

    I gather that more people are working with Unlocked Packaging these days, so it might be tipping towards being more worthwhile for you to support something in this area.

  5. Scott Wells repo owner

    Hey, Aidan. Right now I'm SUPER heads down on end-to-end support for Salesforce Functions. That should wrap up in the next week or two. Once it does I'll make sure this is on my queue, minimally to ponder a bit.

  6. Scott Wells repo owner

    There are a few of these types of enhancement requests that should be rationalized and merged as appropriate.

  7. Log in to comment