This pipeline succeeds:
This pipeline fails:
The reason this happens is that the agent inside a stage step does not do checkout scm automatically. This is very confusing behavior. Agent initialization should be consistent whether at top or inside a stage.
I would expect to do something like this to make an agent in a stage not do checkout: