1

I have an issue. I enabled DeferSharingCalc in scratch org def Then I performed: assigned proper PS to the user, and then ran Deploy permission set Assign permission set Push source to scratch org with sf project deploy start -o scratch-org to deploy all files to scratch.

Heres github workflow snippet:

  # Create scratch org
  - name: "Create scratch org"
    run: sf org create scratch --definition-file config/project-scratch-def.json -a scratch-org --duration-days 1
  
  # Get username and set as env variable
  - name: Get username and set as env variable
    run: |
      USERNAME=$(sfdx force:org:display -o scratch-org --json | jq -r '.result.username')
      echo "USERNAME=$USERNAME" >> "$GITHUB_ENV"
  
  - name: Display users
    run: |
      echo "User is ${{ env.USERNAME }}" 
  
  # Deploy permission set
  - name: Deploy permission set
    run: sf project deploy start -o scratch-org --metadata PermissionSet:ScratchOrgRelatedPermissions

  # Assign permission set
  - name: Assign Permission Set
    run: |
      echo env USER - ${{ env.USERNAME }} 
      sf org assign permset -n ScratchOrgRelatedPermissions --target-org ${{ env.USERNAME }}

  # Push source to scratch org
  - name: "Push source to scratch org"
    run: sf project deploy start -o scratch-org

  # Run Apex tests
  - name: "Run apex tests"
    run: sf apex run test -o scratch-org --synchronous --code-coverage

In 95% of cases, we encounter the error:

enter image description here

This is a randomly appearing error. We create 10 scratches (and delete them after each try) and perform all described procedures and on some days it works and on some days it does not. Any advice on how to resolve it? Sometimes it randomly throws an error with sharingRule too...

0

You must log in to answer this question.