I've got a bitbucket pipeline which creates a new scratch org with the following config and then immediately deploys the source into the scratch org.
{
"orgName": "MyOrg",
"edition": "Developer",
"features": [
"Communities",
"Sites",
"PersonAccounts",
"SiteDotCom",
"ContactsToMultipleAccounts",
"ProcessBuilder",
"ServiceCloud",
"Knowledge",
"Entitlements",
"LightningServiceConsole"
],
"settings": {
"orgPreferenceSettings": {
"s1DesktopEnabled": true,
"networksEnabled": true
},
"knowledgeSettings": {
"enableKnowledge": true
},
"entitlementSettings": {
"enableEntitlements": true
}
}
}
As part of the project there is also the site guest user profile with the adequate permissions etc. What I noticed was even though the initial deployment/push is successful (and lists all metadata including the site guest user profile), when I login to the scratch org the CRUD settings are missing on this profile (everything else is there, FLS for example). If I then checkout the branch on my local machine and just do another deploy/push, it updates the profile with the correct CRUD settings.
Initially, upon completion of the pipeline:
Followed by another (second) deploy/push from my local machine:
I tried using both push
and deploy
:
- sfdx force:source:push -u ${username} -f
- sfdx force:source:deploy -u ${username} -p force-app/main/default/
but getting the same results. Any ideas why could this be happening?
Update:
It turns out there's some sort of delay upon the initial deployment and not all profile settings are saved correctly. I assume this could be due to the site and domain being created and propagated. As a workaround I'm doing 2 separate deployments, one without the profile (initially), and then a subsequent one including the profile:
- mv force-app/main/default/profiles/guest\ Profile.profile-meta.xml .
- sfdx force:source:push -u ${username} -f
- mv guest\ Profile.profile-meta.xml force-app/main/default/profiles/
- sfdx force:source:push -u ${username} -f
Keen to get some insight into why can't everything be deployed at the same time.