Continuous Integration in Salesforce using Salesforce DX
Among the several announcements during the 2016 Dreamforce Conference was a pilot programme promising a new developer experience that would radically change the way Salesforce apps are developed.
While most developers are aware of best practices and efficient ways of doing things, infrastructure, time, resources, availability to tools and other constraints may force them to work with what is easily and readily available. Salesforce DX, the new tool on the block, offers an integrated, end-to-end development lifecycle, allowing developers to break free from legacy trappings and indulge in high-performance agile development. Agile, until now an upgrade from the norm, becomes the default, bringing with it new levels of productivity, collaboration, and control.
Salesforce DX offers the unique combination of an end-to-end, integrated ecosystem, yet with a choice of open and flexible tools. The ecosytem, while offering an out-of-the-box solution (including the new scratch org, a new environment hub, new APIs, and a powerful new command line interface), also continues to offer several familiar tools.
Salesforce DX allows the developer to build with some of their favourite tools, including Git, Eclipse, Selenium, and Sublime. The integration of an updated Eclipse integrated development environment (IDE) significantly enhances the value of the toolset to developers.
The big thing in Salesforce DX is Scratch org, the new development environment facilitating source-driven and disposable deployment of Salesforce code and meta-data.
- Salesforce developers currently develop and test their apps using Developer Editions or Developer Sandbox. Scratch orgs offers an upgrade from these environments in the sense it is fully configurable, enabling developers to deploy different features and preferences for different editions.
- Scratch Orgs also bring about a fundamental change in the approach towards developer and test environments. Normally, a developer creates a developer edition when needed, and after the need is over, often in a single use, discards it. These environments add up, and before anyone knows it, any developer worth her byte would have a minimum of 100 Developer Editions, possibly more. Scratch orgs, created easily using a straightforward JSON descriptor file, can be kept and maintained in source control and destroyed just as easily. These files are essentially temporary in nature.
- Scratch orgs do not replace sandboxes, and offer a quicker, and more disposable way of setting up sandbox configuration. The new packages, built directly from source using the new Scratch org source-driven development process, are sent to the sandbox.
- Scratch org may be built quickly from source and metadata and users may build the app over and over again in a consistent manner. Scratch org externalizes more of the metadata, shifting the core of the app from Salesforce org to a version control system. This is a marked difference from the legacy practice of retaining apps within the Salesforce ecosystem. Source-driven development approach has been the standard practice of developers over the years, and it now becomes part of the Salesforce developer experience.
Overall, Scratch org delivers improved productivity, more intense test automation, and deeper collaboration.
New Environment Hub:
Salesforce DX offers a new Environment Hub, similar to the list of Sandboxes in setup, but with the added functionality of allowing the developer or admin to track all the orgs under use. The org in which Environment Hub is enabled becomes the central management point for other orgs, with users in that org getting permission to create, delete, and manage orgs. The licenses for development and testing orgs are also linked to the environment hub.
Salesforce DX also offers new APIs to integrate Environment Hub and Scratch Orgs into workflows easily.
The new architectural features on offer allow orgs to track changes. Changes to the org such as a new object or field are automatically recognized, and new metadata may be added to the local workspace with a simple command.
Another big feature of Source DX is the enabling of source-driven deployment. Developers may now plug into third-party test and build automation tools, such as Heroku Flow, or even a home-grown solution, and work seamlessly.
Heroku, the cloud-based Platform as a service (PaaS) allows developers to build and deliver apps at scale, bypassing traditional infrastructure headaches. Many teams leverage Continuous Delivery (CD) to streamline their app release process, and Heroku Flow offers a new, flexible way for development teams to structure, support, and visualize CD for Heroku apps, across the entire lifecycle from development to production.
Salesforce DX’s seamless integration with Heroku Flow offers developers the convenience of pipelines to streamline the development process. “Pipelines” groups together apps sharing the same codebase, and offer a clear and structured workflow. There is also seamless sync with GitHub to automate the deployment of repositories, and automatic creation of review apps which may be disposed of after the need is over.
A New Command Line Interface:
A new Command Line Interface (CLI), built on the Heroku CLI, offers developers a quick and easy way to create development and testing environments, create new search orgs, synchronize source code, push and pull metadata into the org, create and execute test suites, and control the full application lifecycle.
The earlier command line interfaces in Salesforce was processed on a number of different tools such as Salesforce workbench and Force.com CLI, posting some limitations. This new CLI becomes the principal way through which developers interact with the org. It runs across the entire Salesforce platform, offering developers the ability to access all Salesforce APIs through a single interface, in a simple declarative way.
Salesforce DX moves away from the traditional concept of changesets by reimaging packaging for apps differently. ISV partners and enterprise customers can now build multiple artefacts to streamline the packaging, deployment, and maintenance of custom software built on the Salesforce platform.
Salesforce DX facilitates high-performance agile development through continuous integration. The features available, and the benefits on offer as of now, are just the tip of the iceberg. Salesforce DX is far from being a finished product, and several new developments are on the anvil. For instance, making the process of syncing local source to org source more straightforward is under works and set to be released soon. Again, while the present focus is on offering a foundation for good project lifecycle management, better point-and-click tools that give admins and declarative developers a frictionless and intuitive process can also be expected in the near future.
It is interesting times ahead, and developers can expect a spate of high-profile announcements at Dreamforce 2017.