Khalil
Khalil

Reputation: 1

Scratch orgs failing to create with namespace in Azure DevOps (ADO) Pipeline

My team uses CCI for our SFDLC in combination with Azure DevOps for hosting our code, running pipelines, and more. One of the biggest challenges we've had with this combination is getting scratch orgs to create in our pipeline dedicated for test automation. We have a self-hosted agent that has all the software dependencies in place to use SFDX and CCI, with all commands working when remotely logged on to the agent, however, currently, scratch orgs are creating with errors when we attempt to run deploy commands such as 'sf deploy' or 'cci flow run dev_org'. The logs are too long so attempting to view them in the 'Deploy Status' section of Setup in the org results in an error page from SF.

We believe the main issue is that the scratch orgs are creating without the namespace prefix in them.

This process has worked for us in the past, however, due to some maintenance updates that were made on the agent, we had several binaries change that were previously configured in a way that allowed for this process to run.

Does anyone have any experience with creating scratch orgs in this manner? Or, just with CCI + ADO pipelines in general? It appears to be a less-covered configuration from the research we've done to get some guidance on how to get the scratch org creation process back up and running.

For additional context, the need for creating scratch orgs on the agent is so that we may execute our automated tests (via the Robot Framework, which we use as part of the CCI package) to have a target environment to run our suite against. Also open to any other information on how others may have married these processes together with the CCI toolset + Robot Framework + ADO Pipelines 🙂.

Thank you so much!

Tried creating scratch org using the following CCI commands:

cci org scratch dev QATest
cci org default QATest
cci org browser
cci flow run dev_org

Result: Scratch org created successfully, however, the deployment failed. Upon additional review, the scratch org was created without the expected namespace prefix.

Tried creating scratch org using the following SF CLI commands:

sf org create scratch --edition developer --alias QATest --target-dev-hub isv-dev-hub
sf project deploy start --ignore-conflicts

Result: Scratch org created successfully, however, the deployment failed. Upon additional review, the scratch org was created without the expected namespace prefix.

Upvotes: -1

Views: 41

Answers (1)

Bright Ran-MSFT
Bright Ran-MSFT

Reputation: 13534

At first, you should login the self-hosted agent machine using a user account and password, then manually execute the related commands to create the scratch org and run the deployment. Ensure all the processes can work as expected. If there are errors occurs when you manually execute theses commands, it is not possible to guarantee the processes can work in pipeline.

After successfully executing the processes by manual on the self-hosted agent machine, you can do like as below:

  1. Set up a new self-hosted agent on the machine. Use the username and password of the login user to set the authentication of the agent, so that the agent can login the machine with the credential of this user.

  2. Use the new self-hosted agent to run the pipeline. In the pipeline, execute the same commands with the same parameters/arguments as that you manually execute on the agent machine.

Upvotes: 0

Related Questions