I have a Jenkins script to generate a scratch org, make a user for that scratch org along with a password. When I try to deploy using that username and password I get
build/lib/deploy.xml:26: Invalid username, password, security token; or user locked out.
While running this command
deploy -Dsf.username=test-b1jpm0udc52d@example.com '-Dsf.password=hwmmA0dcpj^yz00D2D000000EJOg!AQwAQBkmxFalTKIXDeFfwAhEBIC3VCeKV8ebz9loGQF1WfjdUrAIEXjFALfDyF2qrI4aVxotSyBh8YgetMrAsQq7yqTxq0gv' -Dsf.namespace=TCADLL -Dsf.developerOrg=f
My assumption is that the token I'm using isn't actually the one needed to deploy, as the one I use for my dev org is much shorter.
The code to generate the scratch org, user, and password are here.
stage('Generate Test Scratch Org') {
rc = command "${sfdx} force:org:create --targetdevhubusername ${DEV_HUB_USRNM} --definitionfile ${SCRATCH_ORG_DEF} --setalias ${SCRATCH_ORG_ALIAS} --wait 10 --durationdays 1"
if (rc) {
error("Unable to create scratch org")
}
}
stage('Generate User for Scrach Org') {
rc = command "${sfdx} force:user:create --setalias ${SCRATCH_USR_ALIAS} --targetusername ${SCRATCH_ORG_ALIAS} --targetdevhubusername ${DEV_HUB_USRNM}"
if (rc) {
echo "Wasn't able to make user for scratch org"
TESTS_FAILED = true
}
}
stage('Generate Password for Scrach Org User') {
rc = command "${sfdx} force:user:password:generate --targetusername ${SCRATCH_ORG_ALIAS}"
if (rc) {
echo "Couldn't assign password to user"
TESTS_FAILED = true
}
}
stage('Ant deploy to org') {
details = sh returnStdout: true, script: "${sfdx} force:user:display --targetusername ${SCRATCH_ORG_ALIAS} --json"
def jsonSlurper = new JsonSlurperClassic()
def response = jsonSlurper.parseText(details)
rc = command "${ant} -f ${BUILD_PATH} deploy -Dsf.username=${response.result.username} -Dsf.password=${response.result.password}${response.result.accessToken} -Dsf.namespace=${NAMEASPACE} -Dsf.developerOrg=f"
if (rc) {
echo "Couldn't deploy to org"
TESTS_FAILED = true
}
}
If anyone has any suggestions on something I might've missed, or has a way to access the proper token I'd be thrilled to listen. I'm not using the sfdx:deploy or whatever function because our package isn't an SFDX project so it doesn't like the layout we have.