Scratch org is not deleted if CI build fails
pozil opened this issue · 4 comments
Looking at the current GitHub action config and field experiments, scratch org are not deleted if CI build fails. If a job step fails, the remaining steps are not executed.
The workaround for this is to add an "always" condition to cleanup task like so:
# Housekeeping
- name: 'Delete scratch org'
if: always()
uses: forcedotcom/salesforcedx-actions@master
with:
args: 'force:org:delete -p -u scratch-org'
FYI @muenzpraeger this affects all sample apps.
That’s on purpose. Scratch orgs have per set up a validity of one day, so automatic cleanup is given.
Well that's not good cause it will crash the next build no?
If a build fails and the scratch org is left active, we can't create a scratch org with the same alias in the next build.
Also, I'm curious, are all sample apps using the same dev hub? If yes, we could have conflicts with the scratch-org
alias.
I don't understand why the only locally relevant (and for CI/CD in an ephemeral environment used) alias
should have any impact as you described.