I have project https://github.com/patope/jenkins-pipeline-test having two branches: master and direct. On 'direct' pipeline is defined in Jenkinsfile file and on master Jenkinsfile uses shared pipeline.
Shared pipeline is defined in https://github.com/patope/jenkins-pipeline-test-shared
On branch 'direct' stage 'Build 2' is skipped correctly.
On branch 'master' (using shared pipeline) stage 'Build 2' is executed.