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

GString not supported by automatically generated DSL

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      The following script will cause an error because of the GString argument to room

      def SLACK_CHANNEL = 'bar'
      
      job('example') {
        publishers {
          slackNotifier {
            room("foo-${SLACK_CHANNEL}")
            notifyAborted(true)
            notifyFailure(true)
            notifyNotBuilt(false)
            notifyUnstable(true)
            notifyBackToNormal(true)
            notifySuccess(false)
            notifyRepeatedFailure(false)
            startNotification(false)
            includeTestSummary(false)
            includeCustomMessage(false)
            customMessage(null)
            buildServerUrl(null)
            sendAs(null)
            commitInfoChoice('NONE')
            teamDomain(null)
            authToken(null)
          }
        }
      }
      

      console log:

      Processing provided DSL script
      ERROR: (script, line 6) No signature of method: javaposse.jobdsl.plugin.structs.DescribableContext.room() is applicable for argument types: (org.codehaus.groovy.runtime.GStringImpl) values: [foo-bar]
      Possible solutions: wait(), dump(), any(), find(), grep(), wait(long)
      Finished: FAILURE
      

        Attachments

          Issue Links

            Activity

            Hide
            rachel Rachel M. added a comment -

            It works in this way:

            def SLACK_CHANNEL = 'bar'
            
            job('example') {
              publishers {
                slackNotifier {
                  room('foo-' + "${SLACK_CHANNEL}")
                  notifyAborted(true)
                  notifyFailure(true)
                  notifyNotBuilt(false)
                  notifyUnstable(true)
                  notifyBackToNormal(true)
                  notifySuccess(false)
                  notifyRepeatedFailure(false)
                  startNotification(false)
                  includeTestSummary(false)
                  includeCustomMessage(false)
                  customMessage(null)
                  buildServerUrl(null)
                  sendAs(null)
                  commitInfoChoice('NONE')
                  teamDomain(null)
                  authToken(null)
                }
              }
            }
            
            Show
            rachel Rachel M. added a comment - It works in this way: def SLACK_CHANNEL = 'bar' job( 'example' ) { publishers { slackNotifier { room( 'foo-' + "${SLACK_CHANNEL}" ) notifyAborted( true ) notifyFailure( true ) notifyNotBuilt( false ) notifyUnstable( true ) notifyBackToNormal( true ) notifySuccess( false ) notifyRepeatedFailure( false ) startNotification( false ) includeTestSummary( false ) includeCustomMessage( false ) customMessage( null ) buildServerUrl( null ) sendAs( null ) commitInfoChoice( 'NONE' ) teamDomain( null ) authToken( null ) } } }
            Hide
            daspilker Daniel Spilker added a comment -

            This is still an issue, but a minor one since there is an easy workaround.

            Show
            daspilker Daniel Spilker added a comment - This is still an issue, but a minor one since there is an easy workaround.
            Hide
            rachel Rachel M. added a comment -

            Oh, sorry deeply Daniel Spilker, I've just seen you maintain the Job DSL Plugin and I thought it was a user's problem.

            Show
            rachel Rachel M. added a comment - Oh, sorry deeply Daniel Spilker , I've just seen you maintain the Job DSL Plugin and I thought it was a user's problem.
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Spilker
            Path:
            docs/Home.md
            job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/structs/DescribableContext.groovy
            job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy
            job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/structs/DescribableContextSpec.groovy
            job-dsl-plugin/src/test/resources/javaposse/jobdsl/plugin/gstring.groovy
            http://jenkins-ci.org/commit/job-dsl-plugin/b1bcdc6790446e1a74c37d6d93740589119117a3
            Log:
            allow GString as argument type for auto-generated DSL

            [FIXES JENKINS-39153]

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/structs/DescribableContext.groovy job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/structs/DescribableContextSpec.groovy job-dsl-plugin/src/test/resources/javaposse/jobdsl/plugin/gstring.groovy http://jenkins-ci.org/commit/job-dsl-plugin/b1bcdc6790446e1a74c37d6d93740589119117a3 Log: allow GString as argument type for auto-generated DSL [FIXES JENKINS-39153]
            Hide
            scm_issue_link SCM/JIRA link daemon added a comment -

            Code changed in jenkins
            User: Daniel Spilker
            Path:
            docs/Home.md
            job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/structs/DescribableContext.groovy
            job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy
            job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/structs/DescribableContextSpec.groovy
            job-dsl-plugin/src/test/resources/javaposse/jobdsl/plugin/gstring.groovy
            http://jenkins-ci.org/commit/job-dsl-plugin/312a71e6ab0333c23f59e01992c82df882d32149
            Log:
            Merge pull request #942 from daspilker/JENKINS-39153

            JENKINS-39153 allow GString as argument type for auto-generated DSL

            Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/9a9e94c68d12...312a71e6ab03

            Show
            scm_issue_link SCM/JIRA link daemon added a comment - Code changed in jenkins User: Daniel Spilker Path: docs/Home.md job-dsl-plugin/src/main/groovy/javaposse/jobdsl/plugin/structs/DescribableContext.groovy job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/ExecuteDslScriptsSpec.groovy job-dsl-plugin/src/test/groovy/javaposse/jobdsl/plugin/structs/DescribableContextSpec.groovy job-dsl-plugin/src/test/resources/javaposse/jobdsl/plugin/gstring.groovy http://jenkins-ci.org/commit/job-dsl-plugin/312a71e6ab0333c23f59e01992c82df882d32149 Log: Merge pull request #942 from daspilker/ JENKINS-39153 JENKINS-39153 allow GString as argument type for auto-generated DSL Compare: https://github.com/jenkinsci/job-dsl-plugin/compare/9a9e94c68d12...312a71e6ab03

              People

              Assignee:
              daspilker Daniel Spilker
              Reporter:
              daspilker Daniel Spilker
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: