Code Monkey home page Code Monkey logo

salesforce-dx-pipeline-sample's Introduction

salesforce-dx-pipeline-sample

This sample uses unlocked second generation packages (2GPs) to deploy project updates. If you're looking to perform metadata deploys instead, please use https://github.com/wadewegner/salesforce-dx-pipeline-mdapi-sample.

Using this sample app and the resources in this repo, you can setup a Heroku Pipeline to drive CI / CD for Salesforce DX. This sample uses the salesforce-dx-buildpack and the salesforce-cli-buildpack.

image

To use Heroku Pipelines with any Salesforce DX project, you only need to do two things:

  1. Create a app.json file.

  2. Create a sfdx.yml file.

That's it. Along with the setup.sh script you find in this repo, the buildpacks do the rest.

Setup

  1. Install the Heroku CLI.

  2. Install the Salesforce CLI.

  3. Log into the four orgs you'll use with the Salesforce CLI and give them aliases:

    • Dev Hub (e.g.. "HubOrg"): this will create scratch orgs for your Review Apps
    • Development Org (e.g. "DevOrg"): this is the first environment you'll update using a metadata deploy
    • Staging Org (e.g. "TestOrg"): this is the first environment from which you'll promote your code via release phase
    • Prod Org : "ProdOrg": this is your production org

    Note: you could cheat and, simply for demo purposes, use the same org for the DevOrg, TestOrg, and ProdOrg.

  4. Ensure you see all four orgs when you run sfdx force:org:list.

  5. Fork this repository.

  6. Clone the repository locally.

  7. Update the values in setup.sh accordingly (e.g. HEROKU_TEAM_NAME, HEROKU_APP_NAME, DEV_HUB_USERNAME, DEV_USERNAME, STAGING_USERNAME, PROD_USERNAME, GITHUB_REPO, and PACKAGE_NAME).

  8. Create an unlocked package:

sfdx force:package2:create -n PackageName - "My package yo" -o Unlocked -e
  1. Update the sfdx-project.json to use your package ID.

  2. Run ./setup.sh.

Unfortunately there's a bug in heroku pipelines:setup that prevents us from fully setting up the pipeline. To manually finish the setup, perform the following steps:

  1. Open your pipeline: heroku pipelines:open <YOURPIPELINENAME>

  2. Click Settings.

  3. Search for "salesforce-dx-pipeline-sample" and click Connect.

  4. Clic Pipelines.

  5. Click Enable Review Apps.... Check both boxes and click Enable.

  6. Under development, click the expansion button and then click Configure automatic deploys... Then click Enable Automatic Deploys.

Now you're all set.

Usage

To demo, simply submit a pull request. It's easiest to do through the Github UI. Simply edit a page, then instead of committing directly to the branch, create a pull request. Once created, the review app is ready to go. When the pull request is accepted, the review app is deleted and the application is deployed to your staging org.

If you want to work against the latest buildpacks, update the version # (or remove entirely).

Clean up

At any time you can run ./destroy.sh to delete your pipeline and apps.

salesforce-dx-pipeline-sample's People

Contributors

cwallsfdc avatar muenzpraeger avatar wadewegner avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.