The following solution ensures the pipeline is aborted only if not on master:
def isMasterBuild = env.BRANCH_NAME == 'master' pipeline { agent any options { disableConcurrentBuilds(abortPrevious: !isMasterBuild) } }