I am currently doing a POC for the Continuous Integration in Salesforce DX through Jenkins. My Jenkins Setup is such that the job-run creates an on-demand agent which executes the job and gets scraped off at the end. The job runs fine for me and executes the following stages defined in my Jenkinsfile: Clones the repo from bitbucket Creates a Scratch Org Push's code to the scratch org Runs some apex tests.

The problem is, when I login to the DevHub form my local CLI (Different from the Jenkins Server) and try to list the scratch org, it does not list the Scratch Org created through Jenkins although I can see them through the UI.

Am I missing something here? In my use case I would want the Salesforce Developer to be able to login and get inside the Scratch Org create by Jenkins and do the development work.

Have used the following sample Jenkinsfile for reference: https://developer.salesforce.com/docs/atlas.en-us.sfdx_dev.meta/sfdx_dev/sfdx_dev_ci_jenkins_code.htm

And, the sample source code used is: https://github.com/forcedotcom/sfdx-simple

Appreciate your help on this please

  • 1
    Why are you seeking to have a developer log in to a CI scratch org and do work there? That sounds like a pretty nonstandard usage of scratch orgs.
    – David Reed
    Oct 21, 2018 at 13:55

2 Answers 2


There is an exception to Nicolas's answer...all of the following have to be true:

Machine 1 is auth'd to the same dev hub as the same user via JWT flow (connected app, certificate, username on the devhub)

Any other machine can then authenticate to that same dev hub, and authenticate to any of its scratch orgs by username alone.

Wade Wegner published a great guide to this trick.


  • so, If I have this right - if machine 1 authorized to the dev hub using the web-based flow, machine 1 created a scratch org FOO; then machine 2, even if it authorizes to the dev hub using the JWT flow, an attempt to authorize FOO via the JWT flow will fail? (at least this is what I am observing)
    – cropredy
    Jul 9, 2020 at 0:44

Scratch orgs work for only one computer (or server). You can not use the same scratch org from different sfdx installations :(

If you need to automate scratch org creation for developers , you can do it by calling groovy code from .bat / .sh depending your developers work platform, we do that in our team and it works fine :)

You must log in to answer this question.

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