0

I have a Jenkins job to deploy metadata to a given org. This is meant to be used as a first time setup method for new metadata. I have a jenkinsfile that can run the sfdx commands, and I'm trying to run force:auth:web:login.

agent none
            steps {
                script {
                    withEnv(["HOME=${env.WORKSPACE}", "MY_TOOL_DIR=${tool name: 'sfdx', type: 'com.cloudbees.jenkins.plugins.customtools.CustomTool'}"]){
                        def sfdx = "SFDX_USE_GENERIC_UNIX_KEYCHAIN=true ${MY_TOOL_DIR}/sfdx"
                        sh "${sfdx} force:auth:web:login --setalias deployOrg"
                        sh "${sfdx} force:mdapi:deploy -c -d ../MetadataFiles -u deployOrg -w 10"
                    }
                }

This runs, but it doesn't open up the prompt to do the actual login. I was trying to do this before with ant, which was running but was refusing to deploy customSite data. So I could do either or, I just have to fix one error or the other. Is there a way to authorize a regular org (not devhub) like with JWT flows, or is that fully impossible?

Any help is much appreciated.

1 Answers1

0

Is there a way to authorize a regular org (not devhub) like with JWT flows, or is that fully impossible?

Yes. The JWT Flow is in no way specific to Dev Hub orgs. You can authorize those orgs using JWT and a stored certificate following the instructions in the Salesforce DX Developer Guide.

David Reed
  • 2,522
  • 2
  • 16
  • 16
  • Oh that's good to know! I'd only used it with a CI/CD project before and all the resources had used the DevHub. I'm pretty sure the answer is no, but you can't automate the JWT authorization in a new org right? Like you can't give it the keyfile and such without logging in? – ConorMoore Nov 17 '21 at 20:00
  • No, the org has to be set up to permit that. – David Reed Nov 17 '21 at 20:05