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

How to pass when condition return value to variable

XMLWordPrintable

    • Icon: Story Story
    • Resolution: Not A Defect
    • Icon: Major Major
    • core
    • None
    • jenkins: Jenkins 2.235.5

      have a declarative pipeline job with nested conditions, if met the conditions , build script will execute, else stage will be skipped.

      when stage skipped, job result will be success at end and notifies to customer.
      How to skip notification  or notify as build is skipped, when stage skipped.

      { stage('build') {
      when {
      anyof

      { changeset "**/*.js" changeset "**/*.xml" triggeredBy cause: "UserIdCause" }

      }
      steps

      { build script ..... }

      }

      Out put:

      [Pipeline] stage
      [Pipeline] { (build)
      [Pipeline] echo
      Warning, empty changelog. Have you run checkout?
      [Pipeline] echo
      Warning, empty changelog. Have you run checkout?
      [Pipeline] echo
      Warning, empty changelog. Have you run checkout?
      [Pipeline] echo
      Warning, empty changelog. Have you run checkout?
      Stage "build" skipped due to when conditional

            Unassigned Unassigned
            harasai Harasai Kumar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: