[JIRA] (JENKINS-41979) `multibranchPipelineJob/branchSources/git` should support `browser`

104 views
Skip to first unread message

martin.sander@sap.com (JIRA)

unread,
Feb 13, 2017, 7:35:01 AM2/13/17
to jenkinsc...@googlegroups.com
Martin Sander created an issue
 
Jenkins / Improvement JENKINS-41979
`multibranchPipelineJob/branchSources/git` should support `browser`
Issue Type: Improvement Improvement
Assignee: Daniel Spilker
Components: job-dsl-plugin
Created: 2017/Feb/13 12:34 PM
Priority: Minor Minor
Reporter: Martin Sander

Multibranch Pipeline Jobs allow configuring a repository browser (e.g. stash) in their "Branch Sources" section in the GUI.

However, the multibranchPipelineJob/branchSources/git DSL closure does allow a browser method to be called:

      multibranchPipelineJob(job.name) {
        branchSources {
            git {
                browser {
                    stash browseUrl
                }
                remote job.projectGitUrl
            }
        }
    }

Error message:

Caught: javaposse.jobdsl.dsl.DslScriptException: (script, line 185) No signature of method: javaposse.jobdsl.dsl.helpers.workflow.GitBranchSourceContext.browser() is applicable for argument types: (script$_run_closure3_closure14_closure15_closure19_closure20)

I guess the solution would just be to copy the 'browser' method from GitContext into GitBranchSourceContext...

N.B.: browser already works on pipelineJob.

my workaround for now:

       multibranchPipelineJob(job.name) {
            ...
            configure { project ->
                (project / 'sources' / 'data' / 'jenkins.branch.BranchSource' / 'source') <<
                        browser(class: 'hudson.plugins.git.browser.Stash') {
                            url browseUrl
                        }
            }
Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v7.1.7#71011-sha1:2526d7c)
Atlassian logo

mail@daniel-spilker.com (JIRA)

unread,
Feb 15, 2017, 2:53:04 PM2/15/17
to jenkinsc...@googlegroups.com
Daniel Spilker resolved as Won't Fix
 

Use the Automatically Generated DSL:

multibranchPipelineJob('example') {
  branchSources {
    branchSource {
      source {
        gitSCMSource {
          id('5381650e-77f5-40b8-b4a9-366419f9e284')
          remote('https://example.org/repo.git')
          credentialsId('jenkins-stash')
          includes('*')
          excludes('')
          ignoreOnPushNotifications(false)
          browser {
            stash {
              repoUrl('https://example.org/repo')
            }
          }
        }
      }
      strategy {
        defaultBranchPropertyStrategy {}
      }
    }
  }
}
Change By: Daniel Spilker
Status: Open Resolved
Resolution: Won't Fix

martin.sander@sap.com (JIRA)

unread,
Feb 20, 2017, 4:55:01 AM2/20/17
to jenkinsc...@googlegroups.com
Martin Sander commented on Improvement JENKINS-41979
 
Re: `multibranchPipelineJob/branchSources/git` should support `browser`

Mmh. While this works when running on Jenkins, it does not work for me when running it locally:

Caught: javaposse.jobdsl.dsl.DslScriptException: (script, line 186) No signature of method: javaposse.jobdsl.dsl.helpers.workflow.BranchSourcesContext.branchSource() is applicable for argument types: (script$_run_closure3_closure15_closure16) values: [script$_run_closure3_closure15_closure16@6955cb39]
javaposse.jobdsl.dsl.DslScriptException: (script, line 186) No signature of method: javaposse.jobdsl.dsl.helpers.workflow.BranchSourcesContext.branchSource() is applicable for argument types: (script$_run_closure3_closure15_closure16) values: [script$_run_closure3_closure15_closure16@6955cb39]
	at javaposse.jobdsl.dsl.DslScriptLoader.runScriptEngine(DslScriptLoader.groovy:126)
	at javaposse.jobdsl.dsl.DslScriptLoader.this$2$runScriptEngine(DslScriptLoader.groovy)
	at javaposse.jobdsl.dsl.DslScriptLoader$_runScripts_closure1.doCall(DslScriptLoader.groovy:55)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScripts(DslScriptLoader.groovy:42)
	at javaposse.jobdsl.dsl.DslScriptLoader$runScripts.callCurrent(Unknown Source)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScript(DslScriptLoader.groovy:91)
	at javaposse.jobdsl.dsl.DslScriptLoader$runScript.call(Unknown Source)
	at com.dslexample.debug.XmlOutputRunner$_run_closure2.doCall(XmlOutputRunner.groovy:39)
	at com.dslexample.debug.XmlOutputRunner.run(XmlOutputRunner.groovy:37)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)
Caused by: groovy.lang.MissingMethodException: No signature of method: javaposse.jobdsl.dsl.helpers.workflow.BranchSourcesContext.branchSource() is applicable for argument types: (script$_run_closure3_closure15_closure16) values: [script$_run_closure3_closure15_closure16@6955cb39]
	at javaposse.jobdsl.dsl.AbstractExtensibleContext.methodMissing(AbstractExtensibleContext.groovy:19)
	at javaposse.jobdsl.dsl.AbstractContext.invokeMethod(AbstractContext.groovy)
	at script$_run_closure3_closure15.doCall(script:186)
	at script$_run_closure3_closure15.doCall(script)
	at javaposse.jobdsl.dsl.ContextHelper.executeInContext(ContextHelper.groovy:16)
	at javaposse.jobdsl.dsl.ContextHelper$executeInContext.call(Unknown Source)
	at javaposse.jobdsl.dsl.jobs.MultibranchWorkflowJob.branchSources(MultibranchWorkflowJob.groovy:40)
	at script$_run_closure3.doCall(script:185)
	at javaposse.jobdsl.dsl.JobParent.processItem(JobParent.groovy:114)
	at javaposse.jobdsl.dsl.JobParent.multibranchPipelineJob(JobParent.groovy:105)
	at javaposse.jobdsl.dsl.DslFactory$multibranchPipelineJob.callCurrent(Unknown Source)
	at script.run(script:184)
	at script$run.call(Unknown Source)
	at javaposse.jobdsl.dsl.DslScriptLoader.runScriptEngine(DslScriptLoader.groovy:120)
	... 9 more

Am I just missing dependencies?

martin.sander@sap.com (JIRA)

unread,
Feb 20, 2017, 5:22:01 AM2/20/17
to jenkinsc...@googlegroups.com

Sorry, didn't read https://github.com/jenkinsci/job-dsl-plugin/wiki/Automatically-Generated-DSL completely:

The generated DSL is only supported when running in Jenkins, e.g. it is not available when running from the command line or in the Playground. Use The Configure Block to generate custom config elements when not running in Jenkins.

Sad. .

martin.sander@sap.com (JIRA)

unread,
Feb 20, 2017, 5:26:01 AM2/20/17
to jenkinsc...@googlegroups.com
Martin Sander edited a comment on Improvement JENKINS-41979
{quote}

The generated DSL is only supported when running in Jenkins, e.g. it is not available when running from the command line or in the Playground. Use The Configure Block to generate custom config elements when not running in Jenkins.
{quote}

Sad. :-(. Any plans for supporting running automatically generated DSL locally? I didn't find a JIRA ticket for that, should I create one?

mail@daniel-spilker.com (JIRA)

unread,
Mar 31, 2017, 4:14:02 AM3/31/17
to jenkinsc...@googlegroups.com
Daniel Spilker closed an issue as Won't Fix
Change By: Daniel Spilker
Status: Resolved Closed
This message was sent by Atlassian JIRA (v7.3.0#73011-sha1:3c73d0e)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages