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

`multibranchPipelineJob/branchSources/git` should support `browser`

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Won't Fix
    • Icon: Minor Minor
    • job-dsl-plugin
    • None

      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
                              }
                  }
      

            daspilker Daniel Spilker
            0x89 Martin Sander
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: