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

No support for variables inside bitbucket block

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Duplicate
    • Component/s: job-dsl-plugin
    • Labels:
    • Environment:
      Platform: Openshift 3.11
      Docker image: jenkins/jenkins:2.222-slim
      Jenkins 2.222
      Job DSL 1.77
      Bitbucket Branch Source Plugin 2.7.0
    • Similar Issues:
    • Released As:

      Description

      I have a seed job with an input parameter named owner and want to pass its value into a Bitbucket Branch Source Plugin job like this:

      organizationFolder('${owner}') {
        organizations {
          bitbucket {
            serverUrl('https://git.mycompany.com')
            repoOwner('myproject')
            credentialsId('bitbucket-user')
          }
        }
      }

      The script above works. Then I replace myproject with ${owner} and I get this error:

      hudson.model.Failure: '$' is an unsafe character
      	at jenkins.model.Jenkins.checkGoodName(Jenkins.java:3998)
      	at javaposse.jobdsl.plugin.JenkinsJobManagement.createOrUpdateConfig(JenkinsJobManagement.java:138)

      I also tried with double quotes, hoping that the variable would be resolved as a GString, but then I get:

      FATAL: null
      java.lang.StackOverflowError
      	at sun.reflect.GeneratedMethodAccessor2477.invoke(Unknown Source)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
      	at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
      	at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
      	at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
      	at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:42)
      	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
      	at javaposse.jobdsl.dsl.ContextHelper.executeInContext(ContextHelper.groovy:16)

      Is this an issue with the job dsl plugin or the Bitbucket branch source plugin?

        Attachments

          Issue Links

            Activity

            There are no comments yet on this issue.

              People

              • Assignee:
                Unassigned
                Reporter:
                matfau Mats Faugli
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: