I have seen a multibranch example : https://devopscube.com/jenkins-multibranch-pipeline-tutorial/?unapproved=49471&moderation-hash=53d25ad46b16419cf56ed585dbf9d693#comment-49471
Why the jenkinsfile checkout only the main branch? I would expect that the relevant branch triggered (in the multibranch pipeline) would be checked out.
As described in the tutorial - if "feature" branch triggered by pull request - I would expect to checkout the 'feature' branch in the jenkinsfile