How to differentiate build triggers in Jenkins Pipeline

后端 未结 7 1609
挽巷
挽巷 2020-12-03 10:23

I\'m hoping to add a conditional stage to my Jenkinsfile that runs depending on how the build was triggered. Currently we are set up such that builds are either triggered by

相关标签:
7条回答
  • 2020-12-03 11:04

    The following code should works to determine if a user has started the pipeline or a timer/other trigger:

    def isStartedByUser = currentBuild.rawBuild.getCause(hudson.model.Cause$UserIdCause) != null
    
    0 讨论(0)
提交回复
热议问题