stage('Deploy to Staging') { when { expression { env.BRANCH_NAME == 'master' } } steps { echo 'deploy to staging' createEnvironment('staging') } } stage('Create feature environment') { when { expression { env.BRANCH_NAME != 'master' } } steps { echo 'create custom environment' createEnvironment(env.BRANCH_NAME) } }