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

Allow credentials binding in options block

XMLWordPrintable

      Would be nice if credentials could be used within the `Options { }` block.

      Currently this is not possible:

       

          options {
              timestamps()
              timeout(time: 15, unit: 'MINUTES')
              disableConcurrentBuilds()
              withCredentials([string(credentialsId: 'thc-wh-teams-notify', variable: "WH_URL")]) {
                  office365ConnectorWebhooks([
                      [name: "Office 365",
                      url: ${WH_URL},
                      notifyBackToNormal: false,
                      notifyFailure: true,
                      notifyRepeatedFailure: false,
                      notifySuccess: false,
                      notifyAborted: true]
                  ])
              }
          }

      results in:
      org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
      WorkflowScript: 14: Options definitions cannot have blocks @ line 14, column 9.
      withCredentials([string(credentialsId: 'thc-wh-teams-notify', variable: "WH_URL")]) {
      ^

      1 error

            Unassigned Unassigned
            faandg Stefaan De Geyter
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: