0

I am new to Salesforce and SFDX CLI.

I need to implement CI / CD for one of my client.

To start with basic I created Dev Org using Visual Studio Code and committed same to GitHub. Integrated SFDX CLI with Jenkins and configured JWT based authentication to Salesforce Dev Org by creating new Connected App. Authorized Salesforce org using JWT based authentication.

Now, whenever there is new commit to the repo I need to deploy it using Jenkins pipeline and for that I tried with below stage in Jenkins but got error

"stack": "ComponentSetError: No source-backed components present in the package.\n

stage('Push code to org') {
        steps {
            script {
                withCredentials([file(credentialsId: 'CREDENTIAL_ID_HERE', variable: 'VARIABLE_NAME_HERE')]) {
                rc = command "${toolbelt}/sfdx force:source:deploy --sourcepath=manifest -u username_here -w 180 -c --json"

                }
            }
        }
    }

Below is the snapshot from my VS Code

enter image description here

Can anyone help me on this or may be point me to documentation where I can explore more about Salesforce deployment and correct way to implement CI / CD using Jenkins, SFDX CLI and GitHub. I do not see enough documentation for Salesforce CI / CD implementation.

Update: Adding sfdx-project.json file content for reference.

    {
  "packageDirectories": [
    {
      "path": "force-app",
      "default": true
    }
  ],
  "name": "sfdx-demo",
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "54.0"
}

Thanks!

3
  • Could you edit the question to add the content of your sfdx-project.json file please.
    – Phil W
    Jun 22, 2022 at 7:40
  • Ok, I have updated my question with the content of sfdx-project.json file. Jun 22, 2022 at 8:04
  • As you are starting, you can try Salesforce DX with GitHub Actions for Continuous Integration (CI) as well.
    – Saroj Bera
    Jun 22, 2022 at 8:09

1 Answer 1

0

My recommendation is that you don't use developer orgs, but scratch orgs. They are ephemeral and more suitable for CI.

Also, GitHub actions are a great option, instead of using Jenkins. All trailheadapps sample apps have a CI flow implemented with GitHub actions and the Salesforce CLI that you can use as example. This is one of them. Basically what the flow does is:

  • Make sure the code is formatted correctly and there are no linting errors
  • Run LWC tests (locally)
  • Create a scratch org and deploy the code to it
  • Run Apex tests on the scratch org
  • Upload code coverage report for LWC and Apex
  • Create a package (optional)

You'll need a dev hub for creation of scratch orgs, and to store the auth url that allows you to connect to it in a GitHub secret.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .