Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-40898

Declarative should provide an easy way to disable/enable some steps in an PR context or not

XMLWordPrintable

      When writing a Jenkinsfile, if you have email notifications, or notifications in general, this probably does not make sense to send those when building a PR. Same goes for actual deployments or touching real environments by any mean.

      PR are reviewed through GitHub, have a build status there, and so on. So by default, sending emails to maintainers creates unnecessary noise.

      Maybe this be globally enabled/disabled by default though the new options block.

      Like:

      options {
         notifyOnChangeRequest = true // I would argue that we should be opinionated and put it with a default of false
      }
      

      And possibly be overridable per step, like:

      notOnChangeRequest { // PR on GitHub & Bitbucket, patchset on Gerrit, Review Request in ReviewBoard...
         sh "deploy-to-production.sh"
      }
      

      For when and usual stage deactivations:

      when {
          branch CHANGE_REQUEST
      }
      

      WDYT?

      Thanks!

            abayer Andrew Bayer
            batmat Baptiste Mathus
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: