1

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 '18 at 13:55
0

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 :)

0

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.

http://www.wadewegner.com/2018/01/jwt-oauth-with-scratch-orgs/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.