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

Support declarative pipelines

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Major Major
    • golang-plugin
    • None

      Currently, it only seems to be possible to create a scripted pipeline for Go projects with this plugin. I was struggling to find equivalent support for modeling a declarative pipeline.

      The issues I ran into:

      1. Accessing a tool in a declarative pipeline should work just fine.
      2. Defining a custom workspace is not allowed in a declarative pipeline.
      3. Setting the environment variables for different build stages is impractical. If possible those environment variables should already be preset.

      This is how I solved the issue right now, however, Jenkins seems to move away from scripted pipelines toward declarative ones. Let me know if this is already possible.

      node {
          def goHome = tool('go-1.11')
          
          ws("${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/src/github.com/bmuschko/link-verifier") {
              withEnv(["GOROOT=${goHome}", "GOPATH=${JENKINS_HOME}/jobs/${JOB_NAME}/builds/${BUILD_ID}/", "PATH+GO=${goHome}/bin"]) {
              ...
          }
      }
      

            orrc Christopher Orr
            bmuchko Benjamin Muschko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: