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

Pipeline DSL has security exception if pipeline map defined outside of the method scope

XMLWordPrintable

      Even if security is disabled you'll get a SecurityException with the following code:

      class A {
        def context
        def p
        def A(ctx) {
          this.ctx = ctx
          this.p = [ "a": {this.a}]
        }
        def a() {
          ctx.echo "hi"
        }
        def b() {
          ctx.node("master") {
            ctx.parallel p
          }
        }
      }
      

      (new A(this)).b()

      However flattening the parallel as

       ctx.parallel ["a": {this.a}]
      

      is OK, as is making a local variable for the parallel mapping.  I believe this behavior changed with the recent update to Jenkins security.

            Unassigned Unassigned
            kbrowder Kevin Browder
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: